setup-bun
setup-bun copied to clipboard
Cannot install bun in a containerized runner job. Install script from bun.sh works.
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.
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
Can confirm we've hit the same issue.
Was having an issue installing via the playwright container as well but it was just missing the unzip executable. Added this and it works fine after that.
- name: Install system dependencies
run: |
apt-get update
apt-get install -y unzip
Full workflow for reference:
name: Playwright
on: deployment_status
jobs:
playwright:
timeout-minutes: 10
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/playwright:v1.52.0
if: github.event.deployment_status.state == 'success'
env:
ENVIRONMENT_URL: ${{ github.event.deployment_status.target_url }}
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
steps:
- uses: actions/checkout@v4
- name: Install system dependencies
run: |
apt-get update
apt-get install -y unzip
- uses: oven-sh/setup-bun@v2
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Run tests
run: bun run test:integration
env:
HOME: /root