ncipollo / release-action

An action which manages a github release

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Use the user defined shell?

ilg-ul opened this issue · comments

Describe the bug

I'm getting:

OCI runtime exec failed: exec failed: unable to start container process: exec /__e/node16/bin/node: no such file or directory: 

To Reproduce

The configuration is a bit more complex, and I'm not sure you can reproduce it.

I'm running a job in 32-bit Arm Docker container, but in a 64-bit runner in an Oracle ampere (AArch64) virtual machine.

To properly start the 32-bit versions of the binaries, it is necessary to configure a custom shell, which must prefix all commands with linux32, otherwise the environment assumes the host architecture and invokes the 64-bit programs, which are not present in the 32-bit Docker.

Expected behavior

The publish step to succeed.

Additional context

The GitHub Action job is the following:

jobs:

  linux-arm:
    name: 'Linux Arm 32 - ninja-build ${{ github.event.inputs.version }} build'
    timeout-minutes: 2880 # 2 days
    runs-on: [self-hosted, linux, ampere]
    container:
      image: ilegeul/ubuntu:arm32v7-18.04-xbb-v5.1.0
    defaults:
      run:
        shell: linux32 bash --noprofile --norc -eo pipefail {0}

    steps:
      - name: 'Environment'
        run: |
          uname -a
          lsb_release -sd
          echo "whoami: $(whoami)"
          echo "pwd: $(pwd)"
          echo "node: $(node --version)"
          echo "npm: $(npm --version)"
          ls -lLA
          env | sort | egrep '^[^ \t]+='

      - name: 'Clean working area'
        run: |
          rm -rf * .git*
          rm -rf ~/.local/xPacks

      - name: 'Checkout project'
        uses: actions/checkout@v1 # v1 for old Git
        with:
          fetch-depth: 3

      - name: 'Install xpm'
        timeout-minutes: 1440
        run: |
          npm install --location=global xpm@${{ github.event.inputs.xpm_version }}
          xpm --version

      - name: 'Install project dependencies'
        timeout-minutes: 1440
        run: xpm install --loglevel ${{ github.event.inputs.xpm_install_loglevel }} ${{ github.event.inputs.xpm_install_options }}

      - name: 'Build Linux arm32 binary'
        timeout-minutes: 1440
        run: |
          xpm install --config linux-arm --loglevel ${{ github.event.inputs.xpm_install_loglevel }} ${{ github.event.inputs.xpm_install_options }}
          xpm run build --config linux-arm

      - name: 'Publish pre-release'
        # https://github.com/ncipollo/release-action
        uses: ncipollo/release-action@v1
        with:
          allowUpdates: true
          artifacts: 'build/linux-arm/deploy/*'
          bodyFile: '.github/workflows/body-github-pre-releases-test.md'
          commit: 'master'
          draft: false
          name: 'Test binaries'
          omitBodyDuringUpdate: true
          omitDraftDuringUpdate: true
          omitNameDuringUpdate: true
          owner: 'xpack-dev-tools'
          prerelease: true
          replacesArtifacts: true
          repo: 'pre-releases'
          tag: 'test'
          token: ${{ secrets.PUBLISH_TOKEN }}

      - name: 'Rename working area'
        # For just in case absolute paths remain unprocessed.
        run: mv -v build build-$(date -u +%Y%m%d-%H%M%S)

The build runs fine, the 32-bit binaries are created, but the publish step fails with:

##[debug]Evaluating condition for step: 'Publish pre-release'
##[debug]Evaluating: success()
##[debug]Evaluating success:
##[debug]=> true
##[debug]Result: true
##[debug]Starting: Publish pre-release
##[debug]Loading inputs
##[debug]Evaluating: secrets.PUBLISH_TOKEN
##[debug]Evaluating Index:
##[debug]..Evaluating secrets:
##[debug]..=> Object
##[debug]..Evaluating String:
##[debug]..=> 'PUBLISH_TOKEN'
##[debug]=> '***'
##[debug]Result: '***'
##[debug]Loading env
Run ncipollo/release-action@v1
  with:
    allowUpdates: true
    artifacts: build/linux-arm/deploy/*
    bodyFile: .github/workflows/body-github-pre-releases-test.md
    commit: master
    draft: false
    name: Test binaries
    omitBodyDuringUpdate: true
    omitDraftDuringUpdate: true
    omitNameDuringUpdate: true
    owner: xpack-dev-tools
    prerelease: true
    replacesArtifacts: true
    repo: pre-releases
    tag: test
    token: ***
    generateReleaseNotes: false
    makeLatest: legacy
    omitBody: false
    omitName: false
    omitPrereleaseDuringUpdate: false
    removeArtifacts: false
    skipIfReleaseExists: false
    updateOnlyUnreleased: false
/usr/bin/docker exec  ef00e11f141800d4c13a58cb086c5dda85fcb7d768e24ee76a4d0d73e1c0550c sh -c "cat /etc/*release | grep ^ID"
##[debug]ID=ubuntu
##[debug]ID_LIKE=debian
##[debug]Running JavaScript Action with default external tool: node16
OCI runtime exec failed: exec failed: unable to start container process: exec /__e/node16/bin/node: no such file or directory: unknown
##[debug]Node Action run completed with exit code 126
##[debug]Finishing: Publish pre-release

I'm not sure that the issue is within this project, but given the docker exec line which invokes sh instead of the user defined shell, I suspect that something similar happens when trying to invoke node, which must be invoked via linux32, as defined in the configuration file.

Is there anything you can do to fix this issue?

This is not something this action would have any control over. This is purely a JavaScript action and executes within the workflow runner environment git sets up. It doesn't have its own docker image or anything like that.

Hmm not sure how you would run actions if you need to prefix commands. I'd maybe poke around in the GitHub docs and see if you can customize the workflow runner (specifically how it invokes JavaScript actions)

you maybe need to install node in the environment you have setup?

The 32-bit node is definitely available, since the build step makes heavy use of it.

But if you do not prefix invocations, the default will be to invoke the 64-bit node from the host, not the 32-bit one from the Docker image.

not sure how you would run actions if you need to prefix commands

From the following syntax:

/usr/bin/docker exec  ef00e11f141800d4c13a58cb086c5dda85fcb7d768e24ee76a4d0d73e1c0550c sh -c "cat /etc/*release | grep ^ID"

I understand that you run the cat /etc/*release | grep ^ID command with the default shell, which is sh.

What system call do you use to invoke these commands? If I remember right, there are some spawn() functions which allow to also pass a shell. In this case you need to pass the one defined for the job:

    container:
      image: ilegeul/ubuntu:arm32v7-18.04-xbb-v5.1.0
    defaults:
      run:
        shell: linux32 bash --noprofile --norc -eo pipefail {0}

The action does not control any of that. There is nothing we would change in the action to change how the workflow runner is executing node in this case.

In other words, I am not invoking any of those commands. The GitHub runner executes the action, then we just hit API endpoints, etc.

I opened a ticket in the GitHub tracker: