Skip to content

Commit 983cc46

Browse files
[chore] Add OCB release test workflow (open-telemetry#12573)
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description This PR adds a workflow that tests if the builder can be released with the current source code and release setup. It takes the source code from this repo and adds the release config and Dockerfile from the collector-releases repo, then it runs a test release. Tested on my fork: https://github.com/mowies/opentelemetry-collector/actions/runs/13761002306/job/38476925222 (pipeline fails because of goreleaser pro features still being enabled, but the rest works) <!-- Issue number if applicable --> #### Link to tracking issue Fixes open-telemetry#12570 --------- Signed-off-by: Moritz Wiesinger <[email protected]> Co-authored-by: Douglas Camata <[email protected]>
1 parent dc4fab3 commit 983cc46

File tree

1 file changed

+90
-0
lines changed

1 file changed

+90
-0
lines changed
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: Builder - Snapshot build
2+
on:
3+
push:
4+
branches: [main]
5+
6+
# on PRs touching the builder
7+
pull_request:
8+
branches: [main]
9+
paths:
10+
- "cmd/builder"
11+
12+
env:
13+
# renovate: datasource=github-tags depName=goreleaser-pro packageName=goreleaser/goreleaser-pro
14+
GORELEASER_PRO_VERSION: v2.7.0
15+
16+
jobs:
17+
snapshot:
18+
runs-on: ubuntu-24.04
19+
if: ${{ github.repository_owner == 'open-telemetry' }}
20+
steps:
21+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
22+
with:
23+
path: .core
24+
25+
- name: Pull the latest releases repo
26+
uses: actions/checkout@v4
27+
with:
28+
path: opentelemetry-collector-releases
29+
repository: open-telemetry/opentelemetry-collector-releases
30+
31+
- name: Copy release files
32+
run: cp -R ./opentelemetry-collector-releases/cmd/builder/. ./.core/cmd/builder/
33+
34+
- uses: sigstore/cosign-installer@d7d6bc7722e3daa8354c50bcb52f4837da5e9b6a # v3.8.1
35+
- uses: anchore/sbom-action/download-syft@f325610c9f50a54015d37c8d16cb3b0e2c8f4de0 # v0.18.0
36+
37+
- uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0
38+
with:
39+
platforms: amd64, arm64,ppc64le
40+
41+
- uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0
42+
43+
- name: Setup Go
44+
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
45+
with:
46+
go-version: "~1.24"
47+
48+
- name: Check GoReleaser
49+
uses: goreleaser/goreleaser-action@90a3faa9d0182683851fbfa97ca1a2cb983bfca3 # v6.2.1
50+
with:
51+
distribution: goreleaser-pro
52+
version: ${{ env.GORELEASER_PRO_VERSION }}
53+
args: check --verbose -f .core/cmd/builder/.goreleaser.yml
54+
env:
55+
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
56+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
57+
58+
- name: Run GoReleaser
59+
uses: goreleaser/goreleaser-action@90a3faa9d0182683851fbfa97ca1a2cb983bfca3 # v6.2.1
60+
with:
61+
distribution: goreleaser-pro
62+
version: ${{ env.GORELEASER_PRO_VERSION }}
63+
args: --snapshot --clean -f .core/cmd/builder/.goreleaser.yml
64+
env:
65+
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
66+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
67+
COSIGN_YES: false
68+
SKIP_SIGNS: true
69+
70+
# Only create an issue if the workflows fails on push to main branch
71+
- name: File an issue if the workflow failed
72+
if: failure() && github.ref == 'refs/heads/main'
73+
run: |
74+
template=$(cat <<'END'
75+
[Link to job log](%s)
76+
77+
<details>
78+
<summary>Last 100 lines of log</summary>
79+
80+
```
81+
%s
82+
```
83+
</details>
84+
END
85+
)
86+
job_url="$(gh run view ${{ github.run_id }} -R ${{ github.repository }} --json jobs -q '.jobs[] | select(.name == "snapshot") | .url')"
87+
body="$(printf "$template" "$job_url" "$(tail -n100 log.out | tail -c63K)")"
88+
gh issue create -R ${{ github.repository }} -t 'OCB snapshot workflow failed' -b "$body" -l 'ci-cd' -l 'area:builder'
89+
env:
90+
GH_TOKEN: ${{ github.token }}

0 commit comments

Comments
 (0)