From 02bbc8e4f643b78b48d4570bd7cdf0e97f536a3e Mon Sep 17 00:00:00 2001 From: Andrey Lebedev Date: Wed, 3 Jul 2024 11:14:15 +0200 Subject: [PATCH] OCPBUGS-36630: Add hack Makefile target to build CI version of router image --- HACKING.md | 2 +- hack/Makefile.debug | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/HACKING.md b/HACKING.md index 758d0ba58..377324a27 100644 --- a/HACKING.md +++ b/HACKING.md @@ -25,7 +25,7 @@ To test Router changes on an available cluster, utilize `Dockerfile.debug` and `Makefile.debug` in `hack/`. `Dockerfile.debug` is a multi-stage dockerifle for building the Router binary, -as well as the Router image itself. The outputted image uses `centos:8` as it's base +as well as the Router image itself. The outputted image uses `ubi9` as it's base since installing packages on an OpenShift RHEL base image requires RHEL entitlements. `Makefile.debug` contains simple commands for "hot-swapping" the Router image running diff --git a/hack/Makefile.debug b/hack/Makefile.debug index cc48b3fcd..cd6458349 100644 --- a/hack/Makefile.debug +++ b/hack/Makefile.debug @@ -3,7 +3,8 @@ export GOOS=linux REGISTRY ?= quay.io -IMAGE ?= openshift/openshift-router +IMAGE ?= $(USER)/openshift-router +IMAGE_BASE ?= $(USER)/openshift-router-base TAG ?= latest IMAGEBUILDER ?= podman @@ -11,6 +12,12 @@ new-openshift-router-image: GO111MODULE=on CGO_ENABLED=0 GOFLAGS=-mod=vendor go build -o openshift-router -gcflags=all="-N -l" ./cmd/openshift-router $(IMAGEBUILDER) build -t $(IMAGE):$(TAG) -f hack/Dockerfile.debug . +new-ci-router-image: + $(IMAGEBUILDER) build -t $(IMAGE_BASE):$(TAG) -f images/router/base/Dockerfile.ocp . + cp -f images/router/haproxy/Dockerfile.ocp images/router/haproxy/Dockerfile.ocp.debug + sed -i "s|FROM .*|FROM $(IMAGE_BASE):$(TAG)|" images/router/haproxy/Dockerfile.ocp.debug + $(IMAGEBUILDER) build -t $(IMAGE):$(TAG) -f images/router/haproxy/Dockerfile.ocp.debug . + push: $(IMAGEBUILDER) tag $(IMAGE):$(TAG) $(REGISTRY)/$(IMAGE):$(TAG) $(IMAGEBUILDER) push $(REGISTRY)/$(IMAGE):$(TAG)