Skip to content

Commit b0adb11

Browse files
authored
Create downstream container image for konflux (#808)
* Create downstream container image for konflux Signed-off-by: Anand Kumar Singh <[email protected]> * enable hermetic builds and update containerfile labels Signed-off-by: Anand Kumar Singh <[email protected]> * use redhat go-toolset:1.22 image Signed-off-by: Anand Kumar Singh <[email protected]> * enable multiarch Signed-off-by: Anand Kumar Singh <[email protected]> * use only x86_64 for pull request builds Signed-off-by: Anand Kumar Singh <[email protected]> --------- Signed-off-by: Anand Kumar Singh <[email protected]>
1 parent cbdaaad commit b0adb11

File tree

3 files changed

+91
-2
lines changed

3 files changed

+91
-2
lines changed

.tekton/gitops-operator-pull-request.yaml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ metadata:
1818
namespace: rh-openshift-gitops-tenant
1919
spec:
2020
params:
21+
- name: build-platforms
22+
value:
23+
- linux/x86_64
2124
- name: git-url
2225
value: '{{source_url}}'
2326
- name: revision
@@ -27,7 +30,11 @@ spec:
2730
- name: image-expires-after
2831
value: 5d
2932
- name: dockerfile
30-
value: Dockerfile
33+
value: Containerfile.plugin
34+
- name: hermetic
35+
value: true
36+
- name: prefetch-input
37+
value: '{"type": "gomod", "path": "."}'
3138
pipelineSpec:
3239
finally:
3340
- name: show-sbom
@@ -228,6 +235,8 @@ spec:
228235
- $(params.build-args[*])
229236
- name: BUILD_ARGS_FILE
230237
value: $(params.build-args-file)
238+
- name: TARGET_VERSION
239+
value: '{{target_branch}}'
231240
runAfter:
232241
- prefetch-dependencies
233242
taskRef:

.tekton/gitops-operator-push.yaml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,24 @@ metadata:
1717
namespace: rh-openshift-gitops-tenant
1818
spec:
1919
params:
20+
- name: build-platforms
21+
value:
22+
- linux/x86_64
23+
- linux/arm64
24+
- linux/ppc64le
25+
- linux/s390x
2026
- name: git-url
2127
value: '{{source_url}}'
2228
- name: revision
2329
value: '{{revision}}'
2430
- name: output-image
2531
value: quay.io/redhat-user-workloads/rh-openshift-gitops-tenant/openshift-gitops-operator/gitops-operator:{{revision}}
2632
- name: dockerfile
27-
value: Dockerfile
33+
value: Containerfile.plugin
34+
- name: hermetic
35+
value: true
36+
- name: prefetch-input
37+
value: '{"type": "gomod", "path": "."}'
2838
pipelineSpec:
2939
finally:
3040
- name: show-sbom
@@ -220,6 +230,8 @@ spec:
220230
value: $(params.image-expires-after)
221231
- name: COMMIT_SHA
222232
value: $(tasks.clone-repository.results.commit)
233+
- name: TARGET_VERSION
234+
value: '{{target_branch}}'
223235
- name: BUILD_ARGS
224236
value:
225237
- $(params.build-args[*])

Containerfile.plugin

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# Copyright 2021 Red Hat
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
15+
# --
16+
17+
FROM registry.redhat.io/rhel8/go-toolset:1.22.7-5.1731464728 AS builder
18+
19+
ENV LANG=en_US.utf8
20+
ENV GIT_COMMITTER_NAME devtools
21+
ENV GIT_COMMITTER_EMAIL [email protected]
22+
LABEL com.redhat.delivery.appregistry=true
23+
24+
WORKDIR /gitops-operator
25+
26+
COPY go.mod go.mod
27+
COPY go.sum go.sum
28+
# cache deps before building and copying source so that we don't need to re-download as much
29+
# and so that source changes don't invalidate our downloaded layer
30+
RUN go mod download
31+
32+
# Copy the go source
33+
COPY cmd/main.go cmd/main.go
34+
COPY api/ api/
35+
COPY controllers/ controllers/
36+
COPY common/ common/
37+
COPY version/ version/
38+
39+
ARG VERBOSE=2
40+
ENV GOFLAGS="-mod=mod"
41+
RUN go build -o bin/manager ./cmd/main.go
42+
43+
FROM registry.access.redhat.com/ubi8/ubi-minimal
44+
ENV LANG=en_US.utf8
45+
COPY --from=builder /gitops-operator/bin/manager /usr/local/bin/manager
46+
# Redis HA script templates
47+
COPY build/redis /var/lib/redis
48+
USER 10001
49+
ENTRYPOINT [ "/usr/local/bin/manager" ]
50+
51+
LABEL \
52+
name="openshift-gitops-1/gitops-rhel8-operator" \
53+
version=${TARGET_VERSION} \
54+
License="Apache 2.0" \
55+
com.redhat.component="openshift-gitops-operator-container" \
56+
com.redhat.delivery.appregistry="false" \
57+
release=${CI_CONTAINER_RELEASE} \
58+
upstream-version=${CI_UPSTREAM_VERSION} \
59+
upstream-vcs-ref="${COMMIT_SHA}" \
60+
upstream-vcs-type="git" \
61+
summary="Openshift GitOps Operator Dockerfile Template" \
62+
maintainer="William Tam <[email protected]>" \
63+
io.openshift.tags="openshift,gitops-operator" \
64+
io.k8s.display-name="Red Hat OpenShift GitOps Operator" \
65+
io.k8s.description="Red Hat OpenShift GitOps Operator" \
66+
io.openshift.maintainer.product="Red Hat OpenShift GitOps" \
67+
io.openshift.maintainer.component="William Tam <[email protected]>"
68+

0 commit comments

Comments
 (0)