From 27cd222a0e7df548d50809f5fac3c8e511b54e38 Mon Sep 17 00:00:00 2001 From: Don Khan Date: Wed, 22 Jan 2025 12:18:18 -0500 Subject: [PATCH 1/3] Build images with CSM base image. --- Makefile | 16 ++++++++-------- docker.mk | 18 ++++++------------ scripts/build_ubi_micro.sh | 7 ------- 3 files changed, 14 insertions(+), 27 deletions(-) delete mode 100755 scripts/build_ubi_micro.sh diff --git a/Makefile b/Makefile index c677ee5..1140cf3 100644 --- a/Makefile +++ b/Makefile @@ -1,13 +1,13 @@ -include overrides.mk +include overrides.mk -# VERSION defines the project version for the bundle. +# VERSION defines the project version for the bundle. # Update this value when you upgrade the version of your project. # To re-generate a bundle for another specific version without changing the standard setup, you can: # - use the VERSION as arg of the bundle target (e.g make bundle VERSION=0.0.2) # - use environment variables to overwrite this value (e.g export VERSION=0.0.2) VERSION ?= 0.0.1 -# CHANNELS define the bundle channels used in the bundle. +# 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 = "preview,fast,stable") # To re-generate a bundle for other specific channels without changing the standard setup, you can: # - use the CHANNELS as arg of the bundle target (e.g make bundle CHANNELS=preview,fast,stable) @@ -16,7 +16,7 @@ ifneq ($(origin CHANNELS), undefined) BUNDLE_CHANNELS := --channels=$(CHANNELS) endif -# DEFAULT_CHANNEL defines the default channel used in the bundle. +# DEFAULT_CHANNEL defines the default channel used in the bundle. # Add a new line here if you would like to change its default config. (E.g DEFAULT_CHANNEL = "stable") # To re-generate a bundle for any other default channel without changing the default setup, you can: # - use the DEFAULT_CHANNEL as arg of the bundle target (e.g make bundle DEFAULT_CHANNEL=stable) @@ -26,7 +26,7 @@ BUNDLE_DEFAULT_CHANNEL := --default-channel=$(DEFAULT_CHANNEL) endif BUNDLE_METADATA_OPTS ?= $(BUNDLE_CHANNELS) $(BUNDLE_DEFAULT_CHANNEL) -# BUNDLE_IMG defines the image:tag used for the bundle. +# BUNDLE_IMG defines the image:tag used for the bundle. # You can use it as an arg. (E.g make bundle-build BUNDLE_IMG=/:) BUNDLE_IMG ?= controller-bundle:$(VERSION) @@ -80,7 +80,7 @@ test: manifests generate fmt vet ## Run tests. source ${ENVTEST_ASSETS_DIR}/setup-envtest.sh; fetch_envtest_tools $(ENVTEST_ASSETS_DIR); setup_envtest_env $(ENVTEST_ASSETS_DIR); go test ./... -coverprofile cover.out unit-test: - go clean -cache && go test -v -coverprofile=c.out ./controllers/dellcsi* + go clean -cache && go test -v -coverprofile=c.out ./controllers/dellcsi* int-test: ## run int test using gherkin scenarios cd test/integration-test && ./run.sh @@ -106,8 +106,8 @@ check: gosec go vet ./... docker: - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o bin/vg-snapshotter main.go - make -f docker.mk build-base-image docker + CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o bin/vg-snapshotter main.go + make -f docker.mk docker docker-push: docker-build ## Push docker image with the manager. docker push ${IMG} diff --git a/docker.mk b/docker.mk index c709337..1f34317 100644 --- a/docker.mk +++ b/docker.mk @@ -5,22 +5,16 @@ IMAGETAG="v$(MAJOR).$(MINOR).$(PATCH)$(RELNOTE)" endif -docker: - @echo "Base Images is set to: $(BASEIMAGE)" +docker: download-csm-common + $(eval include csm-common.mk) + @echo "Base Images is set to: $(CSM_BASEIMAGE)" @echo "Using Golang Image $(DEFAULT_GOIMAGE)" @echo "Building: $(REGISTRY)/$(IMAGENAME):$(IMAGETAG)" - $(BUILDER) build -t "$(REGISTRY)/$(IMAGENAME):$(IMAGETAG)" --target $(BUILDSTAGE) --build-arg BASEIMAGE=$(BASEIMAGE) --build-arg GOIMAGE=$(DEFAULT_GOIMAGE) . + $(BUILDER) build -t "$(REGISTRY)/$(IMAGENAME):$(IMAGETAG)" --target $(BUILDSTAGE) --build-arg BASEIMAGE=$(CSM_BASEIMAGE) --build-arg GOIMAGE=$(DEFAULT_GOIMAGE) . -push: +push: @echo "Pushing: $(REGISTRY)/$(IMAGENAME):$(IMAGETAG)" $(BUILDER) push "$(REGISTRY)/$(IMAGENAME):$(IMAGETAG)" -build-base-image: download-csm-common - $(eval include csm-common.mk) - @echo "Building base image from $(DEFAULT_BASEIMAGE) and loading dependencies..." - ./scripts/build_ubi_micro.sh $(DEFAULT_BASEIMAGE) - @echo "Base image build: SUCCESS" - $(eval BASEIMAGE=localhost/vgs-ubimicro:latest) - download-csm-common: - curl -O -L https://raw.githubusercontent.com/dell/csm/main/config/csm-common.mk + curl -O -L https://raw.githubusercontent.com/dell/csm/base-image-improvements/config/csm-common.mk diff --git a/scripts/build_ubi_micro.sh b/scripts/build_ubi_micro.sh deleted file mode 100755 index e4cb4a4..0000000 --- a/scripts/build_ubi_micro.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/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 tar gzip -y -dnf clean all --installroot $micromount -buildah umount $microcontainer -buildah commit $microcontainer vgs-ubimicro From 530a230fce25cb913270501f9c96e8bbf2e8e4d2 Mon Sep 17 00:00:00 2001 From: Don Khan Date: Wed, 22 Jan 2025 13:48:53 -0500 Subject: [PATCH 2/3] Point to main branch. --- docker.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker.mk b/docker.mk index 1f34317..4840985 100644 --- a/docker.mk +++ b/docker.mk @@ -17,4 +17,4 @@ push: $(BUILDER) push "$(REGISTRY)/$(IMAGENAME):$(IMAGETAG)" download-csm-common: - curl -O -L https://raw.githubusercontent.com/dell/csm/base-image-improvements/config/csm-common.mk + curl -O -L https://raw.githubusercontent.com/dell/csm/main/config/csm-common.mk From daf640d261d518f1f62420cbaa7e8bbb6a1458a7 Mon Sep 17 00:00:00 2001 From: Don Khan Date: Thu, 23 Jan 2025 09:18:46 -0500 Subject: [PATCH 3/3] Fix linter error, I hope. --- .github/workflows/release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 6e58938..96c29e0 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,7 +1,7 @@ name: Release CSI-VolumegroupSnapshotter # Invocable as a reusable workflow # Can be manually triggered -on: # yamllint disable-line rule:truthy +on: # yamllint disable-line rule:truthy workflow_call: workflow_dispatch: inputs: