C
Coder.com2mo ago
relja

Pushing template from CI/CD

Hi guys, I'm having trouble pushing new template from Gitlab pipeline. This is the relevant stage:
publish_template:
stage: publish
image: <ubuntu-with-tools-image>
script:
- curl -fsSL https://<my-coder-instance-url>/install.sh | sh
- # set CODER_SESSION_TOKEN env variable #
- coder login https://<my-coder-instance-url>
- coder templates list
- coder templates push 'why' -d . --activate=false --name 'wont' --message 'work' --yes
# - sleep infinity
publish_template:
stage: publish
image: <ubuntu-with-tools-image>
script:
- curl -fsSL https://<my-coder-instance-url>/install.sh | sh
- # set CODER_SESSION_TOKEN env variable #
- coder login https://<my-coder-instance-url>
- coder templates list
- coder templates push 'why' -d . --activate=false --name 'wont' --message 'work' --yes
# - sleep infinity
Which errors out 'cause it can't find configuration files, but the files are definitely there. I'm working in the current directory, and I can cat .tf file just fine. Note that I'm logged in, and can list templates. To make the problem stranger, this pipeline works if I run it with sleep inifinity, connect to instance running the job, and manually execute push command. It also works when run locally with gitlab-ci-local. Coder server & cli version: v2.22.1+8708d81
No description
4 Replies
Ethan
Ethan2mo ago
what's the output of ls, right before it fails?
relja
reljaOP2mo ago
total 176
drwxrwxrwx. 5 1001 1001 16384 Sep 2 07:10 .
drwxrwxrwx. 4 1001 1001 44 Sep 2 07:10 ..
drwxrwxrwx. 6 1001 1001 128 Sep 2 07:10 .git
drwxrwxrwx. 2 1001 1001 24 Sep 2 07:10 .gitlab-ci-local
-rw-rw-rw-. 1 1001 1001 2252 Sep 2 07:10 .gitlab-ci.yml
drwxrwxrwx. 3 1001 1001 23 Sep 2 07:10 .terraform
-rw-rw-rw-. 1 1001 1001 2486 Sep 2 07:10 .terraform.lock.hcl
-rw-rw-rw-. 1 1001 1001 943 Sep 2 07:10 README.md
-rw-rw-rw-. 1 1001 1001 14650 Sep 2 07:10 main.tf
-rw-rw-rw-. 1 1001 1001 3184 Sep 2 07:10 <some-script>.sh
total 176
drwxrwxrwx. 5 1001 1001 16384 Sep 2 07:10 .
drwxrwxrwx. 4 1001 1001 44 Sep 2 07:10 ..
drwxrwxrwx. 6 1001 1001 128 Sep 2 07:10 .git
drwxrwxrwx. 2 1001 1001 24 Sep 2 07:10 .gitlab-ci-local
-rw-rw-rw-. 1 1001 1001 2252 Sep 2 07:10 .gitlab-ci.yml
drwxrwxrwx. 3 1001 1001 23 Sep 2 07:10 .terraform
-rw-rw-rw-. 1 1001 1001 2486 Sep 2 07:10 .terraform.lock.hcl
-rw-rw-rw-. 1 1001 1001 943 Sep 2 07:10 README.md
-rw-rw-rw-. 1 1001 1001 14650 Sep 2 07:10 main.tf
-rw-rw-rw-. 1 1001 1001 3184 Sep 2 07:10 <some-script>.sh
I got it working by setting -d $(pwd) option. This seems like a bug to me.
Ethan
Ethan2mo ago
ah, i know what's happening here. will fix first thing tomorrow
matifali
matifali2mo ago
I remember seeing it too long ago but it was transitory

Did you find this page helpful?