Skip to content

Commit

Permalink
fix(api): do not prefix non cds parameters (#4175)
Browse files Browse the repository at this point in the history
  • Loading branch information
sguiheux authored Apr 10, 2019
1 parent 173f46f commit 81c39cb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 4 additions & 0 deletions engine/api/workflow/process_node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1316,6 +1316,7 @@ func TestGitParamOn2ApplicationSameRepo(t *testing.T) {
var manualEvent sdk.WorkflowNodeRunManual
manualEvent.Payload = map[string]string{
"git.branch": "feat/branch",
"my.value": "bar",
}

opts := &sdk.WorkflowRunPostHandlerOption{
Expand All @@ -1336,13 +1337,16 @@ func TestGitParamOn2ApplicationSameRepo(t *testing.T) {
assert.Equal(t, "mylastcommit", mapParams["git.hash"])
assert.Equal(t, "steven.guiheux", mapParams["git.author"])
assert.Equal(t, "super commit", mapParams["git.message"])
assert.Equal(t, "bar", mapParams["my.value"])

mapParams2 := sdk.ParametersToMap(wr.WorkflowNodeRuns[w.WorkflowData.Node.Triggers[0].ChildNode.ID][0].BuildParameters)
t.Logf("%+v", mapParams2)
assert.Equal(t, "feat/branch", mapParams2["git.branch"])
assert.Equal(t, "mylastcommit", mapParams2["git.hash"])
assert.Equal(t, "steven.guiheux", mapParams2["git.author"])
assert.Equal(t, "super commit", mapParams2["git.message"])
assert.Equal(t, "bar", mapParams2["my.value"])
assert.Equal(t, "build", mapParams2["workflow.root.pipeline"])

}

Expand Down
2 changes: 0 additions & 2 deletions engine/api/workflow/process_parameters.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,6 @@ func getParentParameters(w *sdk.WorkflowRun, nodeRuns []*sdk.WorkflowNodeRun) ([
// keep p.Name as is
} else if strings.HasPrefix(param.Name, "cds.") {
param.Name = strings.Replace(param.Name, "cds.", prefix, 1)
} else {
param.Name = prefix + param.Name
}
parentParams = append(parentParams, param)
}
Expand Down

0 comments on commit 81c39cb

Please sign in to comment.