diff --git a/.github/workflows/ci-release.yml b/.github/workflows/ci-release.yml index 3ebe586c4b8..3e095f56e2c 100644 --- a/.github/workflows/ci-release.yml +++ b/.github/workflows/ci-release.yml @@ -71,17 +71,23 @@ jobs: id: params run: | docker_flags=() + goreleaser_args=() if [[ "${{ inputs.dry_run }}" == "true" ]]; then docker_flags=("${docker_flags[@]}" -l -p linux/amd64) echo "platforms=linux/amd64" >> $GITHUB_OUTPUT echo "gpg_key_override=-k skip" >> $GITHUB_OUTPUT + # For dry run, skip signing and only build snapshot + goreleaser_args=("${goreleaser_args[@]}" --snapshot --skip=sign) else echo "platforms=$(make echo-platforms)" >> $GITHUB_OUTPUT + # For real release, use full goreleaser with signing + goreleaser_args=("${goreleaser_args[@]}") fi if [[ "${{ inputs.overwrite }}" == "true" ]]; then docker_flags=("${docker_flags[@]}" -o) fi echo "docker_flags=${docker_flags[@]}" >> $GITHUB_OUTPUT + echo "goreleaser_args=${goreleaser_args[@]}" >> $GITHUB_OUTPUT cat $GITHUB_OUTPUT - name: Export BRANCH variable and validate it is a semver @@ -96,41 +102,33 @@ jobs: - name: Configure GPG Key if: ${{ inputs.dry_run != true }} + id: import_gpg uses: crazy-max/ghaction-import-gpg@e89d40939c28e39f97cf32126055eeae86ba74ec # v6.3.0 with: gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} passphrase: ${{ secrets.GPG_PASSPHRASE }} - - name: Build all binaries - run: make build-all-platforms PLATFORMS=${{ steps.params.outputs.platforms }} - - - name: Package binaries - run: | - bash scripts/build/package-deploy.sh \ - -p ${{ steps.params.outputs.platforms }} \ - ${{ steps.params.outputs.gpg_key_override }} - - - name: Upload binaries - if: ${{ inputs.dry_run != true }} - uses: svenstaro/upload-release-action@5e35e583720436a2cc5f9682b6f55657101c1ea1 # 2.11.1 + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@9c615fef8b1bc3cf0eb46d69e502bb97fa8c9387 # v6.1.1 with: - file: '{deploy/*.tar.gz,deploy/*.zip,deploy/*.sha256sum.txt,deploy/*.asc}' - file_glob: true - overwrite: ${{ inputs.overwrite }} - tag: ${{ env.BRANCH }} - repo_token: ${{ secrets.GITHUB_TOKEN }} + distribution: goreleaser + version: '~> v2' + args: release --clean ${{ steps.params.outputs.goreleaser_args }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} - name: Delete the release artifacts after uploading them. run: | - rm -rf deploy || true + rm -rf dist || true df -h / - uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0 - name: Build and upload all container images - # -B skips building the binaries since we already did that above + # Note: Docker scripts rebuild binaries as they need specific naming run: | - bash scripts/build/build-upload-docker-images.sh -B \ + bash scripts/build/build-upload-docker-images.sh \ ${{ steps.params.outputs.docker_flags }} env: DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index 54fd3e8820a..1906c76b0ea 100644 --- a/.gitignore +++ b/.gitignore @@ -40,6 +40,7 @@ __pycache__ .asset-manifest.json deploy/ deploy-staging/ +dist/ sha256sum.combined.txt resource.syso .gocache diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 00000000000..b6a0dd14926 --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,331 @@ +# Copyright (c) 2024 The Jaeger Authors. +# SPDX-License-Identifier: Apache-2.0 + +version: 2 + +before: + hooks: + # Build UI assets before building binaries + - make build-ui + +builds: + # Main Jaeger binary (v2) + - id: jaeger + main: ./cmd/jaeger + binary: jaeger + env: + - CGO_ENABLED=0 + flags: + - -trimpath + ldflags: + - -X github.com/jaegertracing/jaeger/internal/version.commitSHA={{.FullCommit}} + - -X github.com/jaegertracing/jaeger/internal/version.latestVersion={{.Tag}} + - -X github.com/jaegertracing/jaeger/internal/version.date={{.Date}} + goos: + - linux + - darwin + - windows + goarch: + - amd64 + - arm64 + - s390x + - ppc64le + ignore: + - goos: darwin + goarch: s390x + - goos: darwin + goarch: ppc64le + - goos: windows + goarch: arm64 + - goos: windows + goarch: s390x + - goos: windows + goarch: ppc64le + + # Remote Storage binary + - id: remote-storage + main: ./cmd/remote-storage + binary: remote-storage + env: + - CGO_ENABLED=0 + flags: + - -trimpath + ldflags: + - -X github.com/jaegertracing/jaeger/internal/version.commitSHA={{.FullCommit}} + - -X github.com/jaegertracing/jaeger/internal/version.latestVersion={{.Tag}} + - -X github.com/jaegertracing/jaeger/internal/version.date={{.Date}} + goos: + - linux + - darwin + - windows + goarch: + - amd64 + - arm64 + - s390x + - ppc64le + ignore: + - goos: darwin + goarch: s390x + - goos: darwin + goarch: ppc64le + - goos: windows + goarch: arm64 + - goos: windows + goarch: s390x + - goos: windows + goarch: ppc64le + + # Tracegen tool + - id: tracegen + main: ./cmd/tracegen + binary: tracegen + env: + - CGO_ENABLED=0 + flags: + - -trimpath + ldflags: + - -X github.com/jaegertracing/jaeger/internal/version.commitSHA={{.FullCommit}} + - -X github.com/jaegertracing/jaeger/internal/version.latestVersion={{.Tag}} + - -X github.com/jaegertracing/jaeger/internal/version.date={{.Date}} + goos: + - linux + - darwin + - windows + goarch: + - amd64 + - arm64 + - s390x + - ppc64le + ignore: + - goos: darwin + goarch: s390x + - goos: darwin + goarch: ppc64le + - goos: windows + goarch: arm64 + - goos: windows + goarch: s390x + - goos: windows + goarch: ppc64le + + # Anonymizer tool + - id: anonymizer + main: ./cmd/anonymizer + binary: anonymizer + env: + - CGO_ENABLED=0 + flags: + - -trimpath + ldflags: + - -X github.com/jaegertracing/jaeger/internal/version.commitSHA={{.FullCommit}} + - -X github.com/jaegertracing/jaeger/internal/version.latestVersion={{.Tag}} + - -X github.com/jaegertracing/jaeger/internal/version.date={{.Date}} + goos: + - linux + - darwin + - windows + goarch: + - amd64 + - arm64 + - s390x + - ppc64le + ignore: + - goos: darwin + goarch: s390x + - goos: darwin + goarch: ppc64le + - goos: windows + goarch: arm64 + - goos: windows + goarch: s390x + - goos: windows + goarch: ppc64le + + # ES Mapping Generator tool + - id: esmapping-generator + main: ./cmd/esmapping-generator + binary: esmapping-generator + env: + - CGO_ENABLED=0 + flags: + - -trimpath + ldflags: + - -X github.com/jaegertracing/jaeger/internal/version.commitSHA={{.FullCommit}} + - -X github.com/jaegertracing/jaeger/internal/version.latestVersion={{.Tag}} + - -X github.com/jaegertracing/jaeger/internal/version.date={{.Date}} + goos: + - linux + - darwin + - windows + goarch: + - amd64 + - arm64 + - s390x + - ppc64le + ignore: + - goos: darwin + goarch: s390x + - goos: darwin + goarch: ppc64le + - goos: windows + goarch: arm64 + - goos: windows + goarch: s390x + - goos: windows + goarch: ppc64le + + # ES Index Cleaner tool + - id: es-index-cleaner + main: ./cmd/es-index-cleaner + binary: es-index-cleaner + env: + - CGO_ENABLED=0 + flags: + - -trimpath + ldflags: + - -X github.com/jaegertracing/jaeger/internal/version.commitSHA={{.FullCommit}} + - -X github.com/jaegertracing/jaeger/internal/version.latestVersion={{.Tag}} + - -X github.com/jaegertracing/jaeger/internal/version.date={{.Date}} + goos: + - linux + - darwin + - windows + goarch: + - amd64 + - arm64 + - s390x + - ppc64le + ignore: + - goos: darwin + goarch: s390x + - goos: darwin + goarch: ppc64le + - goos: windows + goarch: arm64 + - goos: windows + goarch: s390x + - goos: windows + goarch: ppc64le + + # ES Rollover tool + - id: es-rollover + main: ./cmd/es-rollover + binary: es-rollover + env: + - CGO_ENABLED=0 + flags: + - -trimpath + ldflags: + - -X github.com/jaegertracing/jaeger/internal/version.commitSHA={{.FullCommit}} + - -X github.com/jaegertracing/jaeger/internal/version.latestVersion={{.Tag}} + - -X github.com/jaegertracing/jaeger/internal/version.date={{.Date}} + goos: + - linux + - darwin + - windows + goarch: + - amd64 + - arm64 + - s390x + - ppc64le + ignore: + - goos: darwin + goarch: s390x + - goos: darwin + goarch: ppc64le + - goos: windows + goarch: arm64 + - goos: windows + goarch: s390x + - goos: windows + goarch: ppc64le + + # HotROD example application + - id: hotrod + main: ./examples/hotrod/main.go + binary: example-hotrod + env: + - CGO_ENABLED=0 + flags: + - -trimpath + ldflags: + - -X github.com/jaegertracing/jaeger/internal/version.commitSHA={{.FullCommit}} + - -X github.com/jaegertracing/jaeger/internal/version.latestVersion={{.Tag}} + - -X github.com/jaegertracing/jaeger/internal/version.date={{.Date}} + goos: + - linux + - darwin + - windows + goarch: + - amd64 + - arm64 + - s390x + - ppc64le + ignore: + - goos: darwin + goarch: s390x + - goos: darwin + goarch: ppc64le + - goos: windows + goarch: arm64 + - goos: windows + goarch: s390x + - goos: windows + goarch: ppc64le + +archives: + # Main jaeger and hotrod archive + - id: jaeger + formats: [tar.gz] + name_template: "jaeger-{{ .Version }}-{{ .Os }}-{{ .Arch }}" + files: + - none* # Don't include any extra files + format_overrides: + - goos: windows + formats: [zip, tar.gz] + ids: + - jaeger + - hotrod + + # Tools archive + - id: jaeger-tools + formats: [tar.gz] + name_template: "jaeger-tools-{{ .Version }}-{{ .Os }}-{{ .Arch }}" + files: + - none* # Don't include any extra files + format_overrides: + - goos: windows + formats: [zip, tar.gz] + ids: + - es-index-cleaner + - es-rollover + - esmapping-generator + +checksum: + name_template: "jaeger-{{ .Version }}.sha256sum.txt" + algorithm: sha256 + +signs: + - cmd: gpg + args: + - "--batch" + - "--local-user" + - "{{ .Env.GPG_FINGERPRINT }}" + - "--output" + - "${signature}" + - "--detach-sign" + - "${artifact}" + artifacts: all + signature: "${artifact}.asc" + +changelog: + disable: true + +release: + # We create the GitHub release manually before running this workflow + disable: false + prerelease: auto + # Use append mode to work with existing releases + mode: append + +snapshot: {} diff --git a/RELEASE.md b/RELEASE.md index 5a90308ee4f..361bd283d46 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -46,9 +46,12 @@ Create an issue with the checklist for the release by running `bash scripts/rele * `make draft-release` 4. Go to [Publish Release](https://github.com/jaegertracing/jaeger/actions/workflows/ci-release.yml) workflow on GitHub and run it manually using Run Workflow button on the right. + * The workflow uses [GoReleaser](https://goreleaser.com/) to build and package binaries for all platforms + * It generates checksums and GPG signatures for all artifacts + * It builds and pushes Docker images for all components 1. For monitoring and troubleshooting, open the logs of the workflow run from above URL. 2. Check the images are available on [Docker Hub](https://hub.docker.com/r/jaegertracing/) - and binaries are uploaded [to the release]()https://github.com/jaegertracing/jaeger/releases. + and binaries are uploaded [to the release](https://github.com/jaegertracing/jaeger/releases). @@ -64,6 +67,21 @@ Create an issue with the checklist for the release by running `bash scripts/rele except the New Contributors section. Change the header to `### 👏 New Contributors`, then copy the main changelog above it. [Example](https://github.com/jaegertracing/jaeger/releases/tag/v1.55.0). +## Testing Release Locally + +To test the GoReleaser configuration locally before running the actual release: + +```bash +# Validate the configuration +go run github.com/goreleaser/goreleaser/v2@latest check + +# Run a snapshot release (no git tag required, no publishing) +go run github.com/goreleaser/goreleaser/v2@latest release --snapshot --clean --skip=sign + +# The binaries and archives will be in the dist/ directory +ls -la dist/ +``` + ## Patch Release Sometimes we need to do a patch release, e.g. to fix a newly introduced bug. If the main branch already contains newer changes, it is recommended that a patch release is done from a version branch.