forked from epinio/epinio
-
Notifications
You must be signed in to change notification settings - Fork 0
176 lines (154 loc) · 5.9 KB
/
aks.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
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
# Copyright © 2021 - 2023 SUSE LLC
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: AKS-CI
on:
pull_request:
branches: [ main ]
types: [ ready_for_review ]
paths:
- 'acceptance/install/scenario6_test.go'
- '.github/workflows/aks.yml'
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
inputs:
keep_cluster:
type: choice
description: "Keep the cluster afterwards?"
required: true
default: 'Delete'
options:
- Delete
- Keep
env:
SETUP_GO_VERSION: '1.20.4'
GOLANGCI_LINT_VERSION: v1.52
GINKGO_NODES: 1
FLAKE_ATTEMPTS: 1
PUBLIC_CLOUD: 1
AKS_RESOURCE_GROUP: ${{ secrets.AKS_RESOURCE_GROUP }}
AKS_MACHINE_TYPE: 'Standard_D3_v2'
# On Windows, github workspace path contains backslashes, we need to have the right quoting for bash export
KUBECONFIG: "'${{ github.workspace }}\\kubeconfig-epinio-ci'"
jobs:
linter:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Setup Go
uses: actions/setup-go@v4
timeout-minutes: 5
with:
cache: false
go-version: ${{ env.SETUP_GO_VERSION }}
- name: Cache Tools
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/tools
key: ${{ runner.os }}-tools
- name: Install Tools
run: make tools-install
- name: Add Tools to PATH
run: |
echo "`pwd`/output/bin" >> $GITHUB_PATH
- name: Lint Epinio
uses: golangci/[email protected]
timeout-minutes: 10
with:
version: ${{ env.GOLANGCI_LINT_VERSION }}
args: --timeout=10m --skip-files docs.go
skip-cache: true
acceptance-scenario6:
needs:
- linter
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v4
timeout-minutes: 5
with:
cache: false
go-version: ${{ env.SETUP_GO_VERSION }}
- name: Setup Ginkgo Test Framework
run: go install github.com/onsi/ginkgo/v2/[email protected]
# The system domain is managed by route53, we need credentials to update
# it to the loadbalancer's IP
- name: Configure AWS credentials for Route53
uses: aws-actions/[email protected]
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.EKS_REGION }}
# Follow https://github.com/marketplace/actions/azure-login#configure-deployment-credentials
# az group create --name ${{ env.AKS_RESOURCE_GROUP }} --location eastus2
# az ad sp create-for-rbac --name ${{ env.AKS_RESOURCE_GROUP }} --sdk-auth --role contributor \
# --scopes /subscriptions/{id}/resourceGroups/${{ env.AKS_RESOURCE_GROUP }}
- name: Login to Azure
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Create AKS cluster
id: create-cluster
# We need to specify bash as a shell when a job is running on windows runner
shell: bash
run: |
id=$RANDOM
echo "ID=$id" >> $GITHUB_OUTPUT
echo "RUN_ID: $id"
az aks create --resource-group ${{ env.AKS_RESOURCE_GROUP }} \
--node-vm-size ${{ env.AKS_MACHINE_TYPE }} \
--name ${{ env.AKS_RESOURCE_GROUP }}$id \
--node-count 2 \
--generate-ssh-keys
az aks get-credentials --resource-group ${{ env.AKS_RESOURCE_GROUP }} \
--name ${{ env.AKS_RESOURCE_GROUP }}$id \
--file ${{ env.KUBECONFIG }}
# List existing clusters
az aks list | jq '.[] | .name + " " + (.powerState|tostring)'
- name: Installation Acceptance Tests
env:
REGEX: Scenario6
REGISTRY_USERNAME: ${{ secrets.CFCIBOT_DOCKERHUB_USERNAME }}
REGISTRY_PASSWORD: ${{ secrets.CFCIBOT_DOCKERHUB_PASSWORD }}
AWS_ZONE_ID: ${{ secrets.AWS_ZONE_ID }}
# Use a random host name, so we don't collide with our workflows on AKS
AKS_DOMAIN: id${{ steps.create-cluster.outputs.ID }}-${{ secrets.AKS_DOMAIN }}
EPINIO_SYSTEM_DOMAIN: id${{ steps.create-cluster.outputs.ID }}-${{ secrets.AKS_DOMAIN }}
EPINIO_TIMEOUT_MULTIPLIER: 3
INGRESS_CONTROLLER: traefik
# EXTRAENV_NAME: SESSION_KEY
# EXTRAENV_VALUE: 12345
shell: bash
run: |
echo "System Domain: $AKS_DOMAIN"
export KUBECONFIG=${{ env.KUBECONFIG }}
make test-acceptance-install
- name: Delete AKS cluster
# We always tear down the cluster, to avoid costs. Except when running
# manually and keep_cluster was set to "Keep"
if: ${{ always() && github.event.inputs.keep_cluster != 'Keep' }}
shell: bash
run: |
export RUN_ID=${{ steps.create-cluster.outputs.ID }}
export RUN_PCP="AKS"
export AWS_ZONE_ID=${{ secrets.AWS_ZONE_ID }}
export AKS_DOMAIN=${{ secrets.AKS_DOMAIN }}
export AKS_RESOURCE_GROUP=${{ env.AKS_RESOURCE_GROUP }}
export KUBECONFIG=${{ env.KUBECONFIG }}
go run acceptance/helpers/delete_clusters/delete_clusters.go