Skip to content

🐞 shell error when using multi-line yaml #117

@lukemarsden

Description

@lukemarsden

What is the issue?

Given the following config:
https://github.com/lukemarsden/test-dagger-actions/blob/c0e90ddf436947e4c6639fd95e2c491095f87ff5/.github/workflows/docker-publish.yml

In particular,

      - name: Dagger Build & Push
        uses: dagger/dagger-for-github@v5
        with:
          version: "0.11.0"
          verb: call
          args: |
            build-and-push \
            --registry=$DOCKER_REGISTRY \
            --image-name=$DOCKER_IMAGE_NAME \
            --username=$DOCKER_USERNAME \
            --password=env:DOCKER_PASSWORD
        env:
          DOCKER_REGISTRY: ${{ env.REGISTRY }}
          DOCKER_IMAGE_NAME: ${{ env.IMAGE_NAME }}
          DOCKER_USERNAME: ${{ github.actor }}
          DOCKER_PASSWORD: ${{ secrets.GITHUB_TOKEN }}

When using the multi-line string args: |, I suppose the string ends up including the trailing newline at the end, which results in the following error: https://github.com/lukemarsden/test-dagger-actions/actions/runs/8630455004/job/23656748756

In particular:

Run cd . && { \
  cd . && { \
  DAGGER_CLOUD_TOKEN= \
  dagger \
  --progress plain \
  call \
  ${INPUT_MODULE:+-m $INPUT_MODULE} \
  build-and-push \
  --registry=$DOCKER_REGISTRY \
  --image-name=$DOCKER_IMAGE_NAME \
  --username=$DOCKER_USERNAME \
  --***
  ; }
  shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
  env:
    REGISTRY: ghcr.io
    IMAGE_NAME: lukemarsden/test-dagger-actions
    DOCKER_REGISTRY: ghcr.io
    DOCKER_IMAGE_NAME: lukemarsden/test-dagger-actions
    DOCKER_USERNAME: lukemarsden
    DOCKER_PASSWORD: ***
    INPUT_MODULE: 
/home/runner/work/_temp/18dc8cb9-bd6c-4e31-adb8-b2[96](https://github.com/lukemarsden/test-dagger-actions/actions/runs/8630455004/job/23656748756#step:3:98)01d09f1c.sh: line 12: syntax error near unexpected token `;'
Error: Process completed with exit code 2.

Switching to single line style, like:

          args: build-and-push --registry=$DOCKER_REGISTRY --image-name=$DOCKER_IMAGE_NAME --username=$DOCKER_USERNAME --password=env:DOCKER_PASSWORD --build-context .

fixes the issue, but of course is less readable

Dagger version

dagger v0.11.0 (registry.dagger.io/engine) darwin/arm64

Steps to reproduce

Run the above config

Log output

See above

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions