Skip to content

Commit

Permalink
ci: 👷 use kind instead of minikube
Browse files Browse the repository at this point in the history
  • Loading branch information
this-is-tobi committed Jul 21, 2023
1 parent bd3ec3c commit 78ba440
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 15 deletions.
33 changes: 20 additions & 13 deletions .github/workflows/test-kube.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,21 @@ jobs:
env:
LOCAL_DOMAIN: basegun.kubernetes.local
steps:
- name: Start minikube
uses: medyagh/setup-minikube@latest
- name: Checkout to code
uses: actions/checkout@v3

- name: Create k8s Kind Cluster
uses: helm/[email protected]
with:
addons: registry,ingress
cluster_name: basegun-testing
config: ./infra/kind/kind-config.yml
wait: 60s
verbosity: 2

- name: Set up ingress controller
run: |
helm repo add traefik https://traefik.github.io/charts && helm repo update
helm install --namespace ingress-traefik --create-namespace traefik traefik/traefik --values ./infra/kind/traefik-values.yml
- name: Set up Helm
uses: azure/setup-helm@v3
Expand All @@ -25,22 +36,18 @@ jobs:

- name: Add hosts to /etc/hosts
run: |
MINIKUBE_IP="$(minikube ip)"
sudo echo "$MINIKUBE_IP $LOCAL_DOMAIN" | sudo tee -a /etc/hosts
sudo echo "127.0.0.1 $LOCAL_DOMAIN" | sudo tee -a /etc/hosts
# we are forced to attribute a DNS to kube cluster for it to work properly

- name: Checkout to code
uses: actions/checkout@v3

- name: Build and install basegun with helm, and test if deployment is successful
id: tests
run: |
# use docker env
export SHELL=/bin/bash
eval $(minikube -p minikube docker-env)
TAG=$(make get-current-tag) BUILD_TARGET=test docker-compose -f docker-compose-prod.yml build backend
TAG=$(make get-current-tag) docker-compose -f docker-compose-prod.yml build frontend
kind load docker-image \
basegun-backend:$(make get-current-tag)-prod \
basegun-frontend:$(make get-current-tag)-prod \
--name basegun-testing
helm upgrade --install basegun ./infra/kube/helm/ \
--set ingress.hosts[0].host="$LOCAL_DOMAIN" \
--set ingress.hosts[0].paths[0].path="/" \
Expand Down Expand Up @@ -81,7 +88,7 @@ jobs:
run: npm ci
working-directory: ./frontend

- name: Test end to end
- name: Test end to end (cypress)
run: FRONTEND_HOST=$LOCAL_DOMAIN FRONTEND_PORT=80 npm run test:e2e-ci
working-directory: ./frontend

Expand Down
1 change: 0 additions & 1 deletion frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
"@vue/compat": "^3.3.2",
"@vueuse/core": "^10.1.2",
"axios": "^1.4.0",
"cypress": "^12.13.0",
"pinia": "^2.1.0",
"stylelint-config-recommended-vue": "^1.4.0",
"swiper": "^9.3.2",
Expand Down
18 changes: 18 additions & 0 deletions infra/kind/kind-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
kubeadmConfigPatches:
- |
kind: InitConfiguration
nodeRegistration:
kubeletExtraArgs:
node-labels: "ingress-ready=true"
extraPortMappings:
- containerPort: 30080
hostPort: 80
protocol: TCP
- containerPort: 30443
hostPort: 443
protocol: TCP
19 changes: 19 additions & 0 deletions infra/kind/traefik-values.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
providers:
kubernetesCRD:
namespaces:
- default
- traefik
kubernetesIngress:
namespaces:
- default
- traefik

ports:
web:
nodePort: 30080
websecure:
nodePort: 30443

service:
type: NodePort

0 comments on commit 78ba440

Please sign in to comment.