From 6785cd1eb659a4e0adb90a11742ed9eda0e2778d Mon Sep 17 00:00:00 2001 From: nijayf Date: Fri, 6 Sep 2024 13:21:59 +0530 Subject: [PATCH 1/3] Added no cache build --- Makefile | 8 ++++++++ build.sh | 7 ++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 9ed8479..a33984f 100644 --- a/Makefile +++ b/Makefile @@ -46,6 +46,14 @@ podman-push: download-csm-common go-build $(eval include csm-common.mk) sh build.sh --baseubi $(DEFAULT_BASEIMAGE) --goimage $(DEFAULT_GOIMAGE) --push +podman-build-no-cache: download-csm-common go-build + $(eval include csm-common.mk) + sh build.sh --baseubi $(DEFAULT_BASEIMAGE) --goimage $(DEFAULT_GOIMAGE) --no-cache + +podman-no-cachepush: download-csm-common go-build + $(eval include csm-common.mk) + sh build.sh --baseubi $(DEFAULT_BASEIMAGE) --goimage $(DEFAULT_GOIMAGE) --push --no-cache + # # Docker-related tasks # diff --git a/build.sh b/build.sh index 2672fd7..7bf83bb 100644 --- a/build.sh +++ b/build.sh @@ -34,7 +34,7 @@ function build_image { echo ${DEFAULT_GOIMAGE} bash build_ubi_micro.sh ${BASE_UBI_IMAGE} echo $BUILDCMD build -t ${IMAGE_NAME}:${IMAGE_TAG} . - (cd .. && $BUILDCMD build -t ${IMAGE_NAME}:${IMAGE_TAG} --build-arg GOIMAGE=$DEFAULT_GOIMAGE --build-arg GOPROXY=$GOPROXY -f csi-unity/Dockerfile.podman . --format=docker) + (cd .. && $BUILDCMD build ${NOCACHE} -t ${IMAGE_NAME}:${IMAGE_TAG} --build-arg GOIMAGE=$DEFAULT_GOIMAGE --build-arg GOPROXY=$GOPROXY -f csi-unity/Dockerfile.podman . --format=docker) echo $BUILDCMD tag ${IMAGE_NAME}:${IMAGE_TAG} ${IMAGE_REPO}/${IMAGE_REPO_NAMESPACE}/${IMAGE_NAME}:${IMAGE_TAG} $BUILDCMD tag ${IMAGE_NAME}:${IMAGE_TAG} ${IMAGE_REPO}/${IMAGE_REPO_NAMESPACE}/${IMAGE_NAME}:${IMAGE_TAG} } @@ -51,6 +51,7 @@ BIN_NAME=${NAME} IMAGE_REPO=dellemc IMAGE_REPO_NAMESPACE=csi-unity IMAGE_TAG=${IMAGE_TAG:-$(date +%Y%m%d%H%M%S)} +NOCACHE= # Read options for param in $*; do @@ -69,6 +70,10 @@ for param in $*; do shift PUSH_IMAGE='true' ;; + "--no-cache") + shift + NOCACHE='--no-cache' + ;; esac done From b6821d7b086bd24bf934226a5a30d0ba294ff6b1 Mon Sep 17 00:00:00 2001 From: nijayf Date: Wed, 11 Sep 2024 11:59:37 +0530 Subject: [PATCH 2/3] fixed no-cache argument --- build.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build.sh b/build.sh index 7bf83bb..90b2616 100644 --- a/build.sh +++ b/build.sh @@ -33,7 +33,7 @@ function build_image { echo ${BASE_UBI_IMAGE} echo ${DEFAULT_GOIMAGE} bash build_ubi_micro.sh ${BASE_UBI_IMAGE} - echo $BUILDCMD build -t ${IMAGE_NAME}:${IMAGE_TAG} . + echo $BUILDCMD build ${NOCACHE} -t ${IMAGE_NAME}:${IMAGE_TAG} . (cd .. && $BUILDCMD build ${NOCACHE} -t ${IMAGE_NAME}:${IMAGE_TAG} --build-arg GOIMAGE=$DEFAULT_GOIMAGE --build-arg GOPROXY=$GOPROXY -f csi-unity/Dockerfile.podman . --format=docker) echo $BUILDCMD tag ${IMAGE_NAME}:${IMAGE_TAG} ${IMAGE_REPO}/${IMAGE_REPO_NAMESPACE}/${IMAGE_NAME}:${IMAGE_TAG} $BUILDCMD tag ${IMAGE_NAME}:${IMAGE_TAG} ${IMAGE_REPO}/${IMAGE_REPO_NAMESPACE}/${IMAGE_NAME}:${IMAGE_TAG} @@ -71,9 +71,9 @@ for param in $*; do PUSH_IMAGE='true' ;; "--no-cache") - shift - NOCACHE='--no-cache' - ;; + shift + NOCACHE='--no-cache' + ;; esac done From eb68a5bee4a237a41a3093fa0a5f7ba83cd3fecc Mon Sep 17 00:00:00 2001 From: nijayf Date: Tue, 17 Sep 2024 17:35:25 +0530 Subject: [PATCH 3/3] Fixed lint error --- service/controller.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/service/controller.go b/service/controller.go index ff064e7..8a9662a 100644 --- a/service/controller.go +++ b/service/controller.go @@ -205,6 +205,7 @@ func (s *service) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest log.Debug("Filesystem does not exist, proceeding to create new filesystem") // Hardcoded ProtocolNFS to 0 in order to support only NFS + // #nosec G115 resp, err := fileAPI.CreateFilesystem(ctx, volName, storagePool, desc, nasServer, uint64(size), int(tieringPolicy), int(hostIoSize), ProtocolNFS, thin, dataReduction) // Add method to create filesystem if err != nil { @@ -261,6 +262,7 @@ func (s *service) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest } log.Debug("Volume does not exist, proceeding to create new volume") + // #nosec G115 resp, err := volumeAPI.CreateLun(ctx, volName, storagePool, desc, uint64(size), int(tieringPolicy), hostIOLimitID, thin, dataReduction) if err != nil { return nil, status.Error(codes.Unknown, utils.GetMessageWithRunID(rid, "Create Volume %s failed with error: %v", volName, err)) @@ -831,12 +833,14 @@ func (s *service) ControllerExpandVolume(ctx context.Context, req *csi.Controlle } // Idempotency check + // #nosec G115 if filesystem.FileContent.SizeTotal >= uint64(capacity) { log.Infof("New Filesystem size (%d) is lower or same as existing Filesystem size. Ignoring expand volume operation.", filesystem.FileContent.SizeTotal) expandVolumeResp.NodeExpansionRequired = false return expandVolumeResp, nil } + // #nosec G115 err = filesystemAPI.ExpandFilesystem(ctx, volID, uint64(capacity)) if err != nil { return nil, status.Error(codes.Unknown, utils.GetMessageWithRunID(rid, "Expand filesystem failed with error: %v", err))