Closed snickell closed 2 years ago
As an alternative approach, perhaps the set of "skaffold created special env vars" could be expanded to include git branch, git commit, etc: https://skaffold.dev/docs/environment/templating/
This would allow very nice control of git related tagging (including composite tags) using the envTemplate
variant
@snickell thanks for opening up this issue, I don't know that this will be prioritized by the team but we're always open to PRs :)
I'd be up to implement a PR if there was Skaffold team consensus that (at least in principal) this was a desirable feature
I would propose that:
tagPolicy: gitCommit: variant: 'Branches'
behave just like
variant: 'Tags'
, but will check if the current commit is part of a branch, and use that for the image tag, rather than using the git tag.I'd be up to implement a PR if there was Skaffold team consensus that (at least in principal) this was a desirable feature
I'd say go for it 👍
I'd be up to implement a PR if there was Skaffold team consensus that (at least in principal) this was a desirable feature
Hey @snickell , This is indeed a popular request in the slack community :)
See #7006 for a PR that implements the proposal here
Sorry for the extremely late bump, but is there a way to specify a specific branch? Like if you always want to get the latest commit of "release"?
Since https://github.com/GoogleContainerTools/skaffold/pull/6904 has been merged,
cacheFrom
will automatically munge an not-explicitly-tagged image name to append the current tagPolicy. This makes it potentially very useful for easy layer-build-caching of dev branches..... if the gitCommit tagPolicy permitted a Branch variant.In a dev context when building large docker build on a non-local machine relying on
cacheFrom
pulls rather than a local build cache, image tags are important for exporting and importing the most-relevant-to-current build cache, and git tags are generally not relevant.I would propose that:
behave just like
variant: 'Tags'
, but will check if the current commit is part of a branch, and use that for the image tag, rather than using the git tag.