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

Adds git sha scope for variable injection #211

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

bomoko
Copy link
Contributor

@bomoko bomoko commented Jun 8, 2023

This PR suggests a way of controlling scope for the GIT_SHA variable, as described in #210

Closes #210

Comment on lines +50 to +67
case "$INJECT_GIT_SHA" in
true|both)
LAGOON_GIT_SHA=$GIT_SHA
LAGOON_BUILD_GIT_SHA=$GIT_SHA
;;
build)
LAGOON_BUILD_GIT_SHA=$GIT_SHA
LAGOON_GIT_SHA="0000000000000000000000000000000000000000"
;;
runtime)
LAGOON_BUILD_GIT_SHA="0000000000000000000000000000000000000000"
LAGOON_GIT_SHA=$GIT_SHA
;;
*)
LAGOON_GIT_SHA="0000000000000000000000000000000000000000"
LAGOON_BUILD_GIT_SHA=$LAGOON_GIT_SHA
;;
esac
Copy link
Member

@shreddedbacon shreddedbacon Jun 21, 2023

Choose a reason for hiding this comment

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

My only concerns with this are that the environment_variables.git_sha field goes from being a boolean, to a string. I think it is ok though.

Edit: And this field isn't in the go rewrite yet either, so I'm more comfortable with it changing now before it gets merged into the newer code base.

@shreddedbacon
Copy link
Member

Maybe it makes sense to just set LAGOON_BUILD_GIT_SHA to be the git sha all the time, this way users can consume it if they need to without needing to modify their sha settings when they may only need this value in certain images. as LAGOON_GIT_SHA influences an entire build process.

There is also the LAGOON_BUILD_NAME that can be consumed as a build argument if required for a unique variable in each build that consumed as required by users if they need something that changes reliably during a build.

@shreddedbacon shreddedbacon added the enhancement New feature or request label Dec 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GIT_SHA as build variable only/allowing setting of scope
2 participants