Skip to content

Commit 5c99f62

Browse files
authored
NETOBSERV-2150: add license to downstream container (#768)
* NETOBSERV-2150: add license to downstream container * Fix license and other issues in dockerfile * fix front build * fix go build * Run as non root
1 parent 77aae8d commit 5c99f62

File tree

5 files changed

+25
-62
lines changed

5 files changed

+25
-62
lines changed

.tekton/network-observability-console-plugin-pull-request.yaml

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -26,26 +26,11 @@ spec:
2626
value: quay.io/redhat-user-workloads/ocp-network-observab-tenant/netobserv-operator/network-observability-console-plugin:on-pr-{{revision}}
2727
- name: image-expires-after
2828
value: 5d
29+
- name: build-args-file
30+
value: Dockerfile-args.downstream
2931
- name: dockerfile
3032
value: Dockerfile.downstream
3133
- name: build-platforms
3234
value: ["linux/x86_64"]
3335
pipelineRef:
3436
name: build-pipeline
35-
taskRunTemplate: {}
36-
workspaces:
37-
- name: workspace
38-
volumeClaimTemplate:
39-
metadata:
40-
creationTimestamp: null
41-
spec:
42-
accessModes:
43-
- ReadWriteOnce
44-
resources:
45-
requests:
46-
storage: 1Gi
47-
status: {}
48-
- name: git-auth
49-
secret:
50-
secretName: '{{ git_auth_secret }}'
51-
status: {}

.tekton/network-observability-console-plugin-push.yaml

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -24,24 +24,11 @@ spec:
2424
value: '{{revision}}'
2525
- name: output-image
2626
value: quay.io/redhat-user-workloads/ocp-network-observab-tenant/netobserv-operator/network-observability-console-plugin:{{revision}}
27+
- name: image-expires-after
28+
value: 14d
29+
- name: build-args-file
30+
value: Dockerfile-args.downstream
2731
- name: dockerfile
2832
value: Dockerfile.downstream
2933
pipelineRef:
3034
name: build-pipeline
31-
taskRunTemplate: {}
32-
workspaces:
33-
- name: workspace
34-
volumeClaimTemplate:
35-
metadata:
36-
creationTimestamp: null
37-
spec:
38-
accessModes:
39-
- ReadWriteOnce
40-
resources:
41-
requests:
42-
storage: 1Gi
43-
status: {}
44-
- name: git-auth
45-
secret:
46-
secretName: '{{ git_auth_secret }}'
47-
status: {}

.tekton/pipeline-ref.yaml

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@ spec:
2121
- description: Source Repository URL
2222
name: git-url
2323
type: string
24-
- description: Version to build
25-
name: build-version
26-
type: string
27-
default: "main"
2824
- default: ""
2925
description: Revision of the Source Repository
3026
name: revision
@@ -197,9 +193,6 @@ spec:
197193
- name: BUILD_ARGS
198194
value:
199195
- $(params.build-args[*])
200-
- "COMMIT=$(tasks.clone-repository.results.commit)"
201-
- "BUILDVERSION=$(params.build-version)"
202-
- "DATE=$(tasks.clone-repository.results.commit-timestamp)"
203196
- name: BUILD_ARGS_FILE
204197
value: $(params.build-args-file)
205198
- name: SOURCE_ARTIFACT
@@ -248,9 +241,6 @@ spec:
248241
- name: BUILD_ARGS
249242
value:
250243
- $(params.build-args[*])
251-
- "COMMIT=$(tasks.clone-repository.results.commit)"
252-
- "BUILDVERSION=$(params.build-version)"
253-
- "DATE=$(tasks.clone-repository.results.commit-timestamp)"
254244
- "FRONTBUILD=$(params.output-image)-front"
255245
- name: BUILD_ARGS_FILE
256246
value: $(params.build-args-file)
@@ -332,20 +322,20 @@ spec:
332322
operator: in
333323
values:
334324
- "true"
335-
- name: rpms-signature-scan
325+
- name: deprecated-base-image-check
336326
params:
337-
- name: image-url
327+
- name: IMAGE_URL
338328
value: $(tasks.build-image-index.results.IMAGE_URL)
339-
- name: image-digest
329+
- name: IMAGE_DIGEST
340330
value: $(tasks.build-image-index.results.IMAGE_DIGEST)
341331
runAfter:
342332
- build-image-index
343333
taskRef:
344334
params:
345335
- name: name
346-
value: rpms-signature-scan
336+
value: deprecated-image-check
347337
- name: bundle
348-
value: quay.io/konflux-ci/tekton-catalog/task-rpms-signature-scan:0.2@sha256:e603b3df510aeefeaa12e8778c4642b21743cb0ae68704359dc7ffd2814249d2
338+
value: quay.io/konflux-ci/tekton-catalog/task-deprecated-image-check:0.5@sha256:ced089bd8d86f95ee70f6ee1a6941d677f1c66c3b8f02fa60f9309c6c32e1929
349339
- name: kind
350340
value: task
351341
resolver: bundles
@@ -354,20 +344,20 @@ spec:
354344
operator: in
355345
values:
356346
- "false"
357-
- name: deprecated-base-image-check
347+
- name: rpms-signature-scan
358348
params:
359-
- name: IMAGE_URL
349+
- name: image-url
360350
value: $(tasks.build-image-index.results.IMAGE_URL)
361-
- name: IMAGE_DIGEST
351+
- name: image-digest
362352
value: $(tasks.build-image-index.results.IMAGE_DIGEST)
363353
runAfter:
364354
- build-image-index
365355
taskRef:
366356
params:
367357
- name: name
368-
value: deprecated-image-check
358+
value: rpms-signature-scan
369359
- name: bundle
370-
value: quay.io/konflux-ci/tekton-catalog/task-deprecated-image-check:0.5@sha256:ced089bd8d86f95ee70f6ee1a6941d677f1c66c3b8f02fa60f9309c6c32e1929
360+
value: quay.io/konflux-ci/tekton-catalog/task-rpms-signature-scan:0.2@sha256:e603b3df510aeefeaa12e8778c4642b21743cb0ae68704359dc7ffd2814249d2
371361
- name: kind
372362
value: task
373363
resolver: bundles

Dockerfile-args.downstream

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
BUILDVERSION=1.9.0

Dockerfile.downstream

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,31 @@
1-
ARG COMMIT
1+
ARG BUILDVERSION
22
ARG FRONTBUILD
33

44
FROM $FRONTBUILD as web-builder
55

66
FROM brew.registry.redhat.io/rh-osbs/openshift-golang-builder:v1.23 as go-builder
77

88
ARG BUILDVERSION
9-
ARG DATE
109

1110
WORKDIR /opt/app-root
1211

1312
COPY go.mod go.mod
1413
COPY go.sum go.sum
1514
COPY vendor/ vendor/
16-
COPY .mk/ .mk/
1715
COPY cmd/ cmd/
1816
COPY pkg/ pkg/
1917

2018
ENV GOEXPERIMENT strictfipsruntime
21-
RUN go build -tags strictfipsruntime -ldflags "-X main.buildVersion=$BUILDVERSION -X main.buildDate=$DATE" -mod vendor -o plugin-backend cmd/plugin-backend.go
19+
RUN go build -tags strictfipsruntime -ldflags "-X 'main.buildVersion=$BUILDVERSION' -X 'main.buildDate=`date +%Y-%m-%d\ %H:%M`'" -mod vendor -o plugin-backend cmd/plugin-backend.go
2220

2321
FROM registry.access.redhat.com/ubi9/ubi-minimal:9.5-1739420147
22+
ARG BUILDVERSION
2423

2524
COPY --from=web-builder /opt/app-root/web/dist ./web/dist
2625
COPY --from=go-builder /opt/app-root/plugin-backend ./
26+
COPY LICENSE /licenses/
27+
28+
USER 65532:65532
2729

2830
ENTRYPOINT ["./plugin-backend"]
2931

@@ -34,7 +36,5 @@ LABEL io.k8s.description="Network Observability Console Plugin"
3436
LABEL summary="Network Observability Console Plugin"
3537
LABEL maintainer="[email protected]"
3638
LABEL io.openshift.tags="network-observability-console-plugin"
37-
LABEL upstream-vcs-ref="$COMMIT"
38-
LABEL upstream-vcs-type="git"
39-
LABEL description="Based on Openshift Console dynamic plugin, this plugin implement the console elements for Network Observability."
40-
LABEL version="1.9.0"
39+
LABEL description="Network Observability visualization tool for the OpenShift Console."
40+
LABEL version=$BUILDVERSION

0 commit comments

Comments
 (0)