Skip to content

Commit

Permalink
Don't trigger a build if the namespaces differ
Browse files Browse the repository at this point in the history
  • Loading branch information
Andy Goldstein committed Apr 16, 2015
1 parent f2b97a6 commit 4c037e4
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pkg/build/controller/image_change_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,16 @@ func (c *ImageChangeController) HandleImageRepo(repo *imageapi.ImageStream) erro
continue
}
change := trigger.ImageChange

changeNamespace := change.From.Namespace
if len(changeNamespace) == 0 {
changeNamespace = config.Namespace
}

// only trigger a build if this image repo matches the name and namespace of the ref in the build trigger
// also do not trigger if the imagerepo does not have a valid DockerImageRepository value for us to pull
// the image from
if len(repo.Status.DockerImageRepository) == 0 || change.From.Name != repo.Name ||
(len(change.From.Namespace) != 0 && change.From.Namespace != repo.Namespace) {
if len(repo.Status.DockerImageRepository) == 0 || change.From.Name != repo.Name || changeNamespace != repo.Namespace {
continue
}
latest, err := imageapi.LatestTaggedImage(repo, change.Tag)
Expand Down

0 comments on commit 4c037e4

Please sign in to comment.