how do you get a Stack to use a non-main branch? ...
# pulumi-kubernetes-operator
c
how do you get a Stack to use a non-main branch? i get this error using any non-main branch name or ref path
Copy code
error":"failed to create local workspace: failed to create workspace, unable to enlist in git repo: unable to checkout branch: reference not found"
here’s the config:
Copy code
spec:
  projectRepo: <https://gitlab.com/mycompany/sre/pko-poc.git>
  stack: mycompany/infra-apps/poc
  branch: "refs/heads/main"  #this works for some reason but /refs/heads/poc results in reference not found
  #branch: "poc"             #this also results in reference not found
  repoDir: infra-apps
    envRefs:
    PULUMI_ACCESS_TOKEN:
      type: Secret
      secret:
        name: pulumi-api-secret
        key: accessToken
  gitAuth:
    accessToken:
      type: Secret
      secret:
        name: git-secret
        key: privateToken
this is a private gitlab repo but i have confirmed auth is successful and if i point it at
/refs/heads/main
then it does update the pulumi project thanks
s
Can you run a
git show-ref poc
? Make sure
refs/heads/poc
shows up and that is what you want to refer to in the branch (no leading
/
)
c
Copy code
git show-ref poc
45a9403d4cd84411f6b14db1718c7638b9896e0a refs/heads/poc
45a9403d4cd84411f6b14db1718c7638b9896e0a refs/remotes/origin/poc
btw, i believe i deployed v1.3.0
yup
branch: “refs/heads/main” #this works for some reason but /refs/heads/poc results in reference not found
yeah that’s a typo in my comment…. i tested without the leading /
and here’s the gitlab branches view
s
ah - I think you want to use
refs/remotes/origin/poc
as the reference. The way go automation api for pulumi checks out the repo, only the default branch is available locally and other refs are not pulled down. It should work with the above variant.
Apologies for the delay in responding here.
c
thanks. will try that tomorrow.
sorry….finally got back to try this and i believe it worked. i think i encountered an error with the actual main.py now. thanks
👍 1