From aa09f04a4757e7e7db6138b351346228e501d736 Mon Sep 17 00:00:00 2001 From: Shunsuke Suzuki Date: Thu, 15 Oct 2020 00:04:42 +0900 Subject: [PATCH 1/2] docs: add examples of configuration --- examples/main_test.go | 8 ++++++++ examples/read_file.yaml | 17 +++++++++++++++++ examples/stdin.yaml | 10 ++++++++++ 3 files changed, 35 insertions(+) create mode 100644 examples/read_file.yaml create mode 100644 examples/stdin.yaml diff --git a/examples/main_test.go b/examples/main_test.go index 5a1f4f6..3818d07 100644 --- a/examples/main_test.go +++ b/examples/main_test.go @@ -28,6 +28,14 @@ func TestBuildflow(t *testing.T) { title: "task.when is true", file: "task_when_true.yaml", }, + { + title: "read_file", + file: "read_file.yaml", + }, + { + title: "command's standard input", + file: "stdin.yaml", + }, { title: "buildflow run fails as expected", file: "fail.yaml", diff --git a/examples/read_file.yaml b/examples/read_file.yaml new file mode 100644 index 0000000..95b55b6 --- /dev/null +++ b/examples/read_file.yaml @@ -0,0 +1,17 @@ +--- +phases: +- name: main + tasks: + - name: foo + read_file: + path: read_file.yaml + - name: bar + command: + command: | + echo "$FOO" + env: + - key: FOO + value: | + {{with GetTaskByName .Tasks "foo"}}{{.File.Text}}{{end}} + dependency: + - foo diff --git a/examples/stdin.yaml b/examples/stdin.yaml new file mode 100644 index 0000000..83b66ec --- /dev/null +++ b/examples/stdin.yaml @@ -0,0 +1,10 @@ +--- +phases: +- name: main + tasks: + - name: hello + command: + stdin: | + foo + bar + command: grep bar From 96978a35cd0c3c6a1ef2e0cb88bedd7fb7e48f7c Mon Sep 17 00:00:00 2001 From: Shunsuke Suzuki Date: Thu, 15 Oct 2020 00:06:23 +0900 Subject: [PATCH 2/2] docs: fix read_file task's result --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 795f812..2298313 100644 --- a/README.md +++ b/README.md @@ -210,7 +210,7 @@ phases: - foo when: | text := import("text") - result := text.contains(Task[0].FileText, "dist") + result := text.contains(Task[0].File.Text, "dist") ``` ### Refer to the pull request meta information in the configuration @@ -578,7 +578,8 @@ phases: foo: foo - Name: bar Status: succeeded - FileText: foo # The content of the file + File: + Text: foo # The content of the file ... Tasks: # the tasks of the current phase - Name: init # the task name