oven-sh / setup-bun

Set up your GitHub Actions workflow with a specific version of Bun
MIT License
457 stars 37 forks source link

Cannot install bun in a containerized runner job. Install script from bun.sh works. #55

Open mlitvinav opened 10 months ago

mlitvinav commented 10 months ago

Today i discovered an issue with the setup-bun action. We use setup-bun to install the dependencies and then execute the app with node. I also can see that setup-bun not containerized, which runs in the runner directly, does not have any issues.

How to reproduce

e2e:
    permissions:
      actions: read
      contents: read
      id-token: write
      pull-requests: write
      repository-projects: read
    services:
      mock_server:
        image: mockserver/mockserver
        env:
          IS_E2E: true
          MOCKSERVER_LOG_LEVEL: WARN
    container:
      image: mcr.microsoft.com/playwright:v1.40.0-jammy
    steps:
      - name: Fix possible git-lfs issues
        run: rm -rf .git/hooks/post-checkout
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          node-version: 20
      - uses: oven-sh/setup-bun@v1
        with:
          bun-version: latest

Logs

Run: actions/checkout@v3
/usr/bin/docker exec  b9f03e81ffcc8799fd9d96166dcc7960541b4625d2c2ea2caa4d88730c35ea0f sh -c "cat /etc/*release | grep ^ID"
Found in cache @ /__t/node/20.9.0/x64

Run: oven-sh/setup-bun@v1
/usr/bin/docker exec  b9f03e81ffcc8799fd9d96166dcc7960541b4625d2c2ea2caa4d88730c35ea0f sh -c "cat /etc/*release | grep ^ID"
OCI runtime exec failed: exec failed: container_linux.go:367: starting container process caused: exec: "/__e/node20/bin/node": stat /__e/node20/bin/node: no such file or directory: unknown

I believe the action looks for node in the wrong space when containerized.

How to fix?

Swap out the install action to the install script. See the lastest docs to see how to pin specific versions, if desired:

      - name: Setup Bun
        run: |
          curl -fsSL https://bun.sh/install | bash

Feel free to close this ticket if you cannot reproduce it. I am unsure if this is a big issue or not. It would be nice to use the setup-bun action everywhere but i am fine with the install script workaround.

sharunkumar commented 2 months ago

Swap out the install action to the install script. See the lastest docs to see how to pin specific versions, if desired:

      - name: Setup Bun
        run: |
          curl -fsSL https://bun.sh/install | bash

this workaround doesn't seem to be setting up bun globally, so subsequent run commands that use bun would fail