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

Add tagPolicy: gitCommit: variant: Branches #6989

Closed
snickell opened this issue Jan 4, 2022 · 7 comments · Fixed by #7006
Closed

Add tagPolicy: gitCommit: variant: Branches #6989

snickell opened this issue Jan 4, 2022 · 7 comments · Fixed by #7006
Labels

Comments

@snickell
Copy link
Contributor

snickell commented Jan 4, 2022

Since #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:

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.

@snickell
Copy link
Contributor Author

snickell commented Jan 4, 2022

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

@MarlonGamez
Copy link
Contributor

@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 :)

@snickell
Copy link
Contributor Author

I'd be up to implement a PR if there was Skaffold team consensus that (at least in principal) this was a desirable feature

@gsquared94
Copy link
Contributor

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 👍

@vikas027
Copy link

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 :)

@snickell
Copy link
Contributor Author

See #7006 for a PR that implements the proposal here

@cyraid
Copy link

cyraid commented May 23, 2024

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"?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants