Skip to content

Commit b4ad00c

Browse files
committed
Addressing konflux error and fixing multi arch build with podman 5.2
1 parent 96729c2 commit b4ad00c

File tree

6 files changed

+28
-59
lines changed

6 files changed

+28
-59
lines changed

.snyk

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Snyk guide: https://docs.snyk.io/snyk-cli/commands/ignore
2+
exclude:
3+
global:
4+
# ignore tests
5+
- "**/*_test.go"
6+
- "test/**"

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

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,11 @@ spec:
9494
description: Skip checks against built image
9595
name: skip-checks
9696
type: string
97-
- default: "false"
97+
- default: "true"
9898
description: Execute the build with network isolation
9999
name: hermetic
100100
type: string
101-
- default: ""
101+
- default: "{\"type\":\"npm\", \"path\":\"./web\"}"
102102
description: Build dependencies to be prefetched by Cachi2
103103
name: prefetch-input
104104
type: string
@@ -203,6 +203,8 @@ spec:
203203
params:
204204
- name: input
205205
value: $(params.prefetch-input)
206+
- name: dev-package-managers
207+
value: true
206208
runAfter:
207209
- clone-repository
208210
- update-downstream
@@ -405,28 +407,6 @@ spec:
405407
operator: in
406408
values:
407409
- "false"
408-
- name: sbom-json-check
409-
params:
410-
- name: IMAGE_URL
411-
value: $(tasks.build-container.results.IMAGE_URL)
412-
- name: IMAGE_DIGEST
413-
value: $(tasks.build-container.results.IMAGE_DIGEST)
414-
runAfter:
415-
- build-container
416-
taskRef:
417-
params:
418-
- name: name
419-
value: sbom-json-check
420-
- name: bundle
421-
value: quay.io/konflux-ci/tekton-catalog/task-sbom-json-check:0.1@sha256:acc9cb8a714f33c0e48d6ca219b6bd0191f09cdd767af4ef3a35d0a5cac53b5d
422-
- name: kind
423-
value: task
424-
resolver: bundles
425-
when:
426-
- input: $(params.skip-checks)
427-
operator: in
428-
values:
429-
- "false"
430410
- name: apply-tags
431411
params:
432412
- name: IMAGE

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

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ metadata:
55
build.appstudio.openshift.io/repo: https://github.com/netobserv/network-observability-console-plugin?rev={{revision}}
66
build.appstudio.redhat.com/commit_sha: '{{revision}}'
77
build.appstudio.redhat.com/target_branch: '{{target_branch}}'
8+
build.appstudio.openshift.io/build-nudge-files: "hack/container_digest.sh"
89
pipelinesascode.tekton.dev/max-keep-runs: "3"
910
pipelinesascode.tekton.dev/on-cel-expression: event == "push" && target_branch
1011
== "main"
@@ -91,11 +92,11 @@ spec:
9192
description: Skip checks against built image
9293
name: skip-checks
9394
type: string
94-
- default: "false"
95+
- default: "true"
9596
description: Execute the build with network isolation
9697
name: hermetic
9798
type: string
98-
- default: ""
99+
- default: "{\"type\":\"npm\", \"path\":\"./web\"}"
99100
description: Build dependencies to be prefetched by Cachi2
100101
name: prefetch-input
101102
type: string
@@ -402,28 +403,6 @@ spec:
402403
operator: in
403404
values:
404405
- "false"
405-
- name: sbom-json-check
406-
params:
407-
- name: IMAGE_URL
408-
value: $(tasks.build-container.results.IMAGE_URL)
409-
- name: IMAGE_DIGEST
410-
value: $(tasks.build-container.results.IMAGE_DIGEST)
411-
runAfter:
412-
- build-container
413-
taskRef:
414-
params:
415-
- name: name
416-
value: sbom-json-check
417-
- name: bundle
418-
value: quay.io/konflux-ci/tekton-catalog/task-sbom-json-check:0.1@sha256:acc9cb8a714f33c0e48d6ca219b6bd0191f09cdd767af4ef3a35d0a5cac53b5d
419-
- name: kind
420-
value: task
421-
resolver: bundles
422-
when:
423-
- input: $(params.skip-checks)
424-
operator: in
425-
values:
426-
- "false"
427406
- name: apply-tags
428407
params:
429408
- name: IMAGE

Dockerfile

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
# We do not use --platform feature to auto fill this ARG because of incompatibility between podman and docker
2-
ARG BUILDSCRIPT=
3-
ARG LDFLAGS=
4-
ARG TARGETPLATFORM=linux/amd64
5-
ARG BUILDPLATFORM=linux/amd64
6-
FROM --platform=$BUILDPLATFORM docker.io/library/node:18-alpine as web-builder
2+
ARG TARGETARCH
3+
FROM docker.io/library/node:18-alpine as web-builder
74

85
USER node
96

@@ -15,7 +12,7 @@ WORKDIR /opt/app-root
1512
COPY --chown=node web/package.json web/package.json
1613
COPY --chown=node web/package-lock.json web/package-lock.json
1714
WORKDIR /opt/app-root/web
18-
RUN npm ci
15+
RUN CYPRESS_INSTALL_BINARY=0 npm ci
1916

2017
WORKDIR /opt/app-root
2118
COPY --chown=node web web
@@ -25,7 +22,7 @@ WORKDIR /opt/app-root/web
2522
RUN npm run format-all
2623
RUN npm run build$BUILDSCRIPT
2724

28-
FROM --platform=$BUILDPLATFORM docker.io/library/golang:1.22 as go-builder
25+
FROM docker.io/library/golang:1.22 as go-builder
2926

3027
ARG TARGETPLATFORM
3128
ARG TARGETARCH=amd64
@@ -41,7 +38,7 @@ COPY pkg/ pkg/
4138

4239
RUN CGO_ENABLED=0 GOARCH=$TARGETARCH go build -ldflags "$LDFLAGS" -mod vendor -o plugin-backend cmd/plugin-backend.go
4340

44-
FROM --platform=$TARGETPLATFORM registry.access.redhat.com/ubi9/ubi-minimal:9.4
41+
FROM --platform=linux/$TARGETARCH registry.access.redhat.com/ubi9/ubi-minimal:9.4
4542

4643
COPY --from=web-builder /opt/app-root/web/dist ./web/dist
4744
COPY --from=go-builder /opt/app-root/plugin-backend ./

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ BUILD_FLAGS ?= -ldflags "${LDFLAGS}"
5959
# build a single arch target provided as argument
6060
define build_target
6161
echo 'building image for arch $(1)'; \
62-
DOCKER_BUILDKIT=1 $(OCI_BIN) buildx build --ulimit nofile=20480:20480 --load --build-arg LDFLAGS="${LDFLAGS}" --build-arg BUILDSCRIPT=${BUILDSCRIPT} --build-arg TARGETPLATFORM=linux/$(1) --build-arg TARGETARCH=$(1) --build-arg BUILDPLATFORM=linux/amd64 ${OCI_BUILD_OPTS} -t ${IMAGE}-$(1) -f Dockerfile .;
62+
DOCKER_BUILDKIT=1 $(OCI_BIN) buildx build --ulimit nofile=20480:20480 --load --build-arg LDFLAGS="${LDFLAGS}" --build-arg BUILDSCRIPT=${BUILDSCRIPT} --build-arg TARGETARCH=$(1) ${OCI_BUILD_OPTS} -t ${IMAGE}-$(1) -f Dockerfile .;
6363
endef
6464

6565
# push a single arch target image
@@ -122,7 +122,7 @@ start: YQ build-backend install-frontend ## Run backend and frontend
122122
$(YQ) '.server.port |= 9002 | .server.metricsPort |= 9003 | .loki.useMocks |= false' ./config/sample-config.yaml > ./config/config.yaml
123123
@echo "### Starting backend on http://localhost:9002"
124124
bash -c "trap 'fuser -k 9002/tcp' EXIT; \
125-
./plugin-backend $(CMDLINE_ARGS) & cd web && npm run start"
125+
./plugin-backend $(CMDLINE_ARGS) & cd web && npm run start"
126126

127127
.PHONY: start-backend
128128
start-backend: YQ build-backend
@@ -159,7 +159,7 @@ fmt-frontend: i18n ## Run frontend i18n and fmt
159159
lint-frontend: ## Lint frontend code
160160
@echo "### Linting frontend code"
161161
cd web && npm run lint
162-
162+
163163
.PHONY: test-frontend
164164
test-frontend: ## Test frontend using jest
165165
@echo "### Testing frontend"

hack/update-build.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,11 @@ LABEL maintainer="[email protected]"
1515
LABEL io.openshift.tags="network-observability-console-plugin"
1616
LABEL upstream-vcs-ref="${COMMIT}"
1717
LABEL upstream-vcs-type="git"
18+
LABEL description="Based on Openshift Console dynamic plugin, this plugin implement the console elements for Network Observability."
1819
EOF
20+
21+
sed -i 's/\(FROM.*\)docker.io\/library\/golang:1.22\(.*\)/\1brew.registry.redhat.io\/rh-osbs\/openshift-golang-builder:v1.22.5-202407301806.g4c8b32d.el9\2/g' ./Dockerfile
22+
sed -i 's/\(FROM.*\)docker.io\/library\/node:18-alpine\(.*\)/\1registry.access.redhat.com\/ubi9\/nodejs-18:1-108.1716477799\2/g' ./Dockerfile
23+
24+
sed -i 's/USER node//g' ./Dockerfile
25+
sed -i 's/--chown=node/--chown=default/g' ./Dockerfile

0 commit comments

Comments
 (0)