Skip to content

Commit 934e13e

Browse files
committed
osc-monitor: enable hermetic build
- Enabling pre-fetching for go code. - Change Dockerfile to build without checking go version. This is because version check requires yq, which gets installed at build time, which fails in a hermetic build. - Enabling hermetic build. Following Konflux doc: - https://konflux.pages.redhat.com/docs/users/building/prefetching-dependencies.html Signed-off-by: Julien Ropé <[email protected]>
1 parent 0223bfa commit 934e13e

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

.tekton/osc-monitor-pull-request.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ spec:
2828
value: 5d
2929
- name: dockerfile
3030
value: Dockerfile.monitor
31+
- name: prefetch-input
32+
value: '{"type": "gomod", "path": "./src/runtime"}'
3133
pipelineSpec:
3234
description: |
3335
This pipeline is ideal for building container images from a Containerfile while reducing network traffic.
@@ -99,7 +101,7 @@ spec:
99101
description: Skip checks against built image
100102
name: skip-checks
101103
type: string
102-
- default: "false"
104+
- default: "true"
103105
description: Execute the build with network isolation
104106
name: hermetic
105107
type: string

.tekton/osc-monitor-push.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ spec:
2525
value: quay.io/redhat-user-workloads/ose-osc-tenant/osc-monitor:{{revision}}
2626
- name: dockerfile
2727
value: Dockerfile.monitor
28+
- name: prefetch-input
29+
value: '{"type": "gomod", "path": "./src/runtime"}'
2830
pipelineSpec:
2931
description: |
3032
This pipeline is ideal for building container images from a Containerfile while reducing network traffic.
@@ -96,7 +98,7 @@ spec:
9698
description: Skip checks against built image
9799
name: skip-checks
98100
type: string
99-
- default: "false"
101+
- default: "true"
100102
description: Execute the build with network isolation
101103
name: hermetic
102104
type: string

Dockerfile.monitor

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ COPY ./VERSION /workdir/VERSION
55
COPY ./.git /workdir/.git
66
COPY ./src/runtime /workdir/src/runtime
77
WORKDIR /workdir/src/runtime
8-
RUN CGO_ENABLED=1 GOFLAGS=-tags=strictfipsruntime make monitor
8+
# Using the "SKIP_GO_VERSION_CHECK" flag to skip version checcking, because it
9+
# requires yq, which then gets installed at build time.
10+
# In a hermetic build environment, this is causing failure.
11+
RUN SKIP_GO_VERSION_CHECK=true CGO_ENABLED=1 GOFLAGS=-tags=strictfipsruntime make monitor
912

1013
# Add only required capabilities for the monitor
1114
RUN chmod u-s kata-monitor

0 commit comments

Comments
 (0)