-
Notifications
You must be signed in to change notification settings - Fork 0
92 lines (76 loc) · 2.52 KB
/
ci-cd.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
name: CI/CD with Minikube and Helm
on:
push:
branches:
- main
jobs:
setup:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Install Kubectl
uses: azure/setup-kubectl@v3
with:
version: 'latest'
- name: Set up Helm
uses: azure/setup-helm@v3
with:
version: 'latest'
- name: Set up Minikube
uses: medyagh/setup-minikube@latest
with:
driver: docker
- name: Start Minikube
run: |
minikube start --driver=docker
minikube status
minikube kubectl -- get nodes
- name: Verify Minikube Status
run: minikube status
- name: Verify kubectl Configuration
run: |
kubectl config view
kubectl config get-contexts
kubectl config use-context minikube || echo "No Minikube context found"
kubectl config current-context
kubectl cluster-info
kubectl get nodes
- name: Wait for Minikube to Be Ready
run: sleep 30
- name: Export Minikube environment variables
run: |
eval $(minikube -p minikube docker-env)
echo "Minikube Docker environment configured"
deploy:
runs-on: ubuntu-latest
needs: setup
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Verify Minikube and Kubernetes Connection
run: |
minikube start
kubectl config use-context minikube || echo "No Minikube context found"
kubectl cluster-info
kubectl get nodes
- name: Install cert-manager
run: |
kubectl apply --validate=false -f https://github.com/cert-manager/cert-manager/releases/download/v1.12.5/cert-manager.crds.yaml
helm repo add jetstack https://charts.jetstack.io
helm repo update
helm install cert-manager jetstack/cert-manager --namespace cert-manager --create-namespace --version v1.12.5
kubectl wait --namespace cert-manager --for=condition=available deployment/cert-manager --timeout=120s
- name: Deploy with Helm
run: |
helm upgrade --install demo ./k8s --wait
helm list
- name: Run Tests
run: |
minikube addons enable ingress
kubectl get all
kubectl get ingress