-
Notifications
You must be signed in to change notification settings - Fork 7
199 lines (179 loc) · 6.74 KB
/
ci.yaml
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
---
name: ci
on:
pull_request:
push:
branches:
- 'release/**'
jobs:
yamllint:
uses: networkservicemesh/.github/.github/workflows/yamllint.yaml@main
shellcheck:
uses: networkservicemesh/.github/.github/workflows/shellcheck.yaml@main
golangci-lint:
uses: networkservicemesh/.github/.github/workflows/golangci-lint.yaml@main
exclude-fmt-errorf:
uses: networkservicemesh/.github/.github/workflows/exclude-fmt-errorf.yaml@main
checkgomod:
uses: networkservicemesh/.github/.github/workflows/checkgomod.yaml@main
# azure:
# environment: AKS
# name: Azure Kubernetes Service
# runs-on: ubuntu-latest
# steps:
# - name: Install azure-cli
# uses: azure/CLI@v1
# with:
# inlineScript: |
# az version
# - name: Set up azure permissions
# run: |
# sudo chmod -R 777 ~/.azure
# - name: Set up /bin permissions
# run: |
# sudo chmod -R 777 /bin
# - name: Set up go
# uses: actions/setup-go@v5
# with:
# go-version: 1.20.5
# - name: Checkout files
# uses: actions/checkout@v4
# with:
# path: ${{ github.repository }}
# - name: Setup AKS cluster
# working-directory: ${{ github.repository }}
# run: |
# az login --service-principal --username ${AZURE_SERVICE_PRINCIPAL} --password ${AZURE_SERVICE_PRINCIPAL_SECRET} --tenant ${AZURE_TENANT}
# az aks create \
# --resource-group "$AZURE_RESOURCE_GROUP" \
# --name "$AZURE_CLUSTER_NAME" \
# --node-count 2 \
# --node-vm-size Standard_B2ms \
# --generate-ssh-keys \
# --debug
# az aks wait \
# --name "$AZURE_CLUSTER_NAME" \
# --resource-group "$AZURE_RESOURCE_GROUP" \
# --created > /dev/null
# az aks get-credentials \
# --name "$AZURE_CLUSTER_NAME" \
# --resource-group "$AZURE_RESOURCE_GROUP" \
# --file "/tmp/config" \
# --overwrite-existing
# env:
# AZURE_SERVICE_PRINCIPAL: ${{ secrets.AZURE_SERVICE_PRINCIPAL }}
# AZURE_SERVICE_PRINCIPAL_SECRET: ${{ secrets.AZURE_SERVICE_PRINCIPAL_SECRET }}
# AZURE_TENANT: ${{ secrets.AZURE_TENANT }}
# AZURE_CLUSTER_NAME: aks-${{ github.run_id }}-${{ github.run_number }}
# AZURE_RESOURCE_GROUP: nsm-ci
# - name: Run tests
# working-directory: ${{ github.repository }}
# run: |
# go test -count 1 -timeout 1h55m -race -v ./... -parallel 4
# env:
# KUBECONFIG: /tmp/config
# - name: Cleanup AKS cluster
# if: ${{ always() }}
# working-directory: ${{ github.repository }}
# run: |
# az aks delete \
# --name "$AZURE_CLUSTER_NAME" \
# --resource-group "$AZURE_RESOURCE_GROUP" \
# --yes
# env:
# AZURE_CLUSTER_NAME: aks-${{ github.run_id }}-${{ github.run_number }}
# AZURE_RESOURCE_GROUP: nsm-ci
# - name: Upload logs
# uses: actions/upload-artifact@v4
# if: ${{ always() }}
# with:
# name: logs-${{ github.run_number }}
# path: ${{ github.repository }}/logs
azure-tanzu:
# needs: azure
# environment: Azure Tanzu
name: Azure Tanzu
runs-on: ubuntu-latest
# env:
# AZURE_CLIENT_ID: ${{ secrets.AZURE_SERVICE_PRINCIPAL }}
# AZURE_CLIENT_SECRET: ${{ secrets.AZURE_SERVICE_PRINCIPAL_SECRET }}
# AZURE_TENANT: ${{ secrets.AZURE_TENANT }}
# AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
# AZURE_SSH_PUBLIC_KEY_B64: ${{ secrets.AZURE_SSH_PUBLIC_KEY_B64}}
# AZURE_RESOURCE_GROUP: nsm-ci
steps:
- name: Checkout files
uses: actions/checkout@v4
# - name: Install kind
# uses: engineerd/setup-kind@v0.5.0
# with:
# config: ${{ github.repository }}/kind-cluster-config.yaml
# version: v0.20.0
# image: kindest/node:v1.28.0
# - name: Check kind
# run: |
# kubectl version
# kubectl get pods -n kube-system
# - name: Install clusterctl
# run: |
# curl -L https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.6.2/clusterctl-linux-amd64 -o clusterctl
# chmod +x ./clusterctl
# mv ./clusterctl /usr/local/bin/clusterctl
# clusterctl version
# - name: Install azure-cli
# uses: azure/CLI@v1
# with:
# inlineScript: |
# az version
# - name: Set up azure permissions
# run: |
# sudo chmod -R 777 ~/.azure
# - name: Set up /bin permissions
# run: |
# sudo chmod -R 777 /bin
# - name: Set up go
# uses: actions/setup-go@v5
# with:
# go-version: 1.20.5
- name: Install Tanzu
run: |
TANZU_VERSION=v0.25.4
TANZU_HOME=$HOME/tanzu
curl -Lo tanzu-framework.tar.gz https://github.com/vmware-tanzu/tanzu-framework/releases/download/v0.25.4/tanzu-framework-linux-amd64.tar.gz
mkdir $TANZU_HOME
tar -xzf tanzu-framework.tar.gz -C ${TANZU_HOME}
mv ${TANZU_HOME}/cli/core/${TANZU_VERSION}/tanzu-core-linux_amd64 /usr/local/bin/tanzu
chmod +x /usr/local/bin/tanzu
tanzu init
- uses: danielr1996/envsubst-action@1.0.0
with:
input: management-cluster.yaml
output: management-cluster.yaml
- name: Setup AKS management cluster
run: |
cat management-cluster.yaml
tanzu management-cluster create -f management-cluster.yaml --yes
kubectl config use-context nsm-tanzu-mg-admin@nsm-tanzu-mg
- name: Setup AKS worker cluster
run: |
envsubst < worker-cluster.yaml > worker-cluster.yaml
tanzu cluster create --file worker-cluster.yaml
tanzu cluster kubeconfig get nsm-tanzu-worker --admin
kubectl config use-context nsm-tanzu-worker-admin@nsm-tanzu-worker
# - name: Run integration tests
# run: |
# go test -run TestRunMemorySuite -count 1 -timeout 1h -race -v -parallel 4 -gotestmd.t 10m
# - name: Delete NSM tanzu workload cluster
# if: ${{ always() }}
# run: |
# tanzu cluster delete nsm-tanzu-worker
# - name: Delete NSM tanzu management cluster
# if: ${{ always() }}
# run: |
# tanzu management-cluster delete nsm-tanzu-mg
# - name: Upload logs
# uses: actions/upload-artifact@v4
# if: ${{ always() }}
# with:
# name: tanzu-logs-${{ github.run_number }}
# path: ${{ github.repository }}/logs