dagger / dagger-for-github

GitHub Action for Dagger

Home Page:https://github.com/marketplace/actions/dagger-for-github

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

🐞 CI is failing when we use `--with` in args

yindia opened this issue Β· comments

What is the issue?

I have a small pipeline that build & push images in docker hub, I tested it locally and it worked fine but when i try to use it in CI it is failing

CI action will convert the command from
dagger do build -l debug --log-format plain --with 'actions: params: image: tag: "v0.2.0"' to /opt/hostedtoolcache/dagger/0.2.4/x64/dagger do build -l debug --log-format plain --with 'actions: params: image: tag: v0.2.0' --log-format plain

And that's wrong if you add double quotes to tag then it will work fine.

Log output

Screenshot 2022-04-04 at 6 37 12 PM

Steps to reproduce

Build Failure: https://github.com/evalsocket/dagger-flyte/runs/5816670062?check_suite_focus=true#step:4:1

Successful Build: https://github.com/evalsocket/dagger-flyte/runs/5816717792?check_suite_focus=true#step:4:1

Dagger version

v0.2.4

OS version

MacOs 12.2.1

I think this is happening because of gh core package has trim logic

function getInput(name, options) {

Thanks for your issue. I think you're right.

To unlock you right now, you can base yourself on the CI of the Go on Docker Swarm use case: https://docs.dagger.io/1211/go-docker-swarm/.

It is different because it just installs dagger instead of directly executing it. You won't have the escape happening:

name: Dagger/docs.particubes.com

on:
  push:
    branches: [master]

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v3

      - name: Install Dagger
        uses: dagger/dagger-action@v2
        with:
          install-only: true

      - name: Dagger project update
        run: dagger project update

      - name: Dagger do <youraction>
        run: dagger do test --log-format plain # Write same command as your local one

We worked around this today by using a one-liner to generate our --with CUE and using install-only because it seemed like the action was choking on the first comma in our CUE array in the --with.

Work around:

- name: Get Dirs
  run: |
    echo "SUBDIRS=$(ls -m mydir | tr -d "[:space:]" | sed 's/[^,]*/"&"/g;S/^/ [/:S/$/]/ ')" >> $GITHUB ENV

- name: Install Dagger
   uses: dagger/dagger-action@v3
   with:
     install-only: true
     
- name: Deploy to using subdir contents
  run: |
    dagger do -p my.cue deploy --log-format plain -with 'actions:deploy:dirs: ${{env.SUBDIRS}}'

Usage example of --with added to README.md