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

Skip image tag info is lost #3636

Closed
wwadge opened this issue Apr 7, 2022 · 8 comments
Closed

Skip image tag info is lost #3636

wwadge opened this issue Apr 7, 2022 · 8 comments

Comments

@wwadge
Copy link
Contributor

wwadge commented Apr 7, 2022

#2360

In that issue, support was added to skip pushing tags of unchanged images, however that information of what was pushed isn't recorded making it difficult to follow up with external tooling.

It would be good to create a file or update the existing json output to mark if a new tag was pushed out.

@mpeddada1
Copy link
Contributor

@wwadge Thanks for filing the issue. We usually log what has been pushed here and mention whether something was skipped in this code snippet when building an image. Could you provide us with more information on what is missing at the moment?

@wwadge
Copy link
Contributor Author

wwadge commented Apr 7, 2022

That log is good but not sufficient for my use case is different so let me describe it. We have a monorepo and we build images for each module inside it. Most of the modules remain untouched and using the feature in the existing code we can skip the build/tags of anything that hasn't changed.

Now after the build process is complete we need to invoke other tooling (eg kubectl/skaffold, updates to jira, whatever) on only the images that have changed so we need to come up with some kind of list that says: these modules had new images pushed out so go ahead and release them while these other modules were unchanged so we can skip them.

Therefore we need a way that at the end of the jib process we can ask either the build system (gradle for eg) or in a simpler way: traverse the filesystem for the jib json files that are being created to figure out which modules have changed.

Something like having a field like imagePushed = true/false or a jib.imagepushed file created in each module

@mpeddada1
Copy link
Contributor

I see, thanks for the context! To double check, would it be possible in the CI to determine if the digest of the image produced changed? Otherwise, Jib generates an jib-image.json file which includes the metadata of the image built as shown in (#2227) so adding a field there could be a possibility. Will leave this issue open if you'd like to explore this further or contribute.

@wwadge
Copy link
Contributor Author

wwadge commented Apr 11, 2022

It would, but it would be inefficient since Jib is already doing that in the first place, i.e. it already has that info as part of it's execution. It also has the possibility of race conditions (= looks like it changed even though I haven't built it in this build).

Will try to submit a MR for this

@mpeddada1
Copy link
Contributor

That's valid, you're right that the check would have to be done twice. Adding the pushed image bit in a metadata file seems helpful in any case. Looking forward to it.

@wwadge
Copy link
Contributor Author

wwadge commented Apr 11, 2022

PR here: #3641

@ddixit14
Copy link

Thanks for your contribution!

@wwadge wwadge closed this as completed Jun 15, 2022
@mpeddada1
Copy link
Contributor

Thanks again for your contribution @wwadge! jib-maven-plugin and jib.gradle.plugin 3.3.0 and jib-cli 0.11.0 have been released this feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants