From 32b6a720687198c3d089dc7c84fa2fff7667c77c Mon Sep 17 00:00:00 2001 From: Eric Young Date: Wed, 5 Feb 2025 09:48:37 -0500 Subject: [PATCH] Modifying image to use csm-base-image (#688) --------- Co-authored-by: Don Khan --- .github/workflows/actions.yml | 8 +++----- Makefile | 29 +++++++++++++---------------- scripts/build-ubi-micro.sh | 23 ----------------------- 3 files changed, 16 insertions(+), 44 deletions(-) delete mode 100755 scripts/build-ubi-micro.sh diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index 222740fb1..2fde0d20b 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -29,14 +29,12 @@ jobs: id: go - name: Checkout the code uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Build Docker Images run: | - chmod +x ./scripts/build-ubi-micro.sh - make build-base-image make -o gen-semver - podman build -t docker.io/csm-operator -f ./Dockerfile --build-arg GOIMAGE=golang:latest --build-arg BASEIMAGE="localhost/csm-operator-ubimicro" - podman save docker.io/library/csm-operator -o /tmp/csm-operator.tar - docker load -i /tmp/csm-operator.tar + DEFAULT_IMG=csm-operator:latest make docker-build - name: Scan controller Image uses: aquasecurity/trivy-action@0.29.0 with: diff --git a/Makefile b/Makefile index 69f521f3b..71288f14f 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,5 @@ include docker.mk - # CHANNELS define the bundle channels used in the bundle. # Add a new line here if you would like to change its default config. (E.g CHANNELS = "candidate,fast,stable") # To re-generate a bundle for other specific channels without changing the standard setup, you can: @@ -114,18 +113,21 @@ build: gen-semver fmt vet ## Build manager binary. run: generate gen-semver fmt vet static-manifests ## Run a controller from your host. go run ./main.go -podman-build: gen-semver build-base-image ## Build podman image with the manager. - podman build . -t ${DEFAULT_IMG} --build-arg BASEIMAGE=$(BASEIMAGE) --build-arg GOIMAGE=$(DEFAULT_GOIMAGE) +podman-build: gen-semver download-csm-common ## Build podman image with the manager. + $(eval include csm-common.mk) + podman build --pull . -t ${DEFAULT_IMG} --build-arg BASEIMAGE=$(CSM_BASEIMAGE) --build-arg GOIMAGE=$(DEFAULT_GOIMAGE) -podman-build-no-cache: gen-semver build-base-image ## Build podman image with the manager. - podman build --no-cache . -t ${DEFAULT_IMG} --build-arg BASEIMAGE=$(BASEIMAGE) --build-arg GOIMAGE=$(DEFAULT_GOIMAGE) +podman-build-no-cache: gen-semver download-csm-common ## Build podman image with the manager. + $(eval include csm-common.mk) + podman build --pull --no-cache . -t ${DEFAULT_IMG} --build-arg BASEIMAGE=$(CSM_BASEIMAGE) --build-arg GOIMAGE=$(DEFAULT_GOIMAGE) podman-push: podman-build ## Builds, tags and pushes docker image with the manager. podman tag ${DEFAULT_IMG} ${IMG} podman push ${IMG} -docker-build: gen-semver build-base-image ## Build docker image with the manager. - docker build . -t ${DEFAULT_IMG} --build-arg BASEIMAGE=$(BASEIMAGE) --build-arg GOIMAGE=$(DEFAULT_GOIMAGE) +docker-build: gen-semver download-csm-common ## Build docker image with the manager. + $(eval include csm-common.mk) + docker build --pull . -t ${DEFAULT_IMG} --build-arg BASEIMAGE=$(CSM_BASEIMAGE) --build-arg GOIMAGE=$(DEFAULT_GOIMAGE) docker-push: docker-build ## Builds, tags and pushes docker image with the manager. docker tag ${DEFAULT_IMG} ${IMG} @@ -204,8 +206,9 @@ bundle: static-manifests gen-semver kustomize ## Generate bundle manifests and m operator-sdk bundle validate ./bundle .PHONY: bundle-build -bundle-build: gen-semver build-base-image ## Build the bundle image. - docker build -f bundle.Dockerfile -t $(BUNDLE_IMG) --build-arg BASEIMAGE=$(BASEIMAGE) . +bundle-build: gen-semver download-csm-common ## Build the bundle image. + $(eval include csm-common.mk) + docker build --pull -f bundle.Dockerfile -t $(BUNDLE_IMG) --build-arg BASEIMAGE=$(CSM_BASEIMAGE) . .PHONY: bundle-push @@ -256,12 +259,6 @@ catalog-push: gen-semver ## Push a catalog image. lint: build golangci-lint run --fix -.PHONY: build-base-image -build-base-image: download-csm-common - $(eval include csm-common.mk) - sh ./scripts/build-ubi-micro.sh $(DEFAULT_BASEIMAGE) - $(eval BASEIMAGE=csm-operator-ubimicro:latest) - # Download common CSM configuration file used for builds .PHONY: download-csm-common download-csm-common: @@ -270,4 +267,4 @@ download-csm-common: # build catalog image with File based catalog file .PHONY: catalog-build-fbc catalog-build-fbc: - podman build . -f catalog.Dockerfile -t quay.io/community-operator-pipeline-prod/dell-csm-operator-catalog:latest + podman build --pull . -f catalog.Dockerfile -t quay.io/community-operator-pipeline-prod/dell-csm-operator-catalog:latest diff --git a/scripts/build-ubi-micro.sh b/scripts/build-ubi-micro.sh deleted file mode 100755 index dfc037544..000000000 --- a/scripts/build-ubi-micro.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh -# Copyright (c) 2024 Dell Inc., or its subsidiaries. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -#!/bin/bash - -microcontainer=$(buildah from $1) -micromount=$(buildah mount $microcontainer) -dnf install --installroot $micromount --releasever=8 --nodocs --setopt install_weak_deps=false --setopt=reposdir=/etc/yum.repos.d/ rpm -y -dnf clean all --installroot $micromount -buildah umount $microcontainer -buildah commit $microcontainer csm-operator-ubimicro \ No newline at end of file