pulumi-kubernetes-operator
pulumi-kubernetes-operator copied to clipboard
Git branches or tags not working
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 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 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!?
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.
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.
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 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!