Skip to content

bug: Pushing and testing dynamically generated templates fail their first test. #17031

Closed
@michaelvp411

Description

@michaelvp411

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

The push template task from Line 158 used here. Does not seem to support any kind of test. Version name is in here.
https://github.com/coder/coder/blob/main/.github/workflows/dogfood.yaml

The examples here set it create it with the name and test it with the name
https://coder.com/docs/tutorials/testing-templates

The code of coder templates Push

coder/cli/templatepush.go

Lines 140 to 144 in ffd336b

if !createTemplate {
args.Name = versionName
args.Template = &template
args.ReuseParameters = !alwaysPrompt
}

Using the github actions to push a new template with an auto-generated version name. it pushes successfully but the version name is the default auto-generated human readable version instead of the version specified in the push.
If you try to test it when it's new it's using a human readable name and not an assigned name and the test will fail.
A subsequent re-run of the CICD job with no changes succeeds.

Relevant Log Output

- name: Push template to Coder
        run: |
          coder templates push $TEMPLATE_NAME --activate=false --name ${{ steps.name.outputs.version_name }} --message "${{ steps.message.outputs.pr_title }}" --yes

      - name: Create a test workspace and run some example commands
        run: |
          coder create -t $TEMPLATE_NAME --template-version ${{ steps.name.outputs.version_name }} test-${{ steps.name.outputs.version_name }} --yes
          coder config-ssh --yes
          # run some example commands
          coder ssh test-${{ steps.name.outputs.version_name }} -- make build

Expected Behavior

if specifying a version name builds and test steps should pass with the variable set.

Steps to Reproduce

  1. create a variable for template version and Set version name of a newly created template such as coder templates push $TEMPLATE_NAME —activate=false --name ${{ steps.name.outputs.version_name }}
  2. run tests or builds against that version name.
  3. Confirm that initial tests use a default human generated name.

Environment

  • Host OS:
  • Coder version:

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    cliArea: CLI

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions