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

Git inputs cannot reference tags with the ref option #2932

Open
mloesch opened this issue Apr 30, 2024 · 1 comment
Open

Git inputs cannot reference tags with the ref option #2932

mloesch opened this issue Apr 30, 2024 · 1 comment
Labels
Bug Something isn't working

Comments

@mloesch
Copy link

mloesch commented Apr 30, 2024

As far as I understand, git branches and tags are types of git refs (they are stored under .git/refs).

IMO it should therefore be possible to use the ref option as a generic way for referencing commits, branches, and tags.

This is actually stated in the documentation:

Any ref that is a valid input to git checkout is accepted.

https://buf.build/docs/reference/inputs#other-options

However, while git checkout remote-tag is working, buf generate "ssh://[email protected]/path-to-repo.git#ref=remote-tag" is not.

IMO this feature would make parameterizing CI pipelines easier, e.g.:

  • ssh://[email protected]/path-to-repo.git#ref=develop - build against latest changes on the develop branch
  • ssh://[email protected]/path-to-repo.git#ref=v1.0.0 - build against a stable release tag

Note: this is also how kubectl kustomize is implementing the refoption:

ref - a git fetch-able ref, typically a branch, tag, or full commit hash (short hashes are not supported)

https://github.com/kubernetes-sigs/kustomize/blob/master/examples/remoteBuild.md#remote-directories

@srikrsna-buf
Copy link
Member

I can reproduce this with:

buf build "https://github.com/bufbuild/buf.git#ref=v1.27.0,subdir=proto"

The same works when I use tag:

buf build "https://github.com/bufbuild/buf.git#tag=v1.27.0,subdir=proto"

Thank you for reporting, we'll look into this.

@srikrsna-buf srikrsna-buf added the Bug Something isn't working label Apr 30, 2024
@bufdev bufdev changed the title git inputs: ref option should allow branches and tags Git inputs cannot reference tags with the ref option May 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants