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

feat: variable replacement support for lagoon.base.image label #378

Merged
merged 4 commits into from
Oct 21, 2024

Conversation

bomoko
Copy link
Contributor

@bomoko bomoko commented Oct 6, 2024

This PR extends #355 by adding the ability to specify tags with environment variables.

It allows the lagoon.base.image task to be populated with variables that can be provided to a project or environment and parse them during a lagoon build stage to calculate the required base image to pull.

Variable replacement is similar to envplate. They must be in the ${} format, ie

# no default, will error if `BASE_IMAGE_TAG` is not provided by the project or environment
lagoon.base.image: 'repo/image:${BASE_IMAGE_TAG}' 
# default of `main` if `BASE_IMAGE_TAG` is not provided by the project or environment
lagoon.base.image: 'repo/image:${BASE_IMAGE_TAG:-main}'`
# it is possible to replace more than just the tag too
lagoon.base.image: '${BASE_IMAGE_REPO:-repo}/image:${BASE_IMAGE_TAG:-main}'`

Nested variables like ${BASE_IMAGE_TAG:-${OTHER_IMAGE_TAG:-latest}} will not work.

@bomoko bomoko requested a review from shreddedbacon October 6, 2024 23:06
@shreddedbacon shreddedbacon force-pushed the feature/imagerefreshtags branch from b91f0da to cc0413d Compare October 8, 2024 07:50
@shreddedbacon shreddedbacon added this to the 2.22.0 milestone Oct 8, 2024
@shreddedbacon shreddedbacon changed the title Adds ability to specify tags in refreshimages feat: variable replacement support for lagoon.base.image label Oct 13, 2024
@shreddedbacon shreddedbacon force-pushed the feature/imagerefreshtags branch from cc0413d to dbfb061 Compare October 13, 2024 21:49
@shreddedbacon shreddedbacon marked this pull request as ready for review October 13, 2024 21:49
@shreddedbacon shreddedbacon force-pushed the feature/imagerefreshtags branch from dbfb061 to b02abbb Compare October 21, 2024 22:05
Copy link
Member

@shreddedbacon shreddedbacon left a comment

Choose a reason for hiding this comment

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

After discussing with the team, consensus is that this is fine to merge.

@shreddedbacon shreddedbacon merged commit b899eb6 into main Oct 21, 2024
2 checks passed
@shreddedbacon shreddedbacon deleted the feature/imagerefreshtags branch October 21, 2024 22:17
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

Successfully merging this pull request may close these issues.

2 participants