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

Management of non Docker or S2I build types #17

Merged
merged 2 commits into from Jan 18, 2021
Merged

Management of non Docker or S2I build types #17

merged 2 commits into from Jan 18, 2021

Conversation

sabre1041
Copy link
Collaborator

Addresses how to handle other build types that are not compatible with producing output images

@@ -124,7 +124,7 @@ func getAdmissionResponseForBuild(ar *v1beta1.AdmissionReview, quayIntegration *

quayRegistryHostname, err := quayIntegration.GetRegistryHostname()

if build.Spec.CommonSpec.Output.To.Kind != "ImageStreamTag" {
if buildv1.JenkinsPipelineBuildStrategyType == build.Spec.Strategy.Type || build.Spec.CommonSpec.Output.To == nil || build.Spec.CommonSpec.Output.To.Kind != "ImageStreamTag" {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I read the docs correct it seems like only the strategies (build.spec.strategy.type) of type sourceStrategy or dockerStrategy or customStrategy qualify for build outputs to be images. So maybe a reverse check on them is more future-proof than intercepting Jenkins builds. To be safe I'd also check if the spec.output element exists.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the PR

@@ -124,7 +124,7 @@ func getAdmissionResponseForBuild(ar *v1beta1.AdmissionReview, quayIntegration *

quayRegistryHostname, err := quayIntegration.GetRegistryHostname()

if buildv1.JenkinsPipelineBuildStrategyType == build.Spec.Strategy.Type || build.Spec.CommonSpec.Output.To == nil || build.Spec.CommonSpec.Output.To.Kind != "ImageStreamTag" {
if (build.Spec.Strategy.DockerStrategy == nil && build.Spec.Strategy.SourceStrategy == nil) || build.Spec.CommonSpec.Output.To.Kind != "ImageStreamTag" {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about custom build strategies? Other than that, assuming that Docker and S2I strategies mandate that spec.ouput.to is not NIL I think this lgtm

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Custom Build strategies is a big question on whether it should be supported which is why I went down my original approach to really only exclude JenkinsPipeline and then do checks on whether certain fields are present.

Output is not a pointer so there will not be an issue of hitting a NPE

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ack on custom builds not being supported. I think we should not break the system when we encounter such a build. People could be mixing several types of build configs in a namespace. Not supporting it by gracefully ignoring those seems the best way to me.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As the logic stands now, custom strategies would not have their output image destinations mutated and would be ignored. Is that the expectation that we would want to deliver?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good to me for now.

@sabre1041 sabre1041 merged commit 8a945e6 into quay:master Jan 18, 2021
@sabre1041 sabre1041 deleted the manage-other-build-types branch January 18, 2021 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants