Skip to content

Commit 94e3dfc

Browse files
atoulmegithub-actions[bot]
authored andcommitted
[cmd/golden] add a workflow to make a docker image (open-telemetry#40721)
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description Build a docker image for the golden binary, available as snapshot and release artifact, needed for or after open-telemetry/opentelemetry-java-contrib#1960 is merged <!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. --> #### Link to tracking issue Fixes open-telemetry#40538 --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 3e2eade commit 94e3dfc

File tree

2 files changed

+181
-0
lines changed

2 files changed

+181
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Use this changelog template to create an entry for release notes.
2+
3+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
4+
change_type: enhancement
5+
6+
# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
7+
component: cmd/golden
8+
9+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
10+
note: Build a docker image for the golden binary, available as snapshot and release artifact
11+
12+
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
13+
issues: [40538]
14+
15+
# (Optional) One or more lines of additional information to render under the primary note.
16+
# These lines will be padded with 2 spaces and then inserted directly into the document.
17+
# Use pipe (|) for multiline entries.
18+
subtext:
19+
20+
# If your change doesn't affect end users or the exported elements of any package,
21+
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
22+
# Optional: The change log or logs in which this entry should be included.
23+
# e.g. '[user]' or '[user, api]'
24+
# Include 'user' if the change is relevant to end users.
25+
# Include 'api' if there is a change to a library API.
26+
# Default: '[user]'
27+
change_logs: []

.github/workflows/golden.yml

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
name: golden
2+
on:
3+
push:
4+
branches: [main]
5+
tags:
6+
- "v[0-9]+.[0-9]+.[0-9]+*"
7+
paths-ignore:
8+
- "**/README.md"
9+
merge_group:
10+
pull_request:
11+
paths-ignore:
12+
- "**/README.md"
13+
env:
14+
# Make sure to exit early if cache segment download times out after 2 minutes.
15+
# We limit cache download as a whole to 5 minutes.
16+
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 2
17+
18+
# Do not cancel this workflow on main. See https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/16616
19+
concurrency:
20+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
21+
cancel-in-progress: true
22+
23+
permissions: read-all
24+
25+
jobs:
26+
build-dev:
27+
runs-on: ubuntu-24.04
28+
if: ${{ github.actor != 'dependabot[bot]' }}
29+
steps:
30+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
31+
- uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5
32+
with:
33+
go-version: 1.23.10
34+
cache: false
35+
- name: Cache Go
36+
id: go-cache
37+
timeout-minutes: 5
38+
uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4
39+
with:
40+
path: |
41+
~/go/bin
42+
~/go/pkg/mod
43+
key: go-cache-${{ runner.os }}-${{ hashFiles('**/go.sum') }}
44+
- name: Set up QEMU
45+
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3
46+
- name: Set up Docker Buildx
47+
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3
48+
- name: Build binaries
49+
run: |
50+
GOOS=linux GOARCH=ppc64le make golden
51+
GOOS=linux GOARCH=arm64 make golden
52+
GOOS=linux GOARCH=amd64 make golden
53+
GOOS=linux GOARCH=s390x make golden
54+
cp bin/golden_* cmd/golden/
55+
- name: Build golden
56+
uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 # v6
57+
with:
58+
context: cmd/golden
59+
push: false
60+
tags: ghcr.io/open-telemetry/opentelemetry-collector-contrib/golden:dev
61+
platforms: linux/amd64,linux/arm64,linux/s390x,linux/ppc64le
62+
63+
publish-latest:
64+
runs-on: ubuntu-24.04
65+
if: (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')) && github.repository == 'open-telemetry/opentelemetry-collector-contrib'
66+
permissions:
67+
packages: write
68+
steps:
69+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
70+
- uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5
71+
with:
72+
go-version: 1.23.10
73+
cache: false
74+
- name: Cache Go
75+
id: go-cache
76+
timeout-minutes: 5
77+
uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4
78+
with:
79+
path: |
80+
~/go/bin
81+
~/go/pkg/mod
82+
key: go-cache-${{ runner.os }}-${{ hashFiles('**/go.sum') }}
83+
- name: Set up QEMU
84+
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3
85+
- name: Set up Docker Buildx
86+
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3
87+
- name: Login to GitHub Container Registry
88+
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3
89+
with:
90+
registry: ghcr.io
91+
username: ${{ github.repository_owner }}
92+
password: ${{ secrets.GITHUB_TOKEN }}
93+
- name: Build binaries
94+
run: |
95+
GOOS=linux GOARCH=ppc64le make golden
96+
GOOS=linux GOARCH=arm64 make golden
97+
GOOS=linux GOARCH=amd64 make golden
98+
GOOS=linux GOARCH=s390x make golden
99+
cp bin/golden_* cmd/golden/
100+
- name: Push golden to Github packages
101+
uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 # v6
102+
with:
103+
context: cmd/golden
104+
push: true
105+
tags: ghcr.io/open-telemetry/opentelemetry-collector-contrib/golden:latest
106+
platforms: linux/amd64,linux/arm64,linux/s390x,linux/ppc64le
107+
108+
publish-stable:
109+
runs-on: ubuntu-24.04
110+
if: startsWith(github.ref, 'refs/tags/v') && github.repository == 'open-telemetry/opentelemetry-collector-contrib'
111+
permissions:
112+
packages: write
113+
steps:
114+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
115+
- uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5
116+
with:
117+
go-version: 1.23.10
118+
cache: false
119+
- name: Cache Go
120+
id: go-cache
121+
timeout-minutes: 5
122+
uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4
123+
with:
124+
path: |
125+
~/go/bin
126+
~/go/pkg/mod
127+
key: go-cache-${{ runner.os }}-${{ hashFiles('**/go.sum') }}
128+
- name: Set up QEMU
129+
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3
130+
- name: Set up Docker Buildx
131+
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3
132+
- name: Set Release Tag
133+
id: github_tag
134+
run: ./.github/workflows/scripts/set_release_tag.sh
135+
- name: Login to GitHub Container Registry
136+
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3
137+
with:
138+
registry: ghcr.io
139+
username: ${{ github.repository_owner }}
140+
password: ${{ secrets.GITHUB_TOKEN }}
141+
- name: Build binaries
142+
run: |
143+
GOOS=linux GOARCH=ppc64le make golden
144+
GOOS=linux GOARCH=arm64 make golden
145+
GOOS=linux GOARCH=amd64 make golden
146+
GOOS=linux GOARCH=s390x make golden
147+
cp bin/golden_* cmd/golden/
148+
- name: Push golden to Github packages
149+
uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 # v6
150+
with:
151+
context: cmd/golden
152+
push: true
153+
tags: ghcr.io/open-telemetry/opentelemetry-collector-contrib/golden:${{ steps.github_tag.outputs.tag }}
154+
platforms: linux/amd64,linux/arm64,linux/s390x,linux/ppc64le

0 commit comments

Comments
 (0)