-
Notifications
You must be signed in to change notification settings - Fork 0
117 lines (98 loc) · 3.73 KB
/
ci-aspnetcore.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
name: ASP.NET Core chart CI
on:
pull_request:
branches: [main]
paths:
- "charts/aspnetcore/**"
- ".github/workflows/ci-aspnetcore.yml"
jobs:
lint:
name: Lint Helm chart
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Helm
uses: azure/setup-helm@fe7b79cd5ee1e45176fcad797de68ecaf3ca4814 # v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Lint aspnetcore Helm chart
run: helm lint --strict ./charts/aspnetcore/
- name: Validate HELM chart
run: |
helm plugin install https://github.com/melmorabity/helm-kubeconform --version 0.6.7.1
helm kubeconform ./charts/aspnetcore/ --values ./charts/aspnetcore/values.yaml --strict
# Inspired from https://github.com/kedacore/charts/blob/v2.9.4/.github/workflows/ci-core.yml
deploy:
name: Deploy to Kubernetes ${{ matrix.kubernetesVersion }}
runs-on: ubuntu-latest
needs: lint
strategy:
fail-fast: false
matrix:
# Images are defined on every Kind release, see: https://github.com/kubernetes-sigs/kind/releases
kubernetesVersion: [v1.27, v1.28, v1.29, v1.30]
include:
- kubernetesVersion: v1.27
kindImage: kindest/node:v1.27.0@sha256:c6b22e613523b1af67d4bc8a0c38a4c3ea3a2b8fbc5b367ae36345c9cb844518
- kubernetesVersion: v1.28
kindImage: kindest/node:v1.28.0@sha256:b7a4cad12c197af3ba43202d3efe03246b3f0793f162afb40a33c923952d5b31
- kubernetesVersion: v1.29
kindImage: kindest/node:v1.29.0@sha256:eaa1450915475849a73a9227b8f201df25e55e268e5d619312131292e324d570
- kubernetesVersion: v1.30
kindImage: kindest/node:v1.30.0@sha256:446bf1e60d4365b8b37ef832e99a8377cd41178889d86275880667e8034c89d9
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Helm
uses: azure/setup-helm@fe7b79cd5ee1e45176fcad797de68ecaf3ca4814 # v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Create Kubernetes ${{ matrix.kubernetesVersion }} Kind cluster
uses: helm/kind-action@0025e74a8c7512023d06dc019c617aa3cf561fde # v1
with:
node_image: ${{ matrix.kindImage }}
- name: Show Kubernetes version
run: kubectl version
- name: Show Kubernetes nodes
run: kubectl get nodes -o wide
- name: Show Helm version
run: helm version
- name: Generate test values
run: |
cat <<EOF > test-values.yaml
environment: Staging
readinessProbe:
httpGet:
path: "/"
port: http
initialDelaySeconds: 5
periodSeconds: 5
failureThreshold: 3
livenessProbe:
httpGet:
path: "/"
port: http
initialDelaySeconds: 5
periodSeconds: 5
timeoutSeconds: 5
failureThreshold: 3
extraVolumes:
- name: configuration
emptyDir: {}
extraVolumeMounts:
- name: configuration
mountPath: /app/config
EOF
- name: Create test namespace
run: kubectl create namespace test
- name: Template Helm chart
run: helm template aspnetcore ./charts/aspnetcore/ --namespace test --values test-values.yaml --debug
- name: Install Helm chart
run: helm install aspnetcore ./charts/aspnetcore/ --namespace test --values test-values.yaml --debug --wait
- name: Show Kubernetes resources
run: kubectl get all --namespace test
if: always()
- name: Describe test pod
run: kubectl describe pods --namespace test
if: always()