Skip to content

Commit

Permalink
Fix multiarch build with new buildah version (#100)
Browse files Browse the repository at this point in the history
  • Loading branch information
OlivierCazade authored Oct 14, 2024
1 parent 6ff0e29 commit 0398f3b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 53 deletions.
24 changes: 1 addition & 23 deletions .tekton/network-observability-cli-container-pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ spec:
description: Skip checks against built image
name: skip-checks
type: string
- default: "false"
- default: "true"
description: Execute the build with network isolation
name: hermetic
type: string
Expand Down Expand Up @@ -405,28 +405,6 @@ spec:
operator: in
values:
- "false"
- name: sbom-json-check
params:
- name: IMAGE_URL
value: $(tasks.build-container.results.IMAGE_URL)
- name: IMAGE_DIGEST
value: $(tasks.build-container.results.IMAGE_DIGEST)
runAfter:
- build-container
taskRef:
params:
- name: name
value: sbom-json-check
- name: bundle
value: quay.io/konflux-ci/tekton-catalog/task-sbom-json-check:0.1@sha256:acc9cb8a714f33c0e48d6ca219b6bd0191f09cdd767af4ef3a35d0a5cac53b5d
- name: kind
value: task
resolver: bundles
when:
- input: $(params.skip-checks)
operator: in
values:
- "false"
- name: apply-tags
params:
- name: IMAGE
Expand Down
24 changes: 1 addition & 23 deletions .tekton/network-observability-cli-container-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ spec:
description: Skip checks against built image
name: skip-checks
type: string
- default: "false"
- default: "true"
description: Execute the build with network isolation
name: hermetic
type: string
Expand Down Expand Up @@ -402,28 +402,6 @@ spec:
operator: in
values:
- "false"
- name: sbom-json-check
params:
- name: IMAGE_URL
value: $(tasks.build-container.results.IMAGE_URL)
- name: IMAGE_DIGEST
value: $(tasks.build-container.results.IMAGE_DIGEST)
runAfter:
- build-container
taskRef:
params:
- name: name
value: sbom-json-check
- name: bundle
value: quay.io/konflux-ci/tekton-catalog/task-sbom-json-check:0.1@sha256:acc9cb8a714f33c0e48d6ca219b6bd0191f09cdd767af4ef3a35d0a5cac53b5d
- name: kind
value: task
resolver: bundles
when:
- input: $(params.skip-checks)
operator: in
values:
- "false"
- name: apply-tags
params:
- name: IMAGE
Expand Down
6 changes: 2 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# We do not use --platform feature to auto fill this ARG because of incompatibility between podman and docker
ARG TARGETPLATFORM=linux/amd64
ARG BUILDPLATFORM=linux/amd64
ARG TARGETARCH=amd64

# Build the manager binary
FROM --platform=$BUILDPLATFORM docker.io/library/golang:1.22 as builder
FROM docker.io/library/golang:1.22 as builder

ARG TARGETARCH
ARG TARGETPLATFORM
Expand Down Expand Up @@ -33,7 +31,7 @@ RUN USER=netobserv VERSION=main make oc-commands
RUN mkdir -p output

# Create final image from ubi + built binary and command
FROM --platform=$TARGETPLATFORM registry.access.redhat.com/ubi9/ubi:9.4
FROM --platform=linux/$TARGETARCH registry.access.redhat.com/ubi9/ubi:9.4
WORKDIR /
COPY --from=builder /opt/app-root/build .
COPY --from=builder --chown=65532:65532 /opt/app-root/output /output
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ MULTIARCH_TARGETS ?= amd64
# In CI, to be replaced by `netobserv`
IMAGE_ORG ?= $(USER)

# Build output
# Build output
NAME := network-observability-cli
DIST_DIR ?= build
FILES_OUTPUT_DIR ?= output
OUTPUT := $(DIST_DIR)/$(NAME)

# Available commands for development with args
COMMANDS = flows packets cleanup
COMMAND_ARGS ?=
COMMAND_ARGS ?=

# Get either oc (favorite) or kubectl paths
K8S_CLI_BIN_PATH = $(shell which oc 2>/dev/null || which kubectl)
Expand All @@ -58,7 +58,7 @@ YQ_VERSION = v4.43.1
# build a single arch target provided as argument
define build_target
echo 'building image for arch $(1)'; \
DOCKER_BUILDKIT=1 $(OCI_BIN) buildx build --load --build-arg TARGETPLATFORM=linux/$(1) --build-arg TARGETARCH=$(1) --build-arg BUILDPLATFORM=linux/amd64 ${OCI_BUILD_OPTS} -t ${IMAGE}-$(1) -f Dockerfile .;
DOCKER_BUILDKIT=1 $(OCI_BIN) buildx build --load --build-arg TARGETARCH=$(1) ${OCI_BUILD_OPTS} -t ${IMAGE}-$(1) -f Dockerfile .;
endef

# push a single arch target image
Expand Down

0 comments on commit 0398f3b

Please sign in to comment.