Refactor for GH Actions
Signed-off-by: Mayank Shah <mayankshah1614@gmail.com>
This commit is contained in:
parent
21db7fafe6
commit
80e19e98e5
37
.github/workflows/e2e.yaml
vendored
Normal file
37
.github/workflows/e2e.yaml
vendored
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
name: E2E Tests
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ master ]
|
||||||
|
pull_request:
|
||||||
|
branches: [ master ]
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
name: E2E Tests
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
REGISTRY: k8s.gcr.io/sig-storage
|
||||||
|
IMAGE_VERSION: ci-build
|
||||||
|
IMAGE_NAME: nfsplugin
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Setup Go 1.x
|
||||||
|
uses: actions/setup-go@v2
|
||||||
|
with:
|
||||||
|
go-version: ^1.13
|
||||||
|
id: go
|
||||||
|
- name: Build image
|
||||||
|
run: |
|
||||||
|
make build
|
||||||
|
docker build -t $REGISTRY/$IMAGE_NAME:$IMAGE_VERSION .
|
||||||
|
- uses: engineerd/setup-kind@v0.4.0
|
||||||
|
name: Setting up KinD cluster
|
||||||
|
with:
|
||||||
|
version: "v0.9.0"
|
||||||
|
- name: Push image to KinD
|
||||||
|
run: |
|
||||||
|
kind load docker-image --name=kind $REGISTRY/$IMAGE_NAME:$IMAGE_VERSION
|
||||||
|
- name: Run E2E Tests
|
||||||
|
run: |
|
||||||
|
make e2e-test
|
||||||
|
|
||||||
31
Makefile
31
Makefile
@ -20,8 +20,7 @@ LDFLAGS ?= "-X ${PKG}/pkg/nfs.driverVersion=${IMAGE_VERSION} -X -s -w -extldflag
|
|||||||
IMAGE_NAME ?= nfsplugin
|
IMAGE_NAME ?= nfsplugin
|
||||||
REGISTRY ?= andyzhangx
|
REGISTRY ?= andyzhangx
|
||||||
IMAGE_TAG = $(REGISTRY)/$(IMAGE_NAME):$(IMAGE_VERSION)
|
IMAGE_TAG = $(REGISTRY)/$(IMAGE_NAME):$(IMAGE_VERSION)
|
||||||
|
GINKGO_FLAGS = -ginkgo.v
|
||||||
|
|
||||||
all: build
|
all: build
|
||||||
|
|
||||||
include release-tools/build.make
|
include release-tools/build.make
|
||||||
@ -57,19 +56,6 @@ local-k8s-uninstall:
|
|||||||
nfs:
|
nfs:
|
||||||
CGO_ENABLED=0 GOOS=linux go build -a -ldflags ${LDFLAGS} -o _output/nfsplugin ./cmd/nfsplugin
|
CGO_ENABLED=0 GOOS=linux go build -a -ldflags ${LDFLAGS} -o _output/nfsplugin ./cmd/nfsplugin
|
||||||
|
|
||||||
.PHONY: nfs-container
|
|
||||||
nfs-container:
|
|
||||||
docker buildx rm container-builder || true
|
|
||||||
docker buildx create --use --name=container-builder
|
|
||||||
ifdef CI
|
|
||||||
make nfs
|
|
||||||
docker buildx build --no-cache --build-arg LDFLAGS=${LDFLAGS} -t $(IMAGE_TAG)-linux-amd64 . --platform="linux/amd64" --push .
|
|
||||||
ifdef PUBLISH
|
|
||||||
docker manifest create $(IMAGE_TAG_LATEST) $(IMAGE_TAG)-linux-amd64
|
|
||||||
docker manifest inspect $(IMAGE_TAG_LATEST)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
.PHONY: install-nfs-server
|
.PHONY: install-nfs-server
|
||||||
install-nfs-server:
|
install-nfs-server:
|
||||||
kubectl apply -f ./examples/kubernetes/nfs-server/nfs-server.yaml
|
kubectl apply -f ./examples/kubernetes/nfs-server/nfs-server.yaml
|
||||||
@ -78,21 +64,16 @@ install-nfs-server:
|
|||||||
install-helm:
|
install-helm:
|
||||||
curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash
|
curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash
|
||||||
|
|
||||||
.PHONY: push
|
|
||||||
push:
|
|
||||||
ifdef CI
|
|
||||||
docker manifest push --purge $(IMAGE_TAG)
|
|
||||||
else
|
|
||||||
docker push $(IMAGE_TAG)
|
|
||||||
endif
|
|
||||||
|
|
||||||
.PHONY: e2e-bootstrap
|
.PHONY: e2e-bootstrap
|
||||||
e2e-bootstrap: install-helm
|
e2e-bootstrap: install-helm
|
||||||
docker pull $(IMAGE_TAG) || make nfs-container push
|
|
||||||
helm install -n csi-driver-nfs ./charts/csi-driver-nfs --namespace kube-system --wait --timeout=15m -v=5 --debug \
|
helm install -n csi-driver-nfs ./charts/csi-driver-nfs --namespace kube-system --wait --timeout=15m -v=5 --debug \
|
||||||
--set image.nfs.repository=$(REGISTRY)/$(IMAGE_NAME) \
|
--set image.nfs.repository=$(REGISTRY)/$(IMAGE_NAME) \
|
||||||
--set image.smb.tag=$(IMAGE_VERSION)
|
--set image.nfs.tag=$(IMAGE_VERSION)
|
||||||
|
|
||||||
.PHONY: e2e-teardown
|
.PHONY: e2e-teardown
|
||||||
e2e-teardown:
|
e2e-teardown:
|
||||||
helm delete csi-driver-nfs --namespace kube-system
|
helm delete csi-driver-nfs --namespace kube-system
|
||||||
|
|
||||||
|
.PHONY: e2e-test
|
||||||
|
e2e-test:
|
||||||
|
go test -v -timeout=0 ./test/e2e ${GINKGO_FLAGS}
|
||||||
@ -28,7 +28,7 @@ var (
|
|||||||
perm *uint32
|
perm *uint32
|
||||||
nfsDriver = nfs.NewNFSdriver(nodeID, "unix:///csi/csi.sock", perm)
|
nfsDriver = nfs.NewNFSdriver(nodeID, "unix:///csi/csi.sock", perm)
|
||||||
defaultStorageClassParameters = map[string]string{
|
defaultStorageClassParameters = map[string]string{
|
||||||
"server": "nfs-server.default.svc.cluster.loca",
|
"server": "nfs-server.default.svc.cluster.local",
|
||||||
"share": "/",
|
"share": "/",
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@ -120,5 +120,5 @@ func execTestCmd(cmds []testCmd) {
|
|||||||
|
|
||||||
func TestE2E(t *testing.T) {
|
func TestE2E(t *testing.T) {
|
||||||
gomega.RegisterFailHandler(ginkgo.Fail)
|
gomega.RegisterFailHandler(ginkgo.Fail)
|
||||||
ginkgo.RunSpecs(t, "E2e Suite")
|
ginkgo.RunSpecs(t, "E2E Suite")
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user