Skip to content
Open
Show file tree
Hide file tree
Changes from all 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 .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,19 @@
semver.mk
vars.mk
Dockerfile-debug
go-code-tester*
csm-common.mk
*coverage*.txt

# test directories and artifacts
service/c.out
service/test/
vendor
**/test-data*

# IDE
.idea
.vscode

# gosec
gosec.log
Expand All @@ -26,3 +32,5 @@ gosecresults.csv
# logs
*.log

vendor/

30 changes: 0 additions & 30 deletions .golangci.yaml

This file was deleted.

8 changes: 4 additions & 4 deletions .mockery.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
#
#

quiet: False
all: True
inpackage: False
quiet: false
all: true
inpackage: false
dir: ./pkg
disable-version-string: True
disable-version-string: true
41 changes: 23 additions & 18 deletions docker-files/Dockerfile.ubi.micro → Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#
#
# Copyright © 2023 Dell Inc. or its subsidiaries. All Rights Reserved.
# Copyright © 2023-2025 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.
Expand All @@ -11,30 +9,37 @@
# 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.
#
#

# Dockerfile to build PowerStore CSI Driver
# based on UBI-micro image
# Requires: RHEL host with subscription
# UBI Image: ubi9/ubi-micro:9.2-13
# some arguments that must be supplied
ARG GOIMAGE
ARG BASEIMAGE
ARG VERSION="2.16.0"

FROM $BASEIMAGE
# Stage to build the driver
FROM $GOIMAGE as builder
ARG VERSION

LABEL vendor="Dell Inc." \
RUN mkdir -p /go/src/csi-powerstore
COPY ./ /go/src/csi-powerstore

WORKDIR /go/src/csi-powerstore
RUN make build IMAGE_VERSION=$VERSION && \
rm -rf /go/src/csi-powerstore/vendor

# Stage to build the driver image
FROM $BASEIMAGE
ARG VERSION
WORKDIR /
LABEL vendor="Dell Technologies" \
maintainer="Dell Technologies" \
name="csi-powerstore" \
summary="CSI Driver for Dell EMC PowerStore" \
description="CSI Driver for provisioning persistent storage from Dell EMC PowerStore" \
version="2.8.0" \
release="1.16.0" \
version=$VERSION \
license="Apache-2.0"

COPY licenses /licenses

# validate some cli utilities are found
RUN which mkfs.ext4
RUN which mkfs.xfs
RUN echo "export PATH=$PATH:/sbin:/bin" > /etc/profile.d/ubuntu_path.sh
COPY --from=builder /go/src/csi-powerstore/csi-powerstore /csi-powerstore

COPY "csi-powerstore" .
ENTRYPOINT ["/csi-powerstore"]
122 changes: 41 additions & 81 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,94 +1,54 @@
# Copyright © 2026 Dell Inc. or its subsidiaries. All Rights Reserved.
#
#
# Copyright © 2020-2023 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.
#
#

# for variables override
-include vars.mk

all: clean build

# Dockerfile defines which base image to use [Dockerfile.centos, Dockerfile.ubi, Dockerfile.ubi.min, Dockerfile.ubi.alt]
# e.g.:$ make docker DOCKER_FILE=Dockerfile.ubi.alt
ifndef DOCKER_FILE
DOCKER_FILE = Dockerfile.ubi.micro
endif

# Tag parameters
ifndef MAJOR
MAJOR=2
endif
ifndef MINOR
MINOR=8
endif
ifndef PATCH
PATCH=0
endif
ifndef NOTES
NOTES=
endif
ifndef TAGMSG
TAGMSG="CSI Spec 1.6"
endif
# Dell Technologies, Dell and other trademarks are trademarks of Dell Inc.
# or its subsidiaries. Other trademarks may be trademarks of their respective
# owners.

include images.mk

all: help

# This will be overridden during image build.
IMAGE_VERSION ?= 0.0.0
LDFLAGS = "-X main.ManifestSemver=$(IMAGE_VERSION)"

# Help target, prints usefule information
help:
@echo
@echo "The following targets are commonly used:"
@echo
@echo "build - Builds the code locally"
@echo "check - Runs the suite of code checking tools: lint, format, etc"
@echo "clean - Cleans the local build"
@echo "images - Builds the code within a golang container and then creates the driver image"
@echo "push - Pushes the built container to a target registry"
@echo "unit-test - Runs the unit tests"
@echo "vendor - Downloads a vendor list (local copy) of repositories required to compile the repo."

clean:
rm -f core/core_generated.go
rm -f semver.mk
go clean
rm -f semver.mk core/core_generated.go
rm -rf vendor
rm -f csi-powerstore
go clean -cache

build:
go generate ./cmd/csi-powerstore
GOOS=linux CGO_ENABLED=0 go build ./cmd/csi-powerstore

install:
go generate ./cmd/csi-powerstore
GOOS=linux CGO_ENABLED=0 go install ./cmd/csi-powerstore

# Tags the release with the Tag parameters set above
tag:
-git tag -d v$(MAJOR).$(MINOR).$(PATCH)$(NOTES)
git tag -a -m $(TAGMSG) v$(MAJOR).$(MINOR).$(PATCH)$(NOTES)

# Generates the docker container (but does not push)
docker:
go generate ./cmd/csi-powerstore
go run core/semver/semver.go -f mk >semver.mk
make -f docker.mk DOCKER_FILE=docker-files/$(DOCKER_FILE) docker

# Same as `docker` but without cached layers and will pull latest version of base image
docker-no-cache:
go generate ./cmd/csi-powerstore
go run core/semver/semver.go -f mk >semver.mk
make -f docker.mk DOCKER_FILE=docker-files/$(DOCKER_FILE) docker-no-cache

# Pushes container to the repository
push: docker
make -f docker.mk push

check: gosec
gofmt -w ./.
golint -set_exit_status ./.
go vet ./...
build: generate vendor
GOOS=linux CGO_ENABLED=0 go build -mod=vendor -ldflags $(LDFLAGS) ./cmd/csi-powerstore

mocks:
mockery

unit-test: go-code-tester
GITHUB_OUTPUT=/dev/null \
./go-code-tester 90 "." "" "true" "" "" "./mocks|./v2/core|./tests|./replace"

test:
go clean -cache; cd ./pkg; go test -race -cover -coverprofile=coverage.out -coverpkg ./... ./...
cd ./pkg; go test -race -cover -coverprofile=coverage.out ./...

coverage:
cd ./pkg; go tool cover -html=coverage.out -o coverage.html

gosec:
gosec -quiet -log gosec.log -out=gosecresults.csv -fmt=csv ./...
go-code-tester:
git clone --depth 1 git@github.com:CSM/actions.git temp-repo
cp temp-repo/go-code-tester/entrypoint.sh ./go-code-tester
chmod +x go-code-tester
rm -rf temp-repo
Loading