Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with BuildConfig being mutated incorrectly #39

Closed
clarku opened this issue Nov 3, 2021 · 1 comment · Fixed by #41
Closed

Issue with BuildConfig being mutated incorrectly #39

clarku opened this issue Nov 3, 2021 · 1 comment · Fixed by #41

Comments

@clarku
Copy link

clarku commented Nov 3, 2021

Issue

Creating a BuildConfig with spec.output.to.kind: ImageStreamTag, and a value for spec.output.to.namespace gives an error:

Example build config:

spec: 
  output:
    to:
      kind: ImageStreamTag
      namespace: example
      name: example.com/test/test:latest

Error Message:

The Build {build-name} is invalid: spec.output.to.namespace: Invalid value: "example": namespace is not valid when used with a 'DockerImage'

Replication Steps

  1. Create a build config using the above spec

  2. Start build with
    oc start-build {build-name}

Cause:

Normally this error would come up with a build config like this:

spec: 
  output:
    to:
      kind: DockerImage
      namespace: example
      name: example.com/test/test:latest

where there is a kind: DockerImage with a namespace value. This is invalid as the namespace value should only be used with kind: ImageStreamTag.

However in this case there is an issue with the operator where it is changing the spec incorrectly:

In lines 145-149 of quay-bridge-operator/pkg/webhook/webhook.go we have this code in the mutating webhook which changes the spec.output.to value to DockerImage.

// Update the Kind
 patch = append(patch, patchOperation{
  Op:    "replace",
  Path:  "/spec/output/to/kind",
  Value: "DockerImage",
})

However there is no code which checks for the existence of the spec.output.to.namespace value and deletes it, thus causing the error.

@BillDett
Copy link

BillDett commented Dec 8, 2021

Thanks for the PR!- I've added a JIRA to track this as part of the overall Quay delivery- https://issues.redhat.com/browse/PROJQUAY-2898 - we'll continue updates there.

@ricardomaraschini ricardomaraschini changed the title Issue with BuildConfig being mutated incorrectly Issue with BuildConfig being mutated incorrectly (PROJQUAY-2898) Feb 3, 2022
@ricardomaraschini ricardomaraschini changed the title Issue with BuildConfig being mutated incorrectly (PROJQUAY-2898) Issue with BuildConfig being mutated incorrectly Feb 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants