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
31 changes: 31 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,34 @@ jobs:

- name: Tests
run: go test -race ./...

release-check:
name: Release packaging (unsigned)
runs-on: ubuntu-latest
timeout-minutes: 15
# No OIDC or publishing permissions: PRs build and inspect snapshots only.
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- uses: actions/setup-go@v7
with:
go-version: ${{ env.GO_VERSION }}
cache: true
- uses: anchore/sbom-action/download-syft@fffec3d851af758d56fee099cf3fbf8aa8779843 # v0.24.3
with:
syft-version: v1.57.2
- uses: goreleaser/goreleaser-action@v7
with:
distribution: goreleaser
version: v2.20.2
install-only: true
- name: Build archives and SBOMs without publishing or signing
run: |
goreleaser check
goreleaser release --snapshot --clean --skip=publish,sign,docker
- name: Validate snapshot and reject damaged evidence
run: |
python3 scripts/check-release-artifacts.py dist --unsigned \
--version "$(jq -r .version dist/metadata.json)"
python3 -m unittest discover -s scripts -p 'test_*.py' -v
58 changes: 55 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,32 @@ jobs:
name: GoReleaser
needs: [release-please]
# always(): still run on workflow_dispatch when release-please is skipped.
if: ${{ always() && !cancelled() && (needs.release-please.outputs.release_created == 'true' || (github.event_name == 'workflow_dispatch' && inputs.publish_tag != '')) }}
if: ${{ always() && !cancelled() && github.repository == 'tracewick/agent' && github.ref == 'refs/heads/main' && (needs.release-please.outputs.release_created == 'true' || (github.event_name == 'workflow_dispatch' && inputs.publish_tag != '')) }}
runs-on: ubuntu-latest
timeout-minutes: 45
permissions:
contents: write
packages: write
id-token: write
env:
RELEASE_TAG: ${{ needs.release-please.outputs.tag_name || inputs.publish_tag }}
steps:
- name: Validate the release tag input
shell: bash
run: |
[[ "$RELEASE_TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?$ ]] || exit 1

- uses: actions/checkout@v7
with:
fetch-depth: 0
ref: ${{ inputs.publish_tag || github.sha }}
ref: ${{ env.RELEASE_TAG }}

- name: Require a tag from main with signed-release support
shell: bash
run: |
test "$(git rev-parse HEAD)" = "$(git rev-parse "refs/tags/$RELEASE_TAG^{commit}")"
git merge-base --is-ancestor HEAD origin/main
test -f scripts/check-release-artifacts.py

- uses: actions/setup-go@v7
with:
Expand All @@ -93,6 +108,14 @@ jobs:
- uses: docker/setup-qemu-action@v4
- uses: docker/setup-buildx-action@v4

- uses: sigstore/cosign-installer@756fe2d284c7292c4e9b62c8a28f1e5629c59532 # v4.1.3
with:
cosign-release: v3.1.4

- uses: anchore/sbom-action/download-syft@fffec3d851af758d56fee099cf3fbf8aa8779843 # v0.24.3
with:
syft-version: v1.57.2

- name: Login to GHCR
uses: docker/login-action@v4
with:
Expand All @@ -103,12 +126,41 @@ jobs:
- uses: goreleaser/goreleaser-action@v7
with:
distribution: goreleaser
version: "~> v2"
version: v2.20.2
args: release --clean
env:
# App token uploads assets to the App-created release; GHCR uses docker login above.
GITHUB_TOKEN: ${{ steps.app-token.outputs.token || secrets.GITHUB_TOKEN }}

- name: Verify published release artifacts
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release download "$RELEASE_TAG" --repo "$GITHUB_REPOSITORY" \
--dir "$RUNNER_TEMP/release-verification"
python3 scripts/check-release-artifacts.py "$RUNNER_TEMP/release-verification" \
--version "${RELEASE_TAG#v}"

- name: Verify published image signature, revision and SBOMs
shell: bash
run: |
IMAGE=ghcr.io/tracewick/agent
DIGEST=$(docker buildx imagetools inspect "$IMAGE:${RELEASE_TAG#v}" --format '{{.Manifest.Digest}}')
[[ "$DIGEST" =~ ^sha256:[a-f0-9]{64}$ ]] || exit 1
cosign verify \
--certificate-identity 'https://github.com/tracewick/agent/.github/workflows/release.yml@refs/heads/main' \
--certificate-oidc-issuer 'https://token.actions.githubusercontent.com' "$IMAGE@$DIGEST"
docker buildx imagetools inspect "$IMAGE@$DIGEST" --raw | \
jq -e --arg ver "${RELEASE_TAG#v}" --arg rev "$(git rev-parse HEAD)" \
'.annotations["org.opencontainers.image.version"] == $ver and
.annotations["org.opencontainers.image.revision"] == $rev'
docker buildx imagetools inspect "$IMAGE@$DIGEST" --format '{{json .SBOM}}' > "$RUNNER_TEMP/image-sboms.json"
jq -e '. as $sboms | ["linux/amd64", "linux/arm64"] | all(.[];
$sboms[.].SPDX | (.spdxVersion | startswith("SPDX-")) and
([.packages[].name] | index("base-files") != null and
index("stdlib") != null and index("github.com/tracewick/agent") != null))' \
"$RUNNER_TEMP/image-sboms.json"

back-merge:
name: Merge main back into develop
needs: release-please
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
/build/
.golangci.cache/
.cache/
__pycache__/

# IDE / OS
.idea/
Expand Down
49 changes: 44 additions & 5 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Multi-arch binaries + GHCR images. Cosign / SBOM intentionally deferred;
# release footer states unsigned until they land.
# Multi-arch binaries and GHCR images, with SBOMs and keyless signatures.
version: 2

project_name: tracewick-agent
Expand All @@ -26,6 +25,29 @@ checksum:
name_template: checksums.txt
algorithm: sha256

# These SBOMs describe the actual archives, not the source checkout.
sboms:
- artifacts: archive
documents:
- "{{ .ArtifactName }}.sbom.json"
args:
- "$artifact"
- "--output"
- "cyclonedx-json=$document"
- "--source-name={{ .ProjectName }}"
- "--source-version={{ .Version }}"

# The checksum manifest covers both archives and their SBOMs.
signs:
- cmd: cosign
artifacts: checksum
signature: "${artifact}.sigstore.json"
args:
- sign-blob
- "--bundle=${signature}"
- "${artifact}"
- "--yes"

dockers_v2:
- id: tracewick-agent
ids: [tracewick-agent]
Expand All @@ -35,10 +57,15 @@ dockers_v2:
tags:
- "{{ .Version }}"
- "{{ .Tag }}"
- latest
- "{{ if not .Prerelease }}latest{{ end }}"
platforms:
- linux/amd64
- linux/arm64
# BuildKit attaches per-platform SPDX SBOMs to the OCI index.
sbom: true
annotations:
"index:org.opencontainers.image.version": "{{ .Version }}"
"index:org.opencontainers.image.revision": "{{ .FullCommit }}"
labels:
"org.opencontainers.image.title": "tracewick-agent"
"org.opencontainers.image.description": "Tracewick spool sidecar for Pyroscope"
Expand All @@ -47,13 +74,25 @@ dockers_v2:
"org.opencontainers.image.version": "{{ .Version }}"
"org.opencontainers.image.revision": "{{ .FullCommit }}"

# Sign the index by digest, binding its platform manifests and SBOM attestations.
docker_signs:
- artifacts: ""
args:
- sign
- "${artifact}@${digest}"
- "--yes"

changelog:
disable: true

release:
draft: false
# release-please already wrote the changelog body; append the unsigned note.
prerelease: auto
# release-please already wrote the changelog body.
mode: append
footer: |
---
**Unsigned release:** no cosign signatures or SBOM yet. Prefer `checksums.txt` (SHA-256) and pinned image digests from `ghcr.io/tracewick/agent`. Cosign/SBOM land later.
Archive SBOMs and a Sigstore bundle for `checksums.txt` accompany this release.
GHCR image indexes are signed by digest and include per-platform SPDX SBOMs.
Verify the release workflow completed successfully and follow the
[verification instructions](https://github.com/tracewick/agent/blob/main/deploy/verify-release.md).
6 changes: 6 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ make stand-down
- English only. Conventional Commits. Do not hand-edit `CHANGELOG.md`.
- Do not invent agent-local ADR numbers that shadow main-repo ADRs; link them.
- Git flow: branch `feature/*` from `develop`, open PRs into `develop`.
Promote to `main` **only** via `release/<version>` or `hotfix/<version>` —
never a direct feature/fix/chore PR into `main`. Agents may merge into
`develop` after Checks green; **never** merge anything whose base is `main`
(release PR, release-please, back-merge — maintainer only). «Делай» does not
override this.
- After opening or pushing a PR, babysit checks (`gh pr checks`, Codecov) until
green; fix failures yourself. Report only when review-ready or blocked on a
secret/decision.
Expand All @@ -88,3 +93,4 @@ make stand-down

See [CONTRIBUTING.md](CONTRIBUTING.md) § Releasing. Do not invent tags outside
release-please. Do not push or merge to `main` unless the maintainer asks.
Path: `develop` → `release/<ver>` → `main` (merge commit) → release-please tag.
50 changes: 42 additions & 8 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ engineering and release discipline as
files, aggregates them, encodes **pprof**, and pushes to Pyroscope. The PHP
library and `tracewick-drain` remain the spool writers / reference drain.

> **Beta (`0.2.x`).** Capacity evidence (agent as reader) lives in
> **Release candidate (`1.0.0-rc.1`).** Capacity evidence (agent as reader) lives in
> [`tracewick/benchmarks`](https://github.com/tracewick/benchmarks). Do not claim
> production / highload readiness. Cosign/SBOM, broader env parity, and socket
> hand-off remain RC / later.
> production / highload readiness. Operational env parity is included; socket
> hand-off remains v1.1+. Signed-release configuration is described below.

## Path to release

Expand All @@ -23,7 +23,7 @@ Alpha cut is done (`v0.1.0`). Keep the floor green while advancing RC work:
| --- | --- |
| Delivery proof | Stand + Toxiproxy chaos + Querier live + Go ↔ PHP-drain (see `test/e2e/`) |
| Test proof | Coverage gates **and** fuzz / `go tool pprof` / mutation (Gremlins) on core |
| Release machine | release-please + GoReleaser: binaries + `ghcr.io/tracewick/agent`; unsigned until cosign |
| Release machine | release-please + GoReleaser: binaries, archive SBOMs, signed checksums and SBOM-bearing signed GHCR indexes |
| Load truth | Soak/load via [`tracewick/benchmarks`](https://github.com/tracewick/benchmarks), not a weak mini-soak here |

httptest is fine for unit and claim-smoke only — not a substitute for Toxiproxy chaos.
Expand Down Expand Up @@ -110,16 +110,50 @@ Releases follow git flow and are automated with
request into `main`.
3. Merging it tags `v<version>` and runs GoReleaser: linux amd64/arm64
`tar.gz` + `checksums.txt`, multi-arch `ghcr.io/tracewick/agent`, and an
**unsigned** footer on the GitHub Release body (no cosign/SBOM yet).
footer linking [SBOM/signature verification](deploy/verify-release.md).
Archive SBOMs are generated with Syft, checksums are signed with keyless
Cosign, and BuildKit SBOM-bearing image indexes are signed by digest.
4. The workflow opens a pull request merging `main` back into `develop`.

Tags `v*` are protected by a ruleset. The workflow uses a dedicated GitHub App
(`RELEASE_APP_ID` / `RELEASE_APP_PRIVATE_KEY`, on the tag ruleset bypass list —
same pattern as `tracewick/tracewick`). Do not force-push tags by hand.

Releases stay **unsigned** until cosign/SBOM land. Pin the next tag with
`release-as` in `release-please-config.json` when forcing a version (then remove
it after the release PR merges). Do not invent tags outside that flow.
Existing 0.2.x releases remain **unsigned**. The first signed release must pass
the publishing job and verification steps; a local snapshot is not an OIDC test.
The Release workflow must run from main, including manual recovery, so its exact
certificate identity ends in `release.yml@refs/heads/main`. Only the publishing
job has OIDC permission; no persistent signing key is required. Tool versions are
pinned in the release and unsigned-packaging CI jobs; update them together.
See [verification and recovery](deploy/verify-release.md). Do not invent tags outside that flow.

### Release candidates

The 1.0 series uses `versioning: prerelease`, `prerelease-type: rc` and
`prerelease: true` in `release-please-config.json`. A parseable Conventional
Commit in the preparation branch selects the first candidate:

```text
chore: prepare 1.0.0-rc.1

Release-As: 1.0.0-rc.1
```

The maintainer merges that branch with a merge commit, then reviews and merges
the generated `chore: release 1.0.0-rc.1` PR. The bot creates `v1.0.0-rc.1`;
do not edit the manifest/changelog or create tags manually. GitHub's default
`Merge pull request #N` subject does not parse a Release-As footer.

GoReleaser uses `prerelease: auto` to preserve the GitHub prerelease status.
Prerelease images publish only their versioned tags; `latest` remains stable.
Keep prerelease mode for subsequent candidates and update the documented version.
To select a version explicitly, add a new Release-As footer. For final 1.0.0,
switch `versioning` to `default`, set `prerelease: false`, remove `prerelease-type`
and use `Release-As: 1.0.0` on a Conventional Commit. Review the generated version
and prerelease status before merging.

The E2E `make php-drain` fixture pins the published core `1.0.0-rc.1`, including
when refreshing an existing local cache. It does not change the wire contract.

## License

Expand Down
8 changes: 3 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,12 @@ goreleaser-check: ## Validate .goreleaser.yaml (does not publish)
@command -v goreleaser >/dev/null || $(GO) install github.com/goreleaser/goreleaser/v2@latest
goreleaser check

php-drain: ## Install Packagist tracewick/tracewick for Go+PHP-drain e2e
php-drain: ## Install Packagist core 1.0.0-rc.1 for Go+PHP-drain e2e
@command -v composer >/dev/null || (echo 'composer required for make php-drain' && exit 1)
@command -v php >/dev/null || (echo 'php required for make php-drain' && exit 1)
mkdir -p $(PHP_DRAIN_DIR)
@if [ ! -f $(PHP_DRAIN_DIR)/composer.json ]; then \
printf '%s\n' '{"name":"tracewick/agent-e2e-drain","require":{"tracewick/tracewick":"^0.1"},"config":{"sort-packages":true}}' \
> $(PHP_DRAIN_DIR)/composer.json; \
fi
@printf '%s\n' '{"name":"tracewick/agent-e2e-drain","require":{"tracewick/tracewick":"1.0.0-rc.1"},"config":{"sort-packages":true}}' \
> $(PHP_DRAIN_DIR)/composer.json
cd $(PHP_DRAIN_DIR) && composer update --no-interaction --no-progress --prefer-dist --no-dev
@test -x $(PHP_DRAIN_BIN) || test -f $(PHP_DRAIN_BIN)

Expand Down
Loading