Skip to content

Commit

Permalink
ROX-24040: Set Podman instead of Docker to fix RHEL8 builders
Browse files Browse the repository at this point in the history
  • Loading branch information
ebensh committed Jun 28, 2024
1 parent f34ff11 commit 0df3ecb
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
10 changes: 8 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,15 @@ WORKDIR /src
RUN go env -w GOCACHE=/go/.cache; \
go env -w GOMODCACHE=/go/pkg/mod

# We previously used --mount=type=bind in the next RUN command
# (see https://docs.docker.com/build/guide/mounts/#add-bind-mounts)
# but this did not work with SELinux volumes and Docker, as only
# Podman supports the relabel=shared option
# (see https://docs.podman.io/en/v4.4/markdown/options/mount.html).
# This adds a layer but works with Docker and Podman.
COPY go.mod go.sum ./

RUN --mount=type=cache,target=/go/pkg/mod/ \
--mount=type=bind,source=go.sum,target=go.sum \
--mount=type=bind,source=go.mod,target=go.mod \
go mod download -x

COPY . ./
Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -497,12 +497,12 @@ docker/login: docker/login/fleet-manager
.PHONY: docker/login

docker/login/fleet-manager:
@docker logout quay.io
$(DOCKER) logout quay.io || true # Swallog podman error if not logged in
@DOCKER_CONFIG=${DOCKER_CONFIG} $(DOCKER) login -u "${QUAY_USER}" --password-stdin <<< "${QUAY_TOKEN}" quay.io
.PHONY: docker/login/fleet-manager

docker/login/probe:
@docker logout quay.io
$(DOCKER) logout quay.io || true # Swallow podman error if not logged in
@DOCKER_CONFIG=${DOCKER_CONFIG} $(DOCKER) login -u "${QUAY_PROBE_USER}" --password-stdin <<< "${QUAY_PROBE_TOKEN}" quay.io
.PHONY: docker/login/probe

Expand Down Expand Up @@ -563,7 +563,7 @@ image/push: image/push/fleet-manager image/push/probe

image/push/fleet-manager: IMAGE_REF="$(external_image_registry)/$(image_repository):$(image_tag)"
image/push/fleet-manager:
DOCKER_CONFIG=${DOCKER_CONFIG} $(DOCKER) buildx build -t $(IMAGE_REF) --platform $(IMAGE_PLATFORM) --push .
DOCKER_CONFIG=${DOCKER_CONFIG} $(DOCKER) buildx build -t $(IMAGE_REF) --platform $(IMAGE_PLATFORM) --output=type=registry .
@echo
@echo "Image was pushed as $(IMAGE_REF). You might want to"
@echo "export FLEET_MANAGER_IMAGE=$(IMAGE_REF)"
Expand All @@ -579,7 +579,7 @@ image/push/probe: image/build/probe
# push the image to the OpenShift internal registry
image/push/internal: IMAGE_TAG ?= $(image_tag)
image/push/internal: docker/login/internal
$(DOCKER) buildx build -t "$(shell oc get route default-route -n openshift-image-registry -o jsonpath="{.spec.host}")/$(NAMESPACE)/$(IMAGE_NAME):$(IMAGE_TAG)" --platform linux/amd64 --push .
$(DOCKER) buildx build -t "$(shell oc get route default-route -n openshift-image-registry -o jsonpath="{.spec.host}")/$(NAMESPACE)/$(IMAGE_NAME):$(IMAGE_TAG)" --platform linux/amd64 --output=type=registry .
.PHONY: image/push/internal

image/build/fleetshard-operator: IMAGE_REF="$(external_image_registry)/fleetshard-operator:$(image_tag)"
Expand Down
7 changes: 7 additions & 0 deletions build_push_app_interface.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ source ./scripts/build_setup.sh
# Push the image:
echo "Quay.io user and token is set, will push images to $IMAGE_REPOSITORY"
make \
DOCKER=podman \
DOCKER_CONFIG="${DOCKER_CONFIG}" \
QUAY_USER="${QUAY_USER}" \
QUAY_TOKEN="${QUAY_TOKEN}" \
Expand All @@ -51,6 +52,7 @@ make \
image/push/fleet-manager

make \
DOCKER=podman \
DOCKER_CONFIG="${DOCKER_CONFIG}" \
QUAY_USER="${QUAY_USER}" \
QUAY_TOKEN="${QUAY_TOKEN}" \
Expand All @@ -62,6 +64,7 @@ make \
image/push/fleet-manager

make \
DOCKER=podman \
DOCKER_CONFIG="${DOCKER_CONFIG}" \
QUAY_PROBE_USER="${QUAY_USER}" \
QUAY_PROBE_TOKEN="${QUAY_TOKEN}" \
Expand All @@ -72,6 +75,7 @@ make \
image/push/probe

make \
DOCKER=podman \
DOCKER_CONFIG="${DOCKER_CONFIG}" \
QUAY_PROBE_USER="${QUAY_USER}" \
QUAY_PROBE_TOKEN="${QUAY_TOKEN}" \
Expand All @@ -83,6 +87,7 @@ make \
image/push/probe

make \
DOCKER=podman \
DOCKER_CONFIG="${DOCKER_CONFIG}" \
QUAY_USER="${QUAY_USER}" \
QUAY_TOKEN="${QUAY_TOKEN}" \
Expand All @@ -93,6 +98,7 @@ make \
image/push/emailsender

make \
DOCKER=podman \
DOCKER_CONFIG="${DOCKER_CONFIG}" \
QUAY_USER="${QUAY_USER}" \
QUAY_TOKEN="${QUAY_TOKEN}" \
Expand All @@ -102,3 +108,4 @@ make \
emailsender_image_repository="${EMAILSENDER_IMAGE_REPOSITORY}" \
docker/login/fleet-manager \
image/push/emailsender

0 comments on commit 0df3ecb

Please sign in to comment.