Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added no cache buildAdded make target to build without cache #229

Merged
merged 4 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To reach --no-cache in the build script it may require some changes, Please check the same.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


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
#
Expand Down
9 changes: 7 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ 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} .
(cd .. && $BUILDCMD build -t ${IMAGE_NAME}:${IMAGE_TAG} --build-arg GOIMAGE=$DEFAULT_GOIMAGE --build-arg GOPROXY=$GOPROXY -f csi-unity/Dockerfile.podman . --format=docker)
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}
}
Expand All @@ -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
Expand All @@ -69,6 +70,10 @@ for param in $*; do
shift
PUSH_IMAGE='true'
;;
"--no-cache")
shift
NOCACHE='--no-cache'
;;
esac
done

Expand Down
4 changes: 4 additions & 0 deletions service/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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))
Expand Down