Skip to content

Commit

Permalink
Fixes double deployment for git components on second push and later
Browse files Browse the repository at this point in the history
  • Loading branch information
mik-dass committed Sep 25, 2019
1 parent 303ba82 commit a2d2e07
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
7 changes: 3 additions & 4 deletions pkg/occlient/templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,9 @@ func generateGitDeploymentConfig(commonObjectMeta metav1.ObjectMeta, image strin
Spec: corev1.PodSpec{
Containers: []corev1.Container{
{
Image: image,
// image stream trigger and specifying an image at the same time are mutually exclusive options
// thus we put "" into image field as we are specifying an image stream trigger
Image: "",
Name: commonObjectMeta.Name,
Ports: containerPorts,
Env: envVars,
Expand All @@ -277,9 +279,6 @@ func generateGitDeploymentConfig(commonObjectMeta metav1.ObjectMeta, image strin
},
},
Triggers: []appsv1.DeploymentTriggerPolicy{
{
Type: "ConfigChange",
},
{
Type: "ImageChange",
ImageChangeParams: &appsv1.DeploymentTriggerImageChangeParams{
Expand Down
18 changes: 8 additions & 10 deletions tests/integration/cmd_url_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ var _ = Describe("odo url command tests", func() {
It("should list appropriate URLs and push message", func() {
var stdout string
url1 := helper.RandString(5)
//url2 := helper.RandString(5)
url2 := helper.RandString(5)
componentName := helper.RandString(6)
helper.CmdShouldPass("odo", "create", "nodejs", "--context", context, "--project", project, componentName, "--ref", "master", "--git", "https://github.com/openshift/nodejs-ex", "--port", "8080,8000")
helper.CmdShouldPass("odo", "push", "--context", context)
Expand All @@ -62,15 +62,13 @@ var _ = Describe("odo url command tests", func() {
stdout = helper.CmdShouldPass("odo", "url", "list", "--context", context)
helper.MatchAllInOutput(stdout, []string{url1, "Locally Deleted", url1, "odo push"})

// Uncomment once https://github.com/openshift/odo/issues/1832 is fixed

// helper.CmdShouldPass("odo", "url", "create", url2, "--port", "8000", "--context", context)
// stdout = helper.CmdShouldPass("odo", "url", "list", "--context", context)
// helper.MatchAllInOutput(stdout, []string{url1, "Absent", url2, "Present", "create/delete URLs", "odo push"})
// helper.CmdShouldPass("odo", "push", "--context", context)
// stdout = helper.CmdShouldPass("odo", "url", "list", "--context", context)
// helper.MatchAllInOutput(stdout, []string{url2, "Present"})
// helper.DontMatchAllInOutput(stdout, []string{url1, "Absent", "odo push"})
helper.CmdShouldPass("odo", "url", "create", url2, "--port", "8000", "--context", context)
stdout = helper.CmdShouldPass("odo", "url", "list", "--context", context)
helper.MatchAllInOutput(stdout, []string{url1, "Absent", url2, "Present", "create/delete URLs", "odo push"})
helper.CmdShouldPass("odo", "push", "--context", context)
stdout = helper.CmdShouldPass("odo", "url", "list", "--context", context)
helper.MatchAllInOutput(stdout, []string{url2, "Present"})
helper.DontMatchAllInOutput(stdout, []string{url1, "Absent", "odo push"})
})
})

Expand Down

0 comments on commit a2d2e07

Please sign in to comment.