From 4c24ee9f141ef57e618a7250be9e5b64ba49a172 Mon Sep 17 00:00:00 2001 From: Daniel Xu Date: Wed, 6 Sep 2023 09:40:37 -0600 Subject: [PATCH] ci: Replace embedded quay.io image with appimage This commit creates a new GHA job that builds and uploads the bpftrace appimage to the commit's build artifacts. This is intended to replace the previous quay.io images. Also update scripts/create-assets.md and release_process.md to use the appimage. Note we stop compressing the bpftrace binary alone -- the appimage is already zstd compressed. --- .github/workflows/binary.yml | 29 +++++++++++++++++++++++++++++ docs/release_process.md | 6 ------ scripts/create-assets.sh | 12 +++++------- 3 files changed, 34 insertions(+), 13 deletions(-) create mode 100644 .github/workflows/binary.yml diff --git a/.github/workflows/binary.yml b/.github/workflows/binary.yml new file mode 100644 index 000000000000..c424ddda6fcd --- /dev/null +++ b/.github/workflows/binary.yml @@ -0,0 +1,29 @@ +# This workflow builds and uploads the bpftrace appimage as a build artifact. +# +# This is useful for users who want to download the latest and greatest bpftrace +# binary without going through a local build. + +name: Binary + +on: + push: + branches: + - master + +jobs: + build-and-upload: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - uses: DeterminateSystems/nix-installer-action@v4 + - uses: DeterminateSystems/magic-nix-cache-action@v2 + + - name: Build appimage + run: nix build .#appimage + + - name: Upload appimage + uses: actions/upload-artifact@v3 + with: + name: bpftrace + path: ./result diff --git a/docs/release_process.md b/docs/release_process.md index e6e5c1f55229..1684282a64a1 100644 --- a/docs/release_process.md +++ b/docs/release_process.md @@ -42,11 +42,5 @@ You must do these things to formally release a version: as "commits"), then "Draft a new release". The tag version and release title should be the same and in `vX.Y.Z` format. The tag description should be the same as what you added to `CHANGELOG.md`. -1. Once the release tag pipeline has finished, extract the bpftrace binary from - the release build on and attach it to the release. - - `docker run -v -$(pwd):/output quay.io/iovisor/bpftrace:vXX.YY.ZZ /bin/bash -c "cp -/usr/bin/bpftrace /output"` 1. Run `scripts/create-assets.sh` from bpftrace root dir and attach the generated archives to the release. - diff --git a/scripts/create-assets.sh b/scripts/create-assets.sh index b3c604d7ff8a..f0ff9aef6b4f 100755 --- a/scripts/create-assets.sh +++ b/scripts/create-assets.sh @@ -12,7 +12,6 @@ function info() { [[ -d tools ]] || err "'tools' directory not found, run script from bpftrace root dir" [[ -d man ]] || err "'man' directory not found, run script from bpftrace root dir" -[[ -f bpftrace ]] || err "bpftrace binary not found, download the build artifact" command -v zstd >/dev/null 2>&1 || err "zstd command not found, required for release" command -v asciidoctor >/dev/null 2>&1 || err "asciidoctor not found, required for manpage" @@ -44,16 +43,15 @@ gzip "$TMP/share/man/man8/"* asciidoctor man/adoc/bpftrace.adoc -b manpage -o - | gzip - > "$TMP/share/man/man8/bpftrace.8.gz" tar --xz -cf "$OUT/man.tar.xz" -C "$TMP/share" man +info "Building bpftrace appimage" +nix build .#appimage + info "Creating bundle" -cp bpftrace "$TMP/bin/bpftrace" +cp ./result "$OUT/bpftrace" +cp ./result "$TMP/bin/bpftrace" tar -cf "$OUT/binary_tools_man-bundle.tar" -C "$TMP" bin share zstd $ZSTDFLAGS -q -k "$OUT/binary_tools_man-bundle.tar" xz "$OUT/binary_tools_man-bundle.tar" -info "Compressing binary" -cp bpftrace "$OUT/" -xz -k "$OUT/bpftrace" -zstd $ZSTDFLAGS -q -k "$OUT/bpftrace" - echo "All assets created in $OUT" [[ -d "$TMP" ]] && rm -rf "$TMP"