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

docs: add examples of configuration #74

Merged
merged 2 commits into from
Oct 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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