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

Auto populate the container version based on a "primary rpm" version #963

Closed
cverna opened this issue Apr 9, 2018 · 8 comments
Closed

Comments

@cverna
Copy link
Contributor

cverna commented Apr 9, 2018

After opening [0] in koji-containerbuild it seems that atomic-reactor is a better place to implement this feature.
After briefly looking at the pre_bump_release plugin, I think the best way would be to create a similar plugin.

My inital thoughts are :

  • Dockerfile to have a new label that stores the primary rpm used to populate the version of the container for example "rpm.version". (we might be able to reuse the component label but having a new label brings flexibility)

  • "rpm.version" to be added to the LABEL_TYPE_VERSION so a Dockerfile with only "rpm.version" will be valid. If this label is not used then we still need to provide the Version label.

  • Add a new plugin in atomic-reactor (pre-build)

    • plugin to read the "rpm.version" label content
    • plugin to query koji with getLatestBuild ---> This API requires a koji tag ( need to investigate how we can find out which tag to use)
    • plugin to use the result of koji getLatestBuild to replace the value of "rpm.version"

[0] - containerbuildsystem/koji-containerbuild#95

@lcarva
Copy link
Contributor

lcarva commented Apr 9, 2018

plugin to query koji with getLatestBuild ---> This API requires a koji tag ( need to investigate how we can find out which tag to use)

This should be from either the koji build or destination tag of the given koji target.

@TomasTomecek
Copy link
Contributor

Continuing discussion over here.

With post plugin, you would be 100% sure on the version. It's possible that querying koji could result into getting a different package than koji predicted? Also what about images which don't utilize koji for getting packages? When they get packages from dedicated repositories.

The implementation as a post build plugin could look like this:

  1. version=$(docker run $image rpm -q --qf "%{version}" $package)
  2. docker create --name working-container $image
  3. docker commit -c "LABEL version=$version" working-container $image

@lcarva
Copy link
Contributor

lcarva commented Apr 9, 2018

@TomasTomecek, the Dockerfile at /root/build-info would also need updating. The internal state of atomic-reactor must also be updated for tag_from_config plugin, for example. There could be other oddities too, which makes me shy away from this approach.

I wanna say that the safest way would be to do as a prebuild plugin, then verify it was correctly set, say in all_rpm_packages. But it would be great if we didn't tie this to koji at all.

I think postbuild would make the feature more versatile as it wouldn't require koji. I'm just concerned that implementation might not be as straight forward. Maybe it's worth giving that a try and see how it lands?

@lcarva
Copy link
Contributor

lcarva commented Apr 9, 2018

Oh! It has to be done as a prebuild plugin if you want to leverage bump_release.

@TomasTomecek
Copy link
Contributor

Maybe it's worth giving that a try and see how it lands?

+1

@cverna
Copy link
Contributor Author

cverna commented Apr 10, 2018

I see how the postbuild gives more flexibility and assurance that we have the correct version. It seems indeed a better solution that the prebuild.

I ll look at some postbuild plugin and try to see what I can do :)

@twaugh
Copy link
Member

twaugh commented Nov 16, 2018

How would this work for container-first container images, where there may not be any RPMs at all?

@lcarva
Copy link
Contributor

lcarva commented Jun 24, 2021

Closing due to lack of interest and activity. If you're still interested feel free to reopen it.

@lcarva lcarva closed this as completed Jun 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants