Skip to content

Commit fff0ef2

Browse files
committed
release tools
This switches building over to the shared csi-sanity-tools, which makes it simpler to keep building in the different repos in sync. For example, this now bumps the Go version to 1.11.1. For this to work, some files must be moved around to match the expected layout.
1 parent 29e630a commit fff0ef2

File tree

6 files changed

+29
-58
lines changed

6 files changed

+29
-58
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11

22
#ignore files specific to csi-test
3-
bin/mock
3+
bin/mock-driver
44
cmd/csi-sanity/csi-sanity

.travis.yml

Lines changed: 0 additions & 15 deletions
This file was deleted.

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
release-tools/travis.yml

Dockerfile.mock

Lines changed: 0 additions & 6 deletions
This file was deleted.

Makefile

Lines changed: 18 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -12,41 +12,23 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
IMAGE_NAME = quay.io/k8scsi/mock-driver
16-
IMAGE_VERSION = canary
17-
APP := ./bin/mock
18-
19-
20-
ifdef V
21-
TESTARGS = -v -args -alsologtostderr -v 5
22-
else
23-
TESTARGS =
24-
endif
25-
26-
all: $(APP)
27-
28-
$(APP):
29-
mkdir -p bin
30-
CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static"' -o $(APP) ./mock/main.go
31-
32-
clean:
33-
rm -rf bin
34-
35-
container: $(APP)
36-
docker build -f Dockerfile.mock -t $(IMAGE_NAME):$(IMAGE_VERSION) .
37-
38-
push: container
39-
docker push $(IMAGE_NAME):$(IMAGE_VERSION)
40-
41-
test: $(APP)
42-
files=$$(find ./ -name '*.go' | grep -v '^./vendor' ); \
43-
if [ $$(gofmt -d $$files | wc -l) -ne 0 ]; then \
44-
echo "formatting errors:"; \
45-
gofmt -d $$files; \
46-
false; \
47-
fi
48-
go vet $$(go list ./... | grep -v vendor)
49-
go test $$(go list ./... | grep -v vendor | grep -v "cmd/csi-sanity")
15+
# This repository builds two commands, mock-driver and csi-sanity,
16+
# but csi-sanity has its own build rules and only mock-driver gets
17+
# published as a container image.
18+
CMDS=mock-driver
19+
all: build build-sanity
20+
21+
include release-tools/build.make
22+
23+
# We have to exclude generic testing of the csi-sanity command because
24+
# the test binary only works in combination with a CSI driver.
25+
# Instead we test with the special ./hack/e2e.sh.
26+
TEST_GO_FILTER_CMD+=| grep -v /cmd/csi-sanity
27+
.PHONY: test-sanity
28+
test: test-sanity
29+
test-sanity:
30+
@ echo; echo "### test-sanity"
5031
./hack/e2e.sh
5132

52-
.PHONY: all clean container push test
33+
build-sanity:
34+
$(MAKE) -C cmd/csi-sanity all

cmd/mock-driver/Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM alpine
2+
LABEL maintainers="Kubernetes Authors"
3+
LABEL description="CSI Mock Driver"
4+
5+
# For historic reasons the binary is called "mock" inside the container.
6+
# It's kept that way because some .yaml file might use that name instead
7+
# of relying on the entry point.
8+
COPY ./bin/mock-driver mock
9+
ENTRYPOINT ["/mock"]
File renamed without changes.

0 commit comments

Comments
 (0)