From 20ab0a920cc9ed242b2162de4323f824a1434d0c Mon Sep 17 00:00:00 2001 From: Justin Pierce Date: Mon, 28 Oct 2024 16:11:25 -0400 Subject: [PATCH] Add support for cachi2 based deps Konflux is replacing RH's internal build system OSBS. OSBS supported a build-time dependency injection system called "cachito". Konflux replaces this with "cachi2" which works differently. REMOTE_SOURCES no longer need to be copied into place and there is no need to source cachito's environment information (Konflux automatically rewrites the Dockerfile to source cachi2/cachi2.env before running the original RUN commands). Additionally, cachito appears to have provided go.sum dependencies whereas cachi2 requires all build-time dependencies in go.mod. Missing dependencies are added to go.mod as // indirect in this change. --- Dockerfile.installer.art-cachi2 | 65 +++++++++++++++++++++++++++++++++ go.mod | 5 +++ 2 files changed, 70 insertions(+) create mode 100644 Dockerfile.installer.art-cachi2 diff --git a/Dockerfile.installer.art-cachi2 b/Dockerfile.installer.art-cachi2 new file mode 100644 index 00000000000..7902bbab57d --- /dev/null +++ b/Dockerfile.installer.art-cachi2 @@ -0,0 +1,65 @@ +# This Dockerfile builds an image containing Mac and Linux ARM64/AMD64 versions of the etcd. +# The resulting image is used to build the statically-linked openshift-installer binary. + +FROM registry.ci.openshift.org/ocp/builder:rhel-9-golang-1.22-openshift-4.18 AS macbuilder + +ENV GO_COMPLIANCE_EXCLUDE=".*" + +WORKDIR /go/src/go.etcd.io/etcd +COPY . . + +RUN find $GOPATH +RUN export GOFLAGS='-mod=readonly' && export GO_BUILD_FLAGS='-v' \ + && CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 ./build.sh + +FROM registry.ci.openshift.org/ocp/builder:rhel-9-golang-1.22-openshift-4.18 AS macarmbuilder + +ENV GO_COMPLIANCE_EXCLUDE=".*" + +WORKDIR /go/src/go.etcd.io/etcd +COPY . . + +RUN export GOFLAGS='-mod=readonly' && export GO_BUILD_FLAGS='-v' \ + && CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 ./build.sh + +FROM registry.ci.openshift.org/ocp/builder:rhel-9-golang-1.22-openshift-4.18 AS linuxbuilder + +ENV GO_COMPLIANCE_EXCLUDE=".*" + +WORKDIR /go/src/go.etcd.io/etcd +COPY . . +RUN export GOFLAGS='-mod=readonly' && export GO_BUILD_FLAGS='-v' \ + && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 ./build.sh + +FROM registry.ci.openshift.org/ocp/builder:rhel-9-golang-1.22-openshift-4.18 AS linuxarmbuilder + +ENV GO_COMPLIANCE_EXCLUDE=".*" + +WORKDIR /go/src/go.etcd.io/etcd +COPY . . +RUN export GOFLAGS='-mod=readonly' && export GO_BUILD_FLAGS='-v' \ + && CGO_ENABLED=0 GOOS=linux GOARCH=arm64 ./build.sh + +FROM registry.ci.openshift.org/ocp/builder:rhel-9-golang-1.22-openshift-4.18 AS builder +ENV GO_COMPLIANCE_EXCLUDE=".*" + +WORKDIR /go/src/go.etcd.io/etcd +COPY . . +RUN export GOFLAGS='-mod=readonly' && export GO_BUILD_FLAGS='-v' \ + && CGO_ENABLED=0 ./build.sh +RUN mkdir -p /usr/share/openshift/$(go env GOOS)/$(go env GOHOSTARCH) && \ + mv bin/etcd /usr/share/openshift/$(go env GOOS)/$(go env GOHOSTARCH)/ + +# stage 2 +FROM registry.ci.openshift.org/ocp/4.18:base-rhel9 + +RUN yum install --setopt=tsflags=nodocs -y jq && yum clean all && rm -rf /var/cache/yum/* + +COPY --from=macbuilder /go/src/go.etcd.io/etcd/bin/etcd /usr/share/openshift/darwin/amd64/etcd +COPY --from=macarmbuilder /go/src/go.etcd.io/etcd/bin/etcd /usr/share/openshift/darwin/arm64/etcd +COPY --from=linuxbuilder /go/src/go.etcd.io/etcd/bin/etcd /usr/share/openshift/linux/amd64/etcd +COPY --from=linuxarmbuilder /go/src/go.etcd.io/etcd/bin/etcd /usr/share/openshift/linux/arm64/etcd +COPY --from=builder /usr/share/openshift/ /usr/share/openshift/ + +# This image is not an operator, it is only used as part of the build pipeline +LABEL io.openshift.release.operator=false diff --git a/go.mod b/go.mod index 702857ca523..6a49f02183b 100644 --- a/go.mod +++ b/go.mod @@ -95,4 +95,9 @@ require ( gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect sigs.k8s.io/yaml v1.2.0 // indirect + go.etcd.io/gofail v0.2.0 // indirect + github.com/urfave/cli v1.22.4 // indirect + github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect + github.com/russross/blackfriday/v2 v2.0.1 //indirect + github.com/shurcooL/sanitized_anchor_name v1.0.0 //indirect )