Skip to content

Git inputs cannot reference tags with the ref option #2932

Closed
@mloesch

Description

@mloesch

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

Metadata

Metadata

Assignees

Labels

BugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions