runner icon indicating copy to clipboard operation
runner copied to clipboard

Support using a login shell along with the container step syntax

Open umarcor opened this issue 4 years ago • 6 comments

Describe the enhancement

Support using a login shell along with the container step syntax.

Code Snippet

  # Produces an error
  Action_String:
    needs: Image
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2

    - uses: docker://ghcr.io/image
      with:
        args: bash -lec 'if [ "$DEMO_VAR" != "somevalue" ]; then echo "Error!"; exit 1; fi && echo "Bye!"'

  # Commands seem to be ignored, no output is produced
  Action_File:
    needs: Image
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2

    - run: |
        cat > symbiflow-examples-tests.sh <<'EOF'
        if [ "$DEMO_VAR" != "somevalue" ]; then echo "Error!"; exit 1; fi
        echo "Bye!"
        EOF

    - uses: docker://ghcr.io/image
      with:
        args: bash -le ./symbiflow-examples-tests.sh

  # Commands seem to be ignored, no output is produced
  Action_Shebang:
    needs: Image
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2

    - run: |
        cat > symbiflow-examples-tests.sh <<'EOF'
        #!/usr/bin/env -S bash -le
        if [ "$DEMO_VAR" != "somevalue" ]; then echo "Error!"; exit 1; fi
        echo "Bye!"
        EOF
        chmod +x symbiflow-examples-tests.sh

    - uses: docker://ghcr.io/image
      with:
        args: ./symbiflow-examples-tests.sh

Additional information

Equivalent use cases are successful if docker is executed directly in a run step, instead of using the uses: docker:// syntax. See:

  • https://github.com/hdl/containers/blob/GHA-MWEs/.github/workflows/MWE-1560-SymbiFlow.yml
  • https://github.com/hdl/containers/actions/workflows/MWE-1560-SymbiFlow.yml
  • https://github.com/hdl/containers/blob/GHA-MWEs/.github/workflows/MWE-1560.yml
  • https://github.com/hdl/containers/actions/workflows/MWE-1560.yml

Ref: #1530

umarcor avatar Dec 16 '21 03:12 umarcor

@umarcor can you provide a small repro about the issue?

TingluoHuang avatar Dec 16 '21 03:12 TingluoHuang

@TingluoHuang just updated the comment above (I created the issue first in order to have a number).

Hmmm, interestingly, 2 of the 3 reduced examples are working. I simplified it too much... I will update.

umarcor avatar Dec 16 '21 03:12 umarcor

@TingluoHuang, see:

  • https://github.com/hdl/containers/blob/GHA-MWEs/.github/workflows/MWE-1560-F4PGA.yml
  • https://github.com/hdl/containers/actions/workflows/MWE-1560-F4PGA.yml

umarcor avatar Dec 16 '21 04:12 umarcor

This issue is stale because it has been open 365 days with no activity. Remove stale label or comment or this will be closed in 15 days.

github-actions[bot] avatar Mar 04 '24 00:03 github-actions[bot]

😕

umarcor avatar Mar 04 '24 11:03 umarcor

Have you ever found a workaround for this?

LecrisUT avatar Jun 24 '24 13:06 LecrisUT