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

fix release build #58

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
11 changes: 6 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
GO111MODULE := on
DOCKER_TAG := $(or $(subst .,-,$(subst _,-,$(GIT_TAG_NAME))), latest)
DOCKER_TAG := $(or $(subst _,-,$(GIT_TAG_NAME)), latest)
PR_TAG := $(or $(subst .,-,$(subst _,-,$(GIT_TAG_NAME))), latest)

all: provisioner controller

Expand Down Expand Up @@ -36,13 +37,13 @@ tests:
@minikube docker-env > tests/files/.dockerenv
@sh -c '. ./tests/files/.dockerenv && docker build -t ghcr.io/metal-stack/csi-lvm-provisioner:${DOCKER_TAG} . -f cmd/provisioner/Dockerfile'
@sh -c '. ./tests/files/.dockerenv && docker build -t ghcr.io/metal-stack/csi-lvm-controller:${DOCKER_TAG} . -f cmd/controller/Dockerfile'
@sh -c '. ./tests/files/.dockerenv && docker build -t csi-lvm-tests:${DOCKER_TAG} --build-arg prtag=${DOCKER_TAG} --build-arg prpullpolicy="IfNotPresent" --build-arg prdevicepattern="loop[0-1]" tests' >/dev/null
@sh -c '. ./tests/files/.dockerenv && docker run --rm csi-lvm-tests:${DOCKER_TAG} bats /bats/start.bats /bats/revive.bats /bats/end.bats'
@sh -c '. ./tests/files/.dockerenv && docker build -t csi-lvm-tests:${PR_TAG} --build-arg prtag=${PR_TAG} --build-arg dockertag=${DOCKER_TAG} --build-arg prpullpolicy="IfNotPresent" --build-arg prdevicepattern="loop[0-1]" tests' >/dev/null
@sh -c '. ./tests/files/.dockerenv && docker run --rm csi-lvm-tests:${PR_TAG} bats /bats/start.bats /bats/revive.bats /bats/end.bats'
@rm tests/files/.dockerenv
@rm tests/files/.kubeconfig
@minikube delete

.PHONY: metalci
metalci:
docker build -t csi-lvm-tests:${DOCKER_TAG} --build-arg prtag=${DOCKER_TAG} --build-arg prpullpolicy="Always" --build-arg prdevicepattern='nvme[0-9]n[0-9]' tests > /dev/null
docker run --rm csi-lvm-tests:${DOCKER_TAG} bats /bats/start.bats /bats/cycle.bats /bats/end.bats
docker build -t csi-lvm-tests:${PR_TAG} --build-arg prtag=${PR_TAG} --build-arg dockertag=${DOCKER_TAG} --build-arg prpullpolicy="Always" --build-arg prdevicepattern='nvme[0-1]n[0-9]' tests > /dev/null
docker run --rm csi-lvm-tests:${PR_TAG} bats /bats/start.bats /bats/cycle.bats /bats/end.bats
4 changes: 3 additions & 1 deletion tests/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ FROM alpine
ARG prtag
ENV PRTAG=$prtag

ARG dockertag
ENV DOCKERTAG=$dockertag

ARG prpullpolicy
ENV PRPULLPOLICY=$prpullpolicy

Expand All @@ -20,4 +23,3 @@ RUN apk add --update ca-certificates \

COPY bats /bats
COPY files /files

13 changes: 6 additions & 7 deletions tests/bats/start.bats
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bats -p

@test "prepare test files" {
run sed -i "s/PRTAG/${PRTAG}/g;s/PRPULLPOLICY/${PRPULLPOLICY}/g;s/PRDEVICEPATTERN/${PRDEVICEPATTERN}/g" /files/*
run sed -i "s/PRTAG/${PRTAG}/g;s/PRPULLPOLICY/${PRPULLPOLICY}/g;s/PRDEVICEPATTERN/${PRDEVICEPATTERN}/g;s/DOCKERTAG/${DOCKERTAG}/g" /files/*
[ "$status" -eq 0 ]
}

Expand Down Expand Up @@ -32,21 +32,21 @@
run kubectl apply -f /files/linear.yaml
[ "$status" -eq 0 ]
[ "${lines[0]}" = "pod/volume-test created" ]
}
}

@test "deploy block pod" {
run sleep 30
run kubectl apply -f /files/block.yaml
[ "$status" -eq 0 ]
[ "${lines[0]}" = "pod/volume-test-block created" ]
}
}

@test "linear pvc bound" {
run kubectl wait -n ${PRTAG} --for=condition=ready pod/volume-test --timeout=80s
run kubectl get pvc -n ${PRTAG} lvm-pvc-linear -o jsonpath="{.metadata.name},{.status.phase}"
run kubectl get pvc -n ${PRTAG} lvm-pvc-linear -o jsonpath="{.metadata.name},{.status.phase}"
[ "$status" -eq 0 ]
[ "$output" = "lvm-pvc-linear,Bound" ]
}
}

@test "linear pod running" {
run kubectl get pods -n ${PRTAG} volume-test -o jsonpath="{.metadata.name},{.status.phase}"
Expand All @@ -59,11 +59,10 @@
run kubectl get pvc -n ${PRTAG} lvm-pvc-block -o jsonpath="{.metadata.name},{.status.phase}"
[ "$status" -eq 0 ]
[ "$output" = "lvm-pvc-block,Bound" ]
}
}

@test "block pod running" {
run kubectl get pods -n ${PRTAG} volume-test-block -o jsonpath="{.metadata.name},{.status.phase}"
[ "$status" -eq 0 ]
[ "$output" = "volume-test-block,Running" ]
}

4 changes: 2 additions & 2 deletions tests/files/controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ spec:
serviceAccountName: csi-lvm-controller-PRTAG
containers:
- name: csi-lvm-controller
image: ghcr.io/metal-stack/csi-lvm-controller:PRTAG
image: ghcr.io/metal-stack/csi-lvm-controller:DOCKERTAG
imagePullPolicy: PRPULLPOLICY
command:
- /csi-lvm-controller
Expand All @@ -125,7 +125,7 @@ spec:
- name: CSI_LVM_PULL_POLICY
value: "PRPULLPOLICY"
- name: CSI_LVM_PROVISIONER_IMAGE
value: "ghcr.io/metal-stack/csi-lvm-provisioner:PRTAG"
value: "ghcr.io/metal-stack/csi-lvm-provisioner:DOCKERTAG"
- name: CSI_LVM_DEVICE_PATTERN
value: "/dev/PRDEVICEPATTERN"
- name: PROVISIONER_NAME
Expand Down
2 changes: 1 addition & 1 deletion tests/files/reviver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ spec:
serviceAccountName: csi-lvm-reviver-PRTAG
containers:
- name: csi-lvm-reviver
image: ghcr.io/metal-stack/csi-lvm-provisioner:PRTAG
image: ghcr.io/metal-stack/csi-lvm-provisioner:DOCKERTAG
imagePullPolicy: PRPULLPOLICY
securityContext:
privileged: true
Expand Down