Allow environment variables to be injected into the docker build map #4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Thanks for taking my last pull request. This one's just slightly more interesting. We want our docker containers to be tagged with some build number information, as coming from Jenkins'
BUILD_NUMBER
environment variable for example. This way, we can tag containers with both project-name:version and project-name:version-build. Our CD pipeline picks the latest docker images labelled against the desired branch and tagged with a tag that matches a "major.minor.patch-build" pattern, and sends updated name:tag values to Helm, to perform a rolling update on our K8s cluster. When we're happy with the state of a container, we push it out for use, without the -BUILD number part of the tag.So... this change adds the ability to have something like this in the
:docker
configuration:The syntax is similar to the way one dereferences a variable in bash with defaulting. The resulting container will be tagged with the version number and with the version number and build number appended. If used in a context where the environment variable is not defined, the default is used. If there is no default, an empty string is substituted.
For completeness, environment variables can be injected into
:image-name
,:version
,:dockerfile
, and:build-dir
in the:docker
configuration map.