Skip to content

Commit 111bbfe

Browse files
committed
Test installers (#15)
Signed-off-by: Tamal Saha <tamal@appscode.com>
1 parent 6eb327f commit 111bbfe

File tree

18 files changed

+124
-19
lines changed

18 files changed

+124
-19
lines changed

.github/workflows/ci.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,43 @@ jobs:
4040
run: |
4141
docker login --username ${USERNAME} --password ${DOCKER_TOKEN}
4242
make push
43+
44+
- name: Create Kubernetes cluster
45+
id: kind
46+
uses: engineerd/setup-kind@v0.1.0
47+
with:
48+
config: hack/kubernetes/kind.yaml
49+
50+
- name: Prepare cluster for testing
51+
id: local-path
52+
env:
53+
DOCKER_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
54+
USERNAME: 1gtm
55+
REGISTRY_SECRET: regcred
56+
run: |
57+
export KUBECONFIG="$(kind get kubeconfig-path)"
58+
echo
59+
echo "waiting for nodes to be ready ..."
60+
kubectl wait --for=condition=Ready nodes --all --timeout=5m
61+
kubectl get nodes
62+
echo
63+
echo "installing local-path provisioner ..."
64+
kubectl delete storageclass --all
65+
kubectl apply -f https://github.com/rancher/local-path-provisioner/raw/v0.0.11/deploy/local-path-storage.yaml
66+
kubectl wait --for=condition=Ready pods -n local-path-storage --all --timeout=5m
67+
kubectl apply -f hack/kubernetes/storageclass/standard.yaml
68+
echo
69+
echo "create docker-registry secret"
70+
kubectl create secret docker-registry ${REGISTRY_SECRET} --namespace=kube-system --docker-server=https://index.docker.io/v1/ --docker-username=${USERNAME} --docker-password=${DOCKER_TOKEN}
71+
72+
- name: Install CRDs
73+
run: |
74+
export KUBECONFIG="$(kind get kubeconfig-path)"
75+
kubectl apply -f https://github.com/stashed/stash/raw/master/api/crds/stash.appscode.com_functions.yaml
76+
kubectl apply -f https://github.com/stashed/stash/raw/master/api/crds/stash.appscode.com_tasks.yaml
77+
kubectl wait --for=condition=NamesAccepted crds --all --timeout=5m
78+
79+
- name: Test charts
80+
run: |
81+
export KUBECONFIG="$(kind get kubeconfig-path)"
82+
make ct

Makefile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ TAG_DBG := $(VERSION)-dbg_$(OS)_$(ARCH)
7373

7474
GO_VERSION ?= 1.12.12
7575
BUILD_IMAGE ?= appscode/golang-dev:$(GO_VERSION)-stretch
76+
CHART_TEST_IMAGE ?= quay.io/helmpack/chart-testing:v2.4.0
7677

7778
OUTBIN = bin/$(OS)_$(ARCH)/$(BIN)
7879
ifeq ($(OS),windows)
@@ -265,6 +266,32 @@ unit-tests: $(BUILD_DIRS)
265266
./hack/test.sh $(SRC_DIRS) \
266267
"
267268

269+
.PHONY: ct
270+
ct: $(BUILD_DIRS)
271+
@docker run \
272+
-i \
273+
--rm \
274+
-v $$(pwd):/src \
275+
-w /src \
276+
--net=host \
277+
-v $(HOME)/.kube:/.kube \
278+
-v $(HOME)/.minikube:$(HOME)/.minikube \
279+
-v $(HOME)/.credentials:$(HOME)/.credentials \
280+
-v $$(pwd)/.go/bin/$(OS)_$(ARCH):/go/bin \
281+
-v $$(pwd)/.go/bin/$(OS)_$(ARCH):/go/bin/$(OS)_$(ARCH) \
282+
-v $$(pwd)/.go/cache:/.cache \
283+
--env HTTP_PROXY=$(HTTP_PROXY) \
284+
--env HTTPS_PROXY=$(HTTPS_PROXY) \
285+
--env KUBECONFIG=$(subst $(HOME),,$(KUBECONFIG)) \
286+
$(CHART_TEST_IMAGE) \
287+
/bin/sh -c " \
288+
kubectl -n kube-system create sa tiller; \
289+
kubectl create clusterrolebinding tiller --clusterrole cluster-admin --serviceaccount=kube-system:tiller; \
290+
helm init --service-account tiller; \
291+
kubectl wait --for=condition=Ready pods -n kube-system --all --timeout=5m; \
292+
ct lint-and-install --all; \
293+
"
294+
268295
ADDTL_LINTERS := goconst,gofmt,goimports,unparam
269296

270297
.PHONY: lint
File renamed without changes.

chart/stash-mysql/Chart.yaml renamed to charts/stash-mysql/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
apiVersion: v1
22
description: 'stash-mysql - MySQL database backup and restore plugin for Stash by AppsCode'
33
name: stash-mysql
4-
version: 5.7.25
5-
appVersion: 5.7.25
4+
version: "5.7.25"
5+
appVersion: "5.7.25"
66
home: https://github.com/stashed/mysql
77
icon: https://cdn.appscode.com/images/icon/stash.png
88
sources:
File renamed without changes.

0 commit comments

Comments
 (0)