Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -247,11 +247,32 @@ jobs:
run: ./scripts/package-build.sh --packager "${{ matrix.packager }}" --architecture "${{ matrix.package_arch }}" --version "$(./scripts/workspace-version.sh)" --output-dir dist/packages
- name: Smoke test package install
run: ./scripts/package-smoke.sh --packager "${{ matrix.packager }}" --package-dir dist/packages
- name: Build standalone Linux archive
if: matrix.packager == 'deb'
run: |
./scripts/build-binary-archive.sh \
--version "$(./scripts/workspace-version.sh)" \
--architecture "${{ matrix.package_arch }}" \
--output-dir dist/binaries
- name: Smoke test standalone Linux archive
if: matrix.packager == 'deb'
run: |
./scripts/binary-archive-smoke.sh \
--archive "dist/binaries/gvm-gateway_$(./scripts/workspace-version.sh)_linux_${{ matrix.package_arch }}.tar.gz" \
--version "$(./scripts/workspace-version.sh)" \
--architecture "${{ matrix.package_arch }}"
- name: Upload package artifacts
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7
with:
name: gvm-gateway-${{ matrix.packager }}-${{ matrix.package_arch }}
path: dist/packages/*
- name: Upload standalone Linux archive
if: matrix.packager == 'deb'
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7
with:
name: gvm-gateway-linux-${{ matrix.package_arch }}
path: dist/binaries/*
if-no-files-found: error

container:
name: Container
Expand Down
71 changes: 69 additions & 2 deletions .github/workflows/release-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ jobs:
name: Package (${{ matrix.packager }}, ${{ matrix.package_arch }})
needs: [validate, test]
runs-on: ${{ matrix.runner }}
permissions:
contents: read
id-token: write
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -98,12 +101,53 @@ jobs:
run: ./scripts/package-build.sh --packager "${{ matrix.packager }}" --architecture "${{ matrix.package_arch }}" --version "${{ needs.validate.outputs.version }}" --output-dir dist/packages
- name: Smoke test package install
run: ./scripts/package-smoke.sh --packager "${{ matrix.packager }}" --package-dir dist/packages
- name: Build standalone Linux archive
if: matrix.packager == 'deb'
run: |
./scripts/build-binary-archive.sh \
--version "${{ needs.validate.outputs.version }}" \
--architecture "${{ matrix.package_arch }}" \
--output-dir dist/binaries
- name: Smoke test standalone Linux archive
if: matrix.packager == 'deb'
run: |
./scripts/binary-archive-smoke.sh \
--archive "dist/binaries/gvm-gateway_${{ needs.validate.outputs.version }}_linux_${{ matrix.package_arch }}.tar.gz" \
--version "${{ needs.validate.outputs.version }}" \
--architecture "${{ matrix.package_arch }}"
- name: Sign standalone Linux archive
if: matrix.packager == 'deb'
env:
VERSION: ${{ needs.validate.outputs.version }}
ARCHITECTURE: ${{ matrix.package_arch }}
run: |
archive="dist/binaries/gvm-gateway_${VERSION}_linux_${ARCHITECTURE}.tar.gz"
identity="https://github.com/${GITHUB_REPOSITORY}/.github/workflows/release-publish.yml@${GITHUB_REF}"
for artifact in "${archive}" "${archive}.sha256"; do
cosign sign-blob --yes \
--output-signature "${artifact}.sig" \
--output-certificate "${artifact}.pem" \
"${artifact}"
cosign verify-blob \
--certificate-identity "${identity}" \
--certificate-oidc-issuer "https://token.actions.githubusercontent.com" \
--certificate "${artifact}.pem" \
--signature "${artifact}.sig" \
"${artifact}"
done
- name: Store package assets
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7
with:
name: gvm-gateway-${{ matrix.packager }}-${{ matrix.package_arch }}-release-assets
path: dist/packages/*
if-no-files-found: error
- name: Store standalone Linux archive assets
if: matrix.packager == 'deb'
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7
with:
name: gvm-gateway-linux-${{ matrix.package_arch }}-release-assets
path: dist/binaries/*
if-no-files-found: error

oci:
name: OCI Image
Expand Down Expand Up @@ -173,12 +217,13 @@ jobs:
pattern: "*-release-assets"
path: dist/release-assets
merge-multiple: true
- name: Verify OS packages and OCI archive
- name: Verify release assets
run: |
shopt -s nullglob
deb_packages=(dist/release-assets/*.deb)
arch_packages=(dist/release-assets/*.pkg.tar.zst)
os_packages=("${deb_packages[@]}" "${arch_packages[@]}")
binary_archives=(dist/release-assets/gvm-gateway_*_linux_*.tar.gz)
oci_archives=(dist/release-assets/*.oci.tar)
docs_archives=(dist/release-assets/rust-gvm-api-docs-*.tar.gz)

Expand All @@ -192,6 +237,19 @@ jobs:
exit 1
fi

if (( ${#binary_archives[@]} != 2 )); then
echo "Expected two standalone Linux binary archives, found ${#binary_archives[@]}" >&2
exit 1
fi

for architecture in amd64 arm64; do
archive="dist/release-assets/gvm-gateway_${{ needs.validate.outputs.version }}_linux_${architecture}.tar.gz"
if [[ ! -f "${archive}" ]]; then
echo "Missing standalone Linux binary archive for ${architecture}" >&2
exit 1
fi
done

if (( ${#oci_archives[@]} == 0 )); then
echo "No OCI image archive was generated for the release" >&2
exit 1
Expand All @@ -202,12 +260,21 @@ jobs:
exit 1
fi

for asset in "${os_packages[@]}" "${oci_archives[@]}" "${docs_archives[@]}"; do
for asset in "${os_packages[@]}" "${binary_archives[@]}" "${oci_archives[@]}" "${docs_archives[@]}"; do
if [[ ! -f "${asset}.sha256" ]]; then
echo "Missing checksum for ${asset}" >&2
exit 1
fi
done

for archive in "${binary_archives[@]}"; do
for signed_asset in "${archive}" "${archive}.sha256"; do
if [[ ! -f "${signed_asset}.sig" || ! -f "${signed_asset}.pem" ]]; then
echo "Missing Sigstore sidecars for ${signed_asset}" >&2
exit 1
fi
done
done
- name: Ensure GitHub release exists
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
12 changes: 12 additions & 0 deletions RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ after a release.

`Publish Release` builds and uploads:

- standalone `gvm-gateway` Linux archives for amd64 and arm64 (`.tar.gz`)
- SHA-256 checksums and Sigstore signature/certificate sidecars for each
standalone archive and checksum
- `gvm-gateway` Debian packages (`.deb`)
- `gvm-gateway` Arch Linux packages (`.pkg.tar.zst`)
- `gvm-gateway` OCI image archives (`.oci.tar`)
Expand Down Expand Up @@ -72,6 +75,11 @@ For local testing without releasing:
```bash
cargo build --locked --release -p gvm-gateway
cargo test
./scripts/build-binary-archive.sh --version "$(./scripts/workspace-version.sh)" --architecture amd64
./scripts/binary-archive-smoke.sh \
--archive "dist/binaries/gvm-gateway_$(./scripts/workspace-version.sh)_linux_amd64.tar.gz" \
--version "$(./scripts/workspace-version.sh)" \
--architecture amd64
./scripts/package-build.sh --packager deb --version "$(./scripts/workspace-version.sh)"
./scripts/package-build.sh --packager archlinux --version "$(./scripts/workspace-version.sh)"
./scripts/oci-build.sh --tag local/gvm-gateway:dev
Expand All @@ -92,5 +100,9 @@ Compose stack validation and OCI archive export are also covered in CI/release a
## Packaging Notes

- The first pass packages the unified `gvm-gateway` binary.
- Standalone archives contain the native `gvm-gateway` executable, example
configuration, README, license, and `BUILDINFO` provenance. Their checksums
reference asset basenames so downstream builders can verify them from any
directory.
- Packages create `/etc/gvm-gateway` and ship an example config at `/etc/gvm-gateway/gvm-gateway.toml.example`; administrators may copy it to `/etc/gvm-gateway/gvm-gateway.toml`.
- OCI image builds ship a container-oriented config at `/etc/gvm-gateway/gvm-gateway.toml` with `0.0.0.0:8080` and a shared `/run/gvmd` socket contract.
99 changes: 99 additions & 0 deletions scripts/binary-archive-smoke.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
#!/usr/bin/env bash
set -euo pipefail

usage() {
cat <<'EOF'
Usage: binary-archive-smoke.sh --archive <path> --version <semver> --architecture <amd64|arm64>
EOF
}

ARCHIVE=""
VERSION=""
ARCHITECTURE=""

while [[ $# -gt 0 ]]; do
case "$1" in
--archive)
ARCHIVE="${2:-}"
shift 2
;;
--version)
VERSION="${2:-}"
shift 2
;;
--architecture)
ARCHITECTURE="${2:-}"
shift 2
;;
-h|--help)
usage
exit 0
;;
*)
echo "unknown argument: $1" >&2
usage >&2
exit 1
;;
esac
done

if [[ -z "${ARCHIVE}" || -z "${VERSION}" || -z "${ARCHITECTURE}" ]]; then
usage >&2
exit 1
fi

ARCHIVE="$(realpath "${ARCHIVE}")"
ARCHIVE_DIR="$(dirname "${ARCHIVE}")"
ARCHIVE_NAME="gvm-gateway_${VERSION}_linux_${ARCHITECTURE}.tar.gz"
ARCHIVE_ROOT_NAME="gvm-gateway-${VERSION}-linux-${ARCHITECTURE}"

if [[ "$(basename "${ARCHIVE}")" != "${ARCHIVE_NAME}" ]]; then
echo "unexpected archive name: $(basename "${ARCHIVE}")" >&2
exit 1
fi

if [[ ! -f "${ARCHIVE}.sha256" ]]; then
echo "archive checksum missing: ${ARCHIVE}.sha256" >&2
exit 1
fi

# This consumer-shaped check proves that the published checksum is portable:
# it must reference the asset basename rather than a runner-specific path.
CHECKSUM_TARGET="$(awk 'NR == 1 { print $2 }' "${ARCHIVE}.sha256")"
if [[ "${CHECKSUM_TARGET}" != "${ARCHIVE_NAME}" ]]; then
echo "checksum must reference archive basename, got: ${CHECKSUM_TARGET}" >&2
exit 1
fi
(
cd "${ARCHIVE_DIR}"
sha256sum --check --strict "${ARCHIVE_NAME}.sha256"
)

while IFS= read -r entry; do
case "${entry}" in
"${ARCHIVE_ROOT_NAME}"|"${ARCHIVE_ROOT_NAME}/"*)
;;
*)
echo "archive contains entry outside expected root: ${entry}" >&2
exit 1
;;
esac
done < <(tar -tzf "${ARCHIVE}")

TEMP_DIR="$(mktemp -d)"
trap 'rm -rf "${TEMP_DIR}"' EXIT
tar -xzf "${ARCHIVE}" -C "${TEMP_DIR}"
ARCHIVE_ROOT="${TEMP_DIR}/${ARCHIVE_ROOT_NAME}"

# These assertions define the standalone distribution contract used by GOS:
# executable, example configuration, operator docs, license, and provenance.
test -x "${ARCHIVE_ROOT}/gvm-gateway"
test -f "${ARCHIVE_ROOT}/gvm-gateway.toml.example"
test -f "${ARCHIVE_ROOT}/README.md"
test -f "${ARCHIVE_ROOT}/LICENSE"
test -f "${ARCHIVE_ROOT}/BUILDINFO"
grep -Fx "artifact_name=${ARCHIVE_NAME}" "${ARCHIVE_ROOT}/BUILDINFO" >/dev/null
grep -Fx "artifact_architecture=${ARCHITECTURE}" "${ARCHIVE_ROOT}/BUILDINFO" >/dev/null
grep -Fx "source_version=${VERSION}" "${ARCHIVE_ROOT}/BUILDINFO" >/dev/null
grep -E '^source_commit=[0-9a-f]{40}$' "${ARCHIVE_ROOT}/BUILDINFO" >/dev/null
"${ARCHIVE_ROOT}/gvm-gateway" --help >/dev/null
Loading
Loading