pulumi-kubernetes-operator icon indicating copy to clipboard operation
pulumi-kubernetes-operator copied to clipboard

Git branches or tags not working

Open rodcloutier opened this issue 4 years ago • 6 comments

Problem description

Although provided, no support for reference to git branches or tags work. Does not work if you use the branch field `commit

https://github.com/pulumi/pulumi-kubernetes-operator/blob/9bd6bd3accba4515ee83a81be5e6a176b066feb6/pkg/apis/pulumi/v1alpha1/stack_types.go#L59-L61

or the commit field, although using master here works. https://github.com/pulumi/pulumi-kubernetes-operator/blob/9bd6bd3accba4515ee83a81be5e6a176b066feb6/pkg/apis/pulumi/v1alpha1/stack_types.go#L56-L58

rodcloutier avatar Nov 13 '20 13:11 rodcloutier

@rodcloutier Could you report what you used for the "branch" field? Did you get a reference not found error? If so, you are probably not providing the branch in a reference format e.g. refs/heads/<branch name>.

viveklak avatar Dec 04 '20 20:12 viveklak

@viveklak ran into the same trap and the reference format was unexpected. Thanks for the hint - without this hint I would have no idea that this is the required syntax. Shouldn't that be documented?

Otherwise should branch rather be renamed to ref then!?

universam1 avatar May 07 '21 08:05 universam1

Implementation note: this is due to the underlying Automation API git support. We should revise this so that it also works with the plain branch or tag name.

Opened https://github.com/pulumi/pulumi/issues/7641 to track this.

lblackstone avatar Jul 26 '21 18:07 lblackstone

I'd like to report that I also just ran into this issue. In fact the current documentation specifies that either the short name or the fully-qualified name is supported:

https://github.com/pulumi/pulumi-kubernetes-operator/blob/master/docs/stacks.md#stackspec

(optional) Branch is the branch name to deploy, either the simple or fully qualified ref name, e.g. refs/heads/master.

ghostsquad avatar Jan 06 '22 01:01 ghostsquad

I found worse thing (from my point of view related to this issue): if you branch: refs/heads/something-like-that and it is not refs/heads/master - the operator fails with the following error:

error":"failed to create local workspace: failed to create workspace, unable to enlist in git repo: unable to checkout branch: reference not found

(locally I can checkout to git checkout refs/heads/something-like-that to relevant commit)

zelig81 avatar Apr 24 '22 11:04 zelig81

@zelig81 yes - that is an unfortunate side-effect of the shallow clone the pulumi automation api performs. Essentially the default branch is available with the refs/heads/<branch> format but other branches/tags etc. require an explicit pull from the remote. Can you try this format instead - refs/remotes/origin/<branch/tag> for the non-default branch etc. Happy to take a PR to fix this in the documentation https://github.com/pulumi/pulumi-kubernetes-operator/blob/master/deploy/crds/pulumi.com_stacks.yaml#L559!

viveklak avatar Apr 24 '22 18:04 viveklak