Skip to content

bug: remove the need for expects' unbuffer command while using coder cli to push a template #17033

@alfred-stokespace

Description

@alfred-stokespace

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

cli version Coder v2.20.0+03b5012 Tue Mar 4 19:21:19 UTC 2025
(I tried a new cli as well, same issue)

I'm working in a GitHub Actions Workflow environment.
I have an on-prem Coder Server install (Coder v2.20.0+03b5012 Tue Mar 4 19:21:19 UTC 2025)

I'm using coder cli and an access token provided vie GH secrets

I have a directory with a pre-existing and previously pushed template (shown from within GH Action WF)

ls -altr

total 32
drwxr-xr-x 3 alfreds alfreds 4096 Mar 20 09:47 ..
-rw-r--r-- 1 alfreds alfreds 1479 Mar 20 11:46 README.md
-rw-r--r-- 1 alfreds alfreds 7185 Mar 20 13:59 main.tf
drwx------ 2 alfreds alfreds 4096 Mar 20 16:38 .

when I issue coder template push docker --ignore-lockfile -y
I get this error...

2025-03-20 23:55:55.856Z Terraform 1.10.5
2025-03-20 23:55:55.857Z Error: No configuration files
2025-03-20 23:55:55.857Z Plan requires configuration to be present. Planning without a configuration would mark everything for destruction, which is normally not what is desired. If you would like to destroy everything, run plan with the -destroy option. Otherwise, create a Terraform configuration file (.tf file) and try again.
=== ✔ Detecting persistent resources [161ms]
==> ⧗ Cleaning Up
Encountered an error running "coder templates push", see "coder templates push --help" for more information

I double-triple confirmed that the directory this was running in had the main.tf file.

I got suspicious, so I ssh'd into the runner and manually replicated the command, (over ssh) and it succceeded!

So, I got took that knowledge and made a wild guess that there is a requirement that tty-like relationship is expected to the cli.

I changed the gh wf to install expect

      - name: Hack for Coder bug
        run: |
          sudo apt-get install expect -y
          echo "now unbuffer is available which can trick coder into thinking your are there watching."

and that allows me to add unbuffer before the whole command.

      - name: Push with Coder
        run: |          
          coder whoami
          cd coder/coder-templates/ubuntu/docker          
          unbuffer coder template push docker --ignore-lockfile -y

And that works.

[REDACTED]... You're authenticated as gh-runner !
25l

◰ Uploading directory...25h
=== ✔ Queued [0ms]
==> ⧗ Running
==> ⧗ Running
=== ✔ Running [9ms]
==> ⧗ Setting up
=== ✔ Setting up [0ms]
==> ⧗ Parsing template parameters
=== ✔ Parsing template parameters [14ms]
==> ⧗ Detecting persistent resources
2025-03-20 23:36:18.472Z Terraform 1.10.5
2025-03-20 23:36:19.347Z data.coder_workspace_owner.me: Refreshing...
2025-03-20 23:36:19.347Z data.coder_provisioner.me: Refreshing...
2025-03-20 23:36:19.347Z data.coder_workspace.me: Refreshing...
...
=== ✔ Detecting ephemeral resources [2749ms]
==> ⧗ Cleaning Up
=== ✔ Cleaning Up [353ms]
┌──────────────────────────────────┐
│ Template Preview                 │
├──────────────────────────────────┤
│ RESOURCE                         │
├──────────────────────────────────┤
│ docker_container.workspace       │
│ └─ main (linux, amd64)           │
├──────────────────────────────────┤
│ docker_image.stoke-ubuntu        │
├──────────────────────────────────┤
│ docker_volume.home_volume        │
└──────────────────────────────────┘
Updated version at Mar 20 23:36:23!

Relevant Log Output

Expected Behavior

I should not have to use unbuffer or any other tty-like command in a headless environment to engage with templates push

Steps to Reproduce

  1. See my description, pretty clear what the steps are.

Environment

  • Host OS: version in description
  • Coder version: version in description

Additional Context

No response

Metadata

Metadata

Assignees

Labels

s2Broken use cases or features (with a workaround). Only humans may set this.

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    pFad - Phonifier reborn

    Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

    Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


    Alternative Proxies:

    Alternative Proxy

    pFad Proxy

    pFad v3 Proxy

    pFad v4 Proxy