-
Notifications
You must be signed in to change notification settings - Fork 21
111 lines (109 loc) · 3.41 KB
/
test.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
name: E2E Tests
on:
pull_request:
types:
- labeled
- opened
- synchronize
- reopened
branches:
- main
- release-*
paths-ignore:
- 'config/**'
- '**.md'
env:
GO_VERSION: '1.22'
AWS_REGION: us-west-2
AWS_ACCESS_KEY_ID: ${{ secrets.CI_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.CI_AWS_SECRET_ACCESS_KEY }}
AZURE_SUBSCRIPTION_ID: ${{ secrets.CI_AZURE_SUBSCRIPTION_ID }}
AZURE_TENANT_ID: ${{ secrets.CI_AZURE_TENANT_ID }}
AZURE_CLIENT_ID: ${{ secrets.CI_AZURE_CLIENT_ID }}
AZURE_CLIENT_SECRET: ${{ secrets.CI_AZURE_CLIENT_SECRET }}
NAMESPACE: hmc-system
jobs:
e2etest:
if: ${{ contains( github.event.pull_request.labels.*.name, 'test e2e') }}
concurrency:
group: test-e2e-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
name: E2E Tests
runs-on: ubuntu-latest
outputs:
clustername: ${{ steps.vars.outputs.clustername }}
version: ${{ steps.vars.outputs.version }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Set up Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GHCR
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get outputs
id: vars
run: |
echo "version=$(git describe --tags --always)" >> $GITHUB_OUTPUT
echo "clustername=ci-$(date +%s)-e2e-test" >> $GITHUB_OUTPUT
- name: Build and push HMC controller image
uses: docker/build-push-action@v6
with:
build-args: |
LD_FLAGS=-s -w -X github.com/Mirantis/hmc/internal/build.Version=${{ steps.vars.outputs.version }}
context: .
platforms: linux/amd64
tags: |
ghcr.io/mirantis/hmc/controller-ci:${{ steps.vars.outputs.version }}
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Prepare and push HMC template charts
run: |
make hmc-chart-release
REGISTRY_REPO="oci://ghcr.io/mirantis/hmc/charts-ci" make helm-push
- name: Setup kubectl
uses: azure/setup-kubectl@v4
- name: Run E2E tests
env:
MANAGED_CLUSTER_NAME: ${{ steps.vars.outputs.clustername }}
REGISTRY_REPO: 'oci://ghcr.io/mirantis/hmc/charts-ci'
IMG: 'ghcr.io/mirantis/hmc/controller-ci:${{ steps.vars.outputs.version }}'
run: |
make test-e2e
- name: Archive test results
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: test-logs
path: |
test/e2e/*.log
cleanup:
name: Cleanup
needs: e2etest
runs-on: ubuntu-latest
if: ${{ always() && !contains(needs.*.result, 'skipped') }}
timeout-minutes: 15
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: AWS Test Resources
env:
CLUSTER_NAME: '${{ needs.e2etest.outputs.clustername }}'
run: |
make dev-aws-nuke