Skip to content

Commit 3ce9dd7

Browse files
committed
update go build command for Hermeto
When we switched to Hermeto from Cachito, we started seeing issues with how the Go backend processes vendored dependencies. We were instructed with help from the Hermeto team to add the following: 1. source $CACHITO_ENV_FILE before `go build` cmd 2. add -mod=readonly to `go build` command Also, remove the gomod-vendor flag from container.yaml as it is not used by Hermeto https://spaces.redhat.com/pages/viewpage.action?pageId=228017926#UpstreamSources(Cachito,Hermeto,ContainerFirst)-GomodVendoring
1 parent 87317ad commit 3ce9dd7

File tree

2 files changed

+1
-3
lines changed

2 files changed

+1
-3
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ WORKDIR $REMOTE_SOURCE_DIR/app
88

99
RUN dnf install -y glibc-static
1010

11-
RUN go build -o $REMOTE_SOURCE_DIR/app/bin/snmp_notifier -ldflags "-s -X github.com/prometheus/common/version.Version=1.2.1 -X github.com/prometheus/common/version.Revision=14ba67401c61cfc2f19ebd9ace8acdcf47b4cd49 -X github.com/prometheus/common/version.Branch=master -X github.com/prometheus/common/version.BuildUser=osbs -X github.com/prometheus/common/version.BuildDate=20211104-18:55:37 -extldflags '-static'" -a -tags netgo ${REMOTE_SOURCE_DIR}/app/snmp_notifier.go
11+
RUN source $CACHITO_ENV_FILE && go build -mod=readonly -o $REMOTE_SOURCE_DIR/app/bin/snmp_notifier -ldflags "-s -X github.com/prometheus/common/version.Version=1.2.1 -X github.com/prometheus/common/version.Revision=14ba67401c61cfc2f19ebd9ace8acdcf47b4cd49 -X github.com/prometheus/common/version.Branch=master -X github.com/prometheus/common/version.BuildUser=osbs -X github.com/prometheus/common/version.BuildDate=20211104-18:55:37 -extldflags '-static'" -a -tags netgo ${REMOTE_SOURCE_DIR}/app/snmp_notifier.go
1212

1313
# Build stage 2
1414

container.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,3 @@ remote_source:
77
ref: 73773b728ff6147d9590e6db86e44a668bbd93d5
88
pkg_managers:
99
- gomod
10-
flags:
11-
- gomod-vendor

0 commit comments

Comments
 (0)