Skip to content

Commit

Permalink
release tools
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
pohly committed Feb 11, 2019
1 parent 223c84a commit 028b102
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 61 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

#ignore files specific to csi-test
bin/mock
bin/mock-driver
cmd/csi-sanity/csi-sanity
15 changes: 0 additions & 15 deletions .travis.yml

This file was deleted.

1 change: 1 addition & 0 deletions .travis.yml
6 changes: 0 additions & 6 deletions Dockerfile.mock

This file was deleted.

54 changes: 18 additions & 36 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,41 +12,23 @@
# See the License for the specific language governing permissions and
# limitations under the License.

IMAGE_NAME = quay.io/k8scsi/mock-driver
IMAGE_VERSION = canary
APP := ./bin/mock


ifdef V
TESTARGS = -v -args -alsologtostderr -v 5
else
TESTARGS =
endif

all: $(APP)

$(APP):
mkdir -p bin
CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static"' -o $(APP) ./mock/main.go

clean:
rm -rf bin

container: $(APP)
docker build -f Dockerfile.mock -t $(IMAGE_NAME):$(IMAGE_VERSION) .

push: container
docker push $(IMAGE_NAME):$(IMAGE_VERSION)

test: $(APP)
files=$$(find ./ -name '*.go' | grep -v '^./vendor' ); \
if [ $$(gofmt -d $$files | wc -l) -ne 0 ]; then \
echo "formatting errors:"; \
gofmt -d $$files; \
false; \
fi
go vet $$(go list ./... | grep -v vendor)
go test $$(go list ./... | grep -v vendor | grep -v "cmd/csi-sanity")
# This repository builds two commands, mock-driver and csi-sanity,
# but csi-sanity has its own build rules and only mock-driver gets
# published as a container image.
CMDS=mock-driver
all: build build-sanity

include release-tools/build.make

# We have to exclude generic testing of the csi-sanity command because
# the test binary only works in combination with a CSI driver.
# Instead we test with the special ./hack/e2e.sh.
TEST_GO_FILTER_CMD+=| grep -v /cmd/csi-sanity
.PHONY: test-sanity
test: test-sanity
test-sanity:
@ echo; echo "### test-sanity"
./hack/e2e.sh

.PHONY: all clean container push test
build-sanity:
$(MAKE) -C cmd/csi-sanity all
9 changes: 9 additions & 0 deletions cmd/mock-driver/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM alpine
LABEL maintainers="Kubernetes Authors"
LABEL description="CSI Mock Driver"

# For historic reasons the binary is called "mock" inside the container.
# It's kept that way because some .yaml file might use that name instead
# of relying on the entry point.
COPY ./bin/mock-driver mock
ENTRYPOINT ["/mock"]
File renamed without changes.
6 changes: 3 additions & 3 deletions hack/e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ CSI_MOCK_VERSION="master"
# See https://github.com/grpc/grpc/blob/master/doc/naming.md
runTest()
{
CSI_ENDPOINT=$1 ./bin/mock &
CSI_ENDPOINT=$1 ./bin/mock-driver &
local pid=$!

./cmd/csi-sanity/csi-sanity $TESTARGS --csi.endpoint=$2; ret=$?
Expand All @@ -24,7 +24,7 @@ runTest()

runTestWithCreds()
{
CSI_ENDPOINT=$1 CSI_ENABLE_CREDS=true ./bin/mock &
CSI_ENDPOINT=$1 CSI_ENABLE_CREDS=true ./bin/mock-driver &
local pid=$!

./cmd/csi-sanity/csi-sanity $TESTARGS --csi.endpoint=$2 --csi.secrets=mock/mocksecret.yaml; ret=$?
Expand All @@ -37,7 +37,7 @@ runTestWithCreds()

runTestAPI()
{
CSI_ENDPOINT=$1 ./bin/mock &
CSI_ENDPOINT=$1 ./bin/mock-driver &
local pid=$!

GOCACHE=off go test -v ./hack/_apitest/api_test.go; ret=$?
Expand Down

0 comments on commit 028b102

Please sign in to comment.