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

Images are built with dirty tree state #431

Open
timebertt opened this issue Jun 24, 2020 · 7 comments
Open

Images are built with dirty tree state #431

timebertt opened this issue Jun 24, 2020 · 7 comments
Assignees
Labels
kind/enhancement Enhancement, improvement, extension lifecycle/rotten Nobody worked on this for 12 months (final aging stage)

Comments

@timebertt
Copy link
Member

What would you like to be added:
Currently our Docker images are built with a dirty tree state.
I discovered this while looking into how the pipeline appends the commit hash to the version file (ref).

If the version file is the only thing we touch while building, I would propose to only use the EFFECTIVE_VERSION env var to compute the correct version inside the various build scripts/make targets instead of writing it to the VERSION file.

Why is this needed:
For example:

$ curl -k https://gardener-apiserver:8080/version -H "Authorization: Bearer <redacted>"
{
  "major": "v1",
  "minor": "6",
  "gitVersion": "v1.6.4",
  "gitCommit": "f8a5056de1a3a8fe7cdee939172ba79b2386a395",
  "gitTreeState": "dirty",
  "buildDate": "2020-06-21T19:35:09+00:00",
  "goVersion": "go1.14.3",
  "compiler": "gc",
  "platform": "linux/amd64"
}

/cc @rfranzke

@timebertt timebertt added the kind/enhancement Enhancement, improvement, extension label Jun 24, 2020
@timebertt
Copy link
Member Author

Ref gardener/gardener#2500

@ccwienk
Copy link
Member

ccwienk commented Jul 13, 2020

@tim-ebert : actually, there is a configuration option inject_effective_version (https://gardener.github.io/cc-utils/traits/version.html), which will by default not alter the source tree. I just checked - this is set to true for gardener/gardener (branch.cfg in refs/meta/ci).
--> so you could simply achieve this by changing this either to false explicitly, or removing the configuration.

@ccwienk
Copy link
Member

ccwienk commented Jul 20, 2020

@tim-ebert , as just discussed:

  • worktree / source directory is currently the only way we expose through our pipeline contract to pass parameters to container image builds, so - while it is possible to disable version injection - you will have to keep injecting the effective version as currently configured
  • we (cicd team) shall extend the pipeline contract such that arguments can be passed to the container image builds

@timebertt
Copy link
Member Author

Thanks @ccwienk for your help.
I opened gardener/gardener#2608 to ignore the injected VERSION file during build time.
/unassign

Indeed, it would be great to inject the version by setting the EFFECTIVE_VERSION docker build arg in our pipelines.
/assign @ccwienk

@gardener-robot gardener-robot assigned ccwienk and unassigned timebertt Jul 21, 2020
@gardener-robot gardener-robot added the lifecycle/stale Nobody worked on this for 6 months (will further age) label Sep 20, 2020
@rfranzke
Copy link
Member

/touch

@gardener-robot gardener-robot removed the lifecycle/stale Nobody worked on this for 6 months (will further age) label Sep 30, 2020
@gardener-robot gardener-robot added the lifecycle/stale Nobody worked on this for 6 months (will further age) label Nov 30, 2020
@ccwienk
Copy link
Member

ccwienk commented Dec 14, 2020

@timebertt : I would like to add as a smallish update on the matter that since last week, it is possible to pass arguments to docker-build using the build_args attr in the pipeline-definition:

https://gardener.github.io/cc-utils/traits/publish.html#trait-publish

@timebertt
Copy link
Member Author

Can we inject the effective version into docker builds then with this instead of via the version file?

@gardener-robot gardener-robot added lifecycle/rotten Nobody worked on this for 12 months (final aging stage) and removed lifecycle/stale Nobody worked on this for 6 months (will further age) labels Sep 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement Enhancement, improvement, extension lifecycle/rotten Nobody worked on this for 12 months (final aging stage)
Projects
None yet
Development

No branches or pull requests

4 participants