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

Always add image flag to jib builders in skaffold init #2854

Merged
merged 1 commit into from
Sep 10, 2019
Merged

Always add image flag to jib builders in skaffold init #2854

merged 1 commit into from
Sep 10, 2019

Conversation

TadCordle
Copy link
Contributor

@TadCordle TadCordle commented Sep 10, 2019

Fixes #2852

skaffold init used to use Jib's configured to.image to auto-pair Jib projects with k8s images. However, the skaffold.yaml that was generated prioritized the to.image configuration over the k8s images, possibly resulting in a skaffold.yaml that points a Jib builder to an image that isn't defined in a k8s manifest. This PR fixes that by only using k8s images in the generated artifacts, and also always explicitly passing a -Dimage= flag to Jib to make sure it builds the correct image, despite its configuration.

@GoogleContainerTools/java-tools-build

Copy link
Member

@chanseokoh chanseokoh left a comment

Choose a reason for hiding this comment

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

I wondered if this should prompt the user for checking the mismatch, but thinking about it, this sounds reasonable. It will continue to prompt for non-single builder or project setups if image names don't match, right?

@codecov
Copy link

codecov bot commented Sep 10, 2019

Codecov Report

Merging #2854 into master will decrease coverage by 0.01%.
The diff coverage is 100%.

Impacted Files Coverage Δ
pkg/skaffold/jib/jib_init.go 88.88% <100%> (-0.67%) ⬇️

@TadCordle
Copy link
Contributor Author

@chanseokoh Yes, for the most part. If a match can be determined, it will still be automatic (i.e. Jib's to.image matches an image in a k8s yaml), but if there are multiple builders that can't be determined automatically then it will resort to a prompt. The only automatic pairing that happens with a mismatched image is if exactly one builder and one k8s image are found.

Copy link
Member

@chanseokoh chanseokoh left a comment

Choose a reason for hiding this comment

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

Yeah, SGTM.

@TadCordle TadCordle merged commit b7ff947 into GoogleContainerTools:master Sep 10, 2019
@TadCordle TadCordle deleted the i2852-always-jib-flags branch September 10, 2019 23:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Skaffold init uses incorrect image with single jib config + single k8s manifest
3 participants