mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2026-09-05 20:07:25 +00:00
Add test to verify that additional envs from manual run are available to when conditions (#7090)
This commit is contained in:
@@ -179,6 +179,39 @@ steps:
|
||||
assert.NotContains(t, publishStep.Environment, "GO_VERSION")
|
||||
}
|
||||
|
||||
func TestAdditionalEnvsWhenEvaluate(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
yamlData := []byte(`
|
||||
when:
|
||||
event: manual
|
||||
evaluate: 'TAG == "1.2.3"'
|
||||
steps:
|
||||
- name: build
|
||||
image: scratch
|
||||
commands:
|
||||
- go build
|
||||
`)
|
||||
|
||||
m := &testMetadata{
|
||||
pipelineEvent: "manual",
|
||||
}
|
||||
|
||||
b := PipelineBuilder{
|
||||
GetWorkflowMetadata: m.GetWorkflowMetadata,
|
||||
AdditionalEnvs: map[string]string{
|
||||
"TAG": "1.2.3",
|
||||
},
|
||||
RepoTrusted: &metadata.TrustedConfiguration{},
|
||||
Yamls: []*YamlFile{{Data: yamlData}},
|
||||
}
|
||||
|
||||
items, err := b.Build()
|
||||
assert.NoError(t, err)
|
||||
assert.Len(t, items, 1,
|
||||
"workflow must not be filtered when evaluate matches an additional (manual trigger) variable")
|
||||
}
|
||||
|
||||
func TestMultilineEnvsubst(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user