Skip to content

Commit

Permalink
fix(2878): exclude warning from merging build meta (#454)
Browse files Browse the repository at this point in the history
  • Loading branch information
klu909 authored Jul 25, 2023
1 parent e151a1d commit 7227750
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
7 changes: 4 additions & 3 deletions launch.go
Original file line number Diff line number Diff line change
Expand Up @@ -524,11 +524,12 @@ func launch(api screwdriver.API, buildID int, rootDir, emitterPath, metaSpace, s
buildMeta["coverageKey"] = coverageInfo.EnvVars["SD_SONAR_PROJECT_KEY"]
}

mergedBuildMeta := buildMeta
if mergedMeta["build"] != nil {
mergedMeta["build"] = deepMergeJSON(mergedMeta["build"].(map[string]interface{}), buildMeta)
} else {
mergedMeta["build"] = buildMeta
mergedBuildMeta = deepMergeJSON(mergedMeta["build"].(map[string]interface{}), buildMeta)
}
delete(mergedBuildMeta, "warning")
mergedMeta["build"] = mergedBuildMeta

eventMeta := map[string]interface{}{
"creator": event.Creator["username"],
Expand Down
1 change: 1 addition & 0 deletions launch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2557,6 +2557,7 @@ func TestMetaWhenStartFromAnyJobWithParentEvent(t *testing.T) {
"coverageKey": "parent_event_value", // Overwrote by default value
"parent_event_only": "parent_event_value", // Remain
"build_and_event_and_parent_event": "parent_event_value", // Remain
"warning": "parent_event_value", // Removed from merged meta
},
"event": map[string]interface{}{
"creator": "parent_event_value", // Overwrote by default value
Expand Down

0 comments on commit 7227750

Please sign in to comment.