Skip to content

Commit

Permalink
🐛 [patch] Fix pr values override (#88)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pohfy123 committed Mar 9, 2021
1 parent 97aec8b commit b8d7ca3
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
20 changes: 10 additions & 10 deletions internal/staging/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -612,18 +612,18 @@ func (c *controller) deployQueueComponent(
)

if queue.IsComponentUpgradeQueue() || queue.IsPullRequestQueue() {
// merge stable only matched component or dependencies
for _, comp := range queueComps {
if queue.IsPullRequestQueue() {
bundleName := queue.Spec.Name
envValues, err := configctrl.GetEnvComponentValues(cfg, bundleName, c.teamName, envType)
if err != nil {
errCh <- err
return
}
values = valuesutil.MergeValues(values, envValues)
if queue.IsPullRequestQueue() {
bundleName := queue.Spec.Name
envValues, err := configctrl.GetEnvComponentValues(cfg, bundleName, c.teamName, envType)
if err != nil {
errCh <- err
return
}
values = valuesutil.MergeValues(values, envValues)
}

// merge stable only matched component or dependencies
for _, comp := range queueComps {
v := genCompValueFromQueue(comp.Name, queue.Spec.Components)
if comp.Name == parentComp.Name {
// queue is parent
Expand Down
11 changes: 11 additions & 0 deletions test/e2e/pullrequest/ctrl.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,12 @@ var _ = Describe("[e2e] Pull request controller", func() {
jsonPRData, _ := json.Marshal(map[string]interface{}{
"bundleName": bundledCompPRBundleName,
"prNumber": prNumber,
"components": []map[string]interface{}{
{
"name": mariaDBCompName,
"tag": mariaDBImageTag,
},
},
})
apiURL := fmt.Sprintf("%s/teams/%s/pullrequest/trigger", server.URL, teamName)
_, _, err = utilhttp.Post(apiURL, jsonPRData)
Expand Down Expand Up @@ -1127,6 +1133,11 @@ var (
bundledPRTriggerName = internal.GenPullRequestBundleName(bundledCompPRBundleName, prNumber)

configSpec = s2hv1.ConfigSpec{
Envs: map[s2hv1.EnvType]s2hv1.ChartValuesURLs{
"pull-request": map[string][]string{
bundledPRTriggerName: {"https://raw.githubusercontent.com/agoda-com/samsahai-example/master/envs/pull-request/wordpress-missing-mariadb-image.yaml"},
},
},
Staging: &s2hv1.ConfigStaging{
Deployment: &s2hv1.ConfigDeploy{},
},
Expand Down

0 comments on commit b8d7ca3

Please sign in to comment.