From bb6d3d20ffe2061ed9e871c47e7d0642cc147e8f Mon Sep 17 00:00:00 2001 From: Saripalli Lavanya Date: Fri, 29 Mar 2024 17:07:56 +0530 Subject: [PATCH] podvm: enhancement for RHEL PodVM image creation This fix streamlines RHEL PodVM image creation via Makefile integration with version.yaml. Signed-off-by: Saripalli Lavanya --- src/cloud-api-adaptor/Makefile | 20 +++++++++++++++++-- src/cloud-api-adaptor/Makefile.defaults | 2 ++ .../podvm/Dockerfile.podvm.rhel | 2 +- src/cloud-api-adaptor/versions.yaml | 3 ++- 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/src/cloud-api-adaptor/Makefile b/src/cloud-api-adaptor/Makefile index 7c564c12e..9a3dbfa9b 100644 --- a/src/cloud-api-adaptor/Makefile +++ b/src/cloud-api-adaptor/Makefile @@ -22,7 +22,7 @@ SOURCES := $(shell find $(SOURCEDIRS) -name '*.go' -print) TEST_E2E_TIMEOUT ?= 60m RESOURCE_CTRL ?= true - +YQ_CHECKSUM_${ARCH} ?= $(YQ_CHECKSUM) # BUILTIN_CLOUD_PROVIDERS is used for binary build -- what providers are built in the binaries. ifeq ($(RELEASE_BUILD),true) BUILTIN_CLOUD_PROVIDERS ?= aws azure ibmcloud vsphere @@ -163,13 +163,27 @@ BINARIES_DOCKERFILE := Dockerfile.podvm_binaries$(DOCKERFILE_SUFFIX) PODVM_DOCKERFILE := Dockerfile.podvm$(DOCKERFILE_SUFFIX) podvm-builder: +ifeq ($(PODVM_DISTRO),rhel) + docker buildx build -t $(PODVM_BUILDER_IMAGE) -f podvm/$(BUILDER_DOCKERFILE) \ + --build-arg GO_VERSION=$(GO_VERSION) \ + --build-arg ORG_ID=$(ORG_ID) \ + --build-arg ARCH=$(ARCH) \ + --build-arg ACTIVATION_KEY=$(ACTIVATION_KEY) \ + --build-arg PACKER_VERSION=$(PACKER_VERSION) \ + --build-arg PROTOC_VERSION=$(PROTOC_VERSION) \ + --build-arg RUST_VERSION=$(RUST_VERSION) \ + --build-arg YQ_VERSION=$(YQ_VERSION) \ + --build-arg YQ_CHECKSUM=${YQ_CHECKSUM_$(ARCH)} \ + $(DOCKER_OPTS) . +else docker buildx build -t $(PODVM_BUILDER_IMAGE) -f podvm/$(BUILDER_DOCKERFILE) \ --build-arg GO_VERSION=$(GO_VERSION) \ --build-arg PROTOC_VERSION=$(PROTOC_VERSION) \ --build-arg RUST_VERSION=$(RUST_VERSION) \ --build-arg YQ_VERSION=$(YQ_VERSION) \ - --build-arg YQ_CHECKSUM=$(YQ_CHECKSUM) \ + --build-arg YQ_CHECKSUM=${YQ_CHECKSUM_$(ARCH)} \ $(DOCKER_OPTS) . +endif podvm-binaries: cp -rf ../../.git .git @@ -190,5 +204,7 @@ podvm-image: --build-arg PODVM_DISTRO=$(PODVM_DISTRO) \ --build-arg ARCH=$(ARCH) \ --build-arg CLOUD_PROVIDER=$(or $(CLOUD_PROVIDER),generic) \ + --build-arg IMAGE_URL=$(IMAGE_URL) \ + --build-arg IMAGE_CHECKSUM=$(IMAGE_CHECKSUM) \ $(DOCKER_OPTS) . rm -rf .git diff --git a/src/cloud-api-adaptor/Makefile.defaults b/src/cloud-api-adaptor/Makefile.defaults index aeb25c228..dff384bdf 100644 --- a/src/cloud-api-adaptor/Makefile.defaults +++ b/src/cloud-api-adaptor/Makefile.defaults @@ -10,6 +10,7 @@ endif # stored in versions.yaml YQ_VERSION := v4.35.1 YQ_CHECKSUM := "sha256:bd695a6513f1196aeda17b174a15e9c351843fb1cef5f9be0af170f2dd744f08" +YQ_CHECKSUM_s390x:= "sha256:4e6324d08630e7df733894a11830412a43703682d65a76f1fc925aac08268a45" MINIMUM_YQ_MAJOR_VERSION := 4 INSTALLED_YQ_MAJOR_VERSION := $(shell $(YQ_COMMAND) --version | sed -nE 's/.* v?([0-9]+).*/\1/p') @@ -51,3 +52,4 @@ PAUSE_REPO := $(or $(PAUSE_REPO),$(call query,oci.pause.registry)) PAUSE_VERSION := $(or $(PAUSE_VERSION),$(call query,oci.pause.tag)) OPA_REPO := $(or $(OPA_REPO),$(call query,git.opa.url)) OPA_VERSION := $(or $(OPA_VERSION),$(call query,git.opa.reference)) +PACKER_VERSION := $(or $(PACKER_VERSION),$(call query,tools.packer)) diff --git a/src/cloud-api-adaptor/podvm/Dockerfile.podvm.rhel b/src/cloud-api-adaptor/podvm/Dockerfile.podvm.rhel index cde63a78f..36ceb10df 100644 --- a/src/cloud-api-adaptor/podvm/Dockerfile.podvm.rhel +++ b/src/cloud-api-adaptor/podvm/Dockerfile.podvm.rhel @@ -24,7 +24,7 @@ ENV PODVM_DISTRO ${PODVM_DISTRO} ENV ARCH ${ARCH} ENV UEFI ${UEFI} -ARG IMAGE_URL="/tmp/rhel.qcow2" +ARG IMAGE_URL ARG IMAGE_CHECKSUM ENV IMAGE_URL ${IMAGE_URL} diff --git a/src/cloud-api-adaptor/versions.yaml b/src/cloud-api-adaptor/versions.yaml index e6eb57e6f..d5de5432a 100644 --- a/src/cloud-api-adaptor/versions.yaml +++ b/src/cloud-api-adaptor/versions.yaml @@ -15,7 +15,7 @@ cloudimg: url: https://access.redhat.com/downloads/content/479/ver=/rhel---9/9.2/x86_64/product-software checksum: "sha256:34ff41b5274692c984e3860b21136af8b6ae502744c6c7578dda82002fba0287" s390x: - url: hhttps://access.redhat.com/downloads/content/433/ver=/rhel---9/9.3%20Beta/s390x/product-software + url: https://access.redhat.com/downloads/content/433/ver=/rhel---9/9.3%20Beta/s390x/product-software checksum: "sha256:d436ffeac7d468f75526ca8b8bab1cba64ba3ab2889ccd11fa107a7323b267db" tools: @@ -23,6 +23,7 @@ tools: golang: 1.21.9 rust: 1.72.0 protoc: 3.15.0 + packer: v1.9.4 # Referenced Git repositories git: guest-components: