Skip to content
This repository has been archived by the owner on Sep 29, 2021. It is now read-only.

Commit

Permalink
Merge pull request #74 from suzuki-shunsuke/docs/add-examples-2
Browse files Browse the repository at this point in the history
docs: add examples of configuration
  • Loading branch information
suzuki-shunsuke authored Oct 14, 2020
2 parents c059e0b + 96978a3 commit 6842a8e
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 2 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions examples/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
17 changes: 17 additions & 0 deletions examples/read_file.yaml
Original file line number Diff line number Diff line change
@@ -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
10 changes: 10 additions & 0 deletions examples/stdin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
phases:
- name: main
tasks:
- name: hello
command:
stdin: |
foo
bar
command: grep bar

0 comments on commit 6842a8e

Please sign in to comment.