Skip to content

Commit b43ac6f

Browse files
authored
feat: add curl install path and release artifacts (#54)
* feat: add curl installer and release assets Provide a curlable install path and wire release outputs so installable artifacts are consistently published on GitHub releases. * fix: address codex review findings Avoid unnecessary sudo for user-owned install dirs, fail helper downloads on non-404 errors, and strengthen gateway allowlist fallback assertions so upstream failures cannot pass silently.
1 parent 546b678 commit b43ac6f

File tree

6 files changed

+383
-10
lines changed

6 files changed

+383
-10
lines changed

.github/workflows/release.yml

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,41 @@ permissions:
1111
jobs:
1212
build-darwin-vz:
1313
runs-on: macos-latest
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
include:
18+
- arch: arm64
19+
target: arm64-apple-macosx13.0
20+
- arch: x86_64
21+
target: x86_64-apple-macosx13.0
1422
steps:
1523
- uses: actions/checkout@v4
1624

1725
- name: Build cleanroom-darwin-vz
1826
run: |
1927
mkdir -p dist
20-
xcrun swiftc -O -target arm64-apple-macosx13.0 -framework Virtualization \
28+
xcrun swiftc -O -target "${{ matrix.target }}" -framework Virtualization \
2129
cmd/cleanroom-darwin-vz/main.swift \
2230
-o dist/cleanroom-darwin-vz
2331
2432
- name: Create archive
2533
run: |
34+
ARCHIVE="cleanroom-darwin-vz_Darwin_${{ matrix.arch }}.tar.gz"
2635
cp cmd/cleanroom-darwin-vz/entitlements.plist dist/
27-
tar -czf "dist/cleanroom-darwin-vz_Darwin_arm64.tar.gz" \
36+
tar -czf "dist/${ARCHIVE}" \
2837
-C dist cleanroom-darwin-vz entitlements.plist
38+
(
39+
cd dist
40+
shasum -a 256 "${ARCHIVE}" > "${ARCHIVE}.sha256"
41+
)
2942
3043
- uses: actions/upload-artifact@v4
3144
with:
32-
name: cleanroom-darwin-vz
33-
path: dist/cleanroom-darwin-vz_Darwin_arm64.tar.gz
45+
name: cleanroom-darwin-vz-${{ matrix.arch }}
46+
path: |
47+
dist/cleanroom-darwin-vz_Darwin_${{ matrix.arch }}.tar.gz
48+
dist/cleanroom-darwin-vz_Darwin_${{ matrix.arch }}.tar.gz.sha256
3449
3550
release:
3651
runs-on: ubuntu-latest
@@ -53,12 +68,14 @@ jobs:
5368

5469
- uses: actions/download-artifact@v4
5570
with:
56-
name: cleanroom-darwin-vz
71+
pattern: cleanroom-darwin-vz-*
72+
merge-multiple: true
5773
path: dist
5874

5975
- name: Upload darwin-vz helper to release
6076
env:
6177
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6278
run: |
6379
gh release upload "${{ github.ref_name }}" \
64-
dist/cleanroom-darwin-vz_Darwin_arm64.tar.gz
80+
dist/cleanroom-darwin-vz_Darwin_*.tar.gz \
81+
dist/cleanroom-darwin-vz_Darwin_*.tar.gz.sha256

.goreleaser.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,20 @@ builds:
2222
- -s -w
2323

2424
archives:
25-
- formats: [tar.gz]
25+
- id: cleanroom
26+
ids: [cleanroom]
27+
formats: [tar.gz]
28+
name_template: >-
29+
{{ .Binary }}_
30+
{{- title .Os }}_
31+
{{- if eq .Arch "amd64" }}x86_64
32+
{{- else }}{{ .Arch }}{{ end }}
33+
34+
- id: cleanroom-guest-agent
35+
ids: [cleanroom-guest-agent]
36+
formats: [tar.gz]
2637
name_template: >-
27-
{{ .ProjectName }}_
38+
{{ .Binary }}_
2839
{{- title .Os }}_
2940
{{- if eq .Arch "amd64" }}x86_64
3041
{{- else }}{{ .Arch }}{{ end }}

.mise.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ run = "go test ./..."
1313

1414
[tasks.lint-shell]
1515
description = "Lint shell scripts"
16-
run = "shellcheck -x scripts/cleanroom-root-helper.sh scripts/benchmark-tti.sh scripts/build-go.sh scripts/install-go.sh scripts/release.sh"
16+
run = "shellcheck -x scripts/cleanroom-root-helper.sh scripts/benchmark-tti.sh scripts/build-go.sh scripts/install-go.sh scripts/install.sh scripts/release.sh"
1717

1818
[tasks.test-full]
1919
description = "Run full Go test suite"

README.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,23 @@ func example() error {
7171
- status enums (`client.SandboxStatus_*`, `client.ExecutionStatus_*`)
7272
- ergonomic wrappers (`client.NewFromEnv`, `client.EnsureSandbox`, `client.ExecAndWait`)
7373

74+
## Install
75+
76+
Install the latest release:
77+
78+
```bash
79+
curl -fsSL https://raw.githubusercontent.com/buildkite/cleanroom/main/scripts/install.sh | bash
80+
```
81+
82+
Install a specific version:
83+
84+
```bash
85+
curl -fsSL https://raw.githubusercontent.com/buildkite/cleanroom/main/scripts/install.sh | \
86+
bash -s -- --version v0.1.0
87+
```
88+
89+
By default this installs to `/usr/local/bin`. Override with `--install-dir` or `CLEANROOM_INSTALL_DIR`.
90+
7491
## Quick Start
7592

7693
Initialize runtime config and check host prerequisites:
@@ -148,7 +165,7 @@ macOS note:
148165

149166
- `darwin-vz` is the default backend on macOS
150167
- install host tools for rootfs derivation with `brew install e2fsprogs`
151-
- `cleanroom-darwin-vz` helper must be installed and signed with `com.apple.security.virtualization` entitlement (`mise run install` handles this in this repo)
168+
- `cleanroom-darwin-vz` helper must be installed and signed with `com.apple.security.virtualization` entitlement (the release install script handles this automatically; `mise run install` also handles it in this repo)
152169

153170
## CLI
154171

scripts/ci-cleanroom-e2e.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,11 +237,21 @@ set +e
237237
echo "$allow_resp" >&2
238238
exit 5
239239
fi
240+
if echo "$allow_resp" | grep -q "upstream_error"; then
241+
echo "allowlisted host probe hit upstream_error" >&2
242+
echo "$allow_resp" >&2
243+
exit 5
244+
fi
240245
if echo "$allow_resp" | grep -q "host_not_allowed"; then
241246
echo "allowlisted host was denied by gateway" >&2
242247
echo "$allow_resp" >&2
243248
exit 5
244249
fi
250+
if ! echo "$allow_resp" | grep -q "git-upload-pack"; then
251+
echo "allowlisted host probe did not return git upload-pack response" >&2
252+
echo "$allow_resp" >&2
253+
exit 5
254+
fi
245255
246256
set +e
247257
deny_resp="$(wget -q -S -O - "$deny_url" 2>&1)"

0 commit comments

Comments
 (0)