Skip to content

Commit 2ec3148

Browse files
[cmd/golden] add a Docker image (#39771)
Adds a docker image for the new golden cmd executable, allowing to port this utility to make assertions in Kubernetes environments. Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 961cb67 commit 2ec3148

File tree

3 files changed

+50
-0
lines changed

3 files changed

+50
-0
lines changed

.chloggen/golden_docker.yaml

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: Add a docker image for golden
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: [39662]
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: []

Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,13 @@ docker-telemetrygen:
360360
cd cmd/telemetrygen && docker build --platform linux/$(GOARCH) --build-arg="TARGETOS=$(GOOS)" --build-arg="TARGETARCH=$(GOARCH)" -t telemetrygen:latest .
361361
rm cmd/telemetrygen/telemetrygen_*
362362

363+
.PHONY: docker-golden
364+
docker-golden:
365+
GOOS=linux GOARCH=$(GOARCH) $(MAKE) golden
366+
cp bin/golden_* cmd/golden/
367+
cd cmd/golden && docker build --platform linux/$(GOARCH) --build-arg="TARGETOS=$(GOOS)" --build-arg="TARGETARCH=$(GOARCH)" -t golden:latest .
368+
rm cmd/golden/golden_*
369+
363370
.PHONY: generate
364371
generate: install-tools
365372
PATH="$(ROOT_DIR).tools:$$PATH" $(MAKE) for-all CMD="$(GOCMD) generate ./..."

cmd/golden/Dockerfile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
FROM alpine:latest@sha256:a8560b36e8b8210634f77d9f7f9efd7ffa463e380b75e2e74aff4511df3ef88c AS certs
2+
RUN apk --update add ca-certificates
3+
4+
FROM scratch
5+
6+
ARG USER_UID=10001
7+
ARG USER_GID=10001
8+
USER ${USER_UID}:${USER_GID}
9+
10+
ARG TARGETOS
11+
ARG TARGETARCH
12+
13+
COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
14+
COPY ./golden_${TARGETOS}_${TARGETARCH} /golden
15+
16+
ENTRYPOINT ["/golden"]

0 commit comments

Comments
 (0)