-
Notifications
You must be signed in to change notification settings - Fork 16
153 lines (146 loc) · 5.48 KB
/
run-e2e-suite.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
on:
workflow_call:
inputs:
MANAGEMENT_CLUSTER_ENVIRONMENT:
description: "The infrastructure to use for the management cluster: eks, kind or isolated-kind"
type: string
required: true
default: "eks"
test_suite:
description: "The test suite to run (i.e. path to it)"
required: true
type: string
test_name:
description: "The display name for the test"
required: true
type: string
artifact_name:
description: "The name for the uploaded artifacts"
required: true
type: string
run_azure_janitor:
description: "Run the Azure janitor after the test to cleanup"
required: false
default: false
type: boolean
run_gcp_janitor:
description: "Run the GCP janitor after the test to cleanup"
required: false
default: true
type: boolean
permissions:
contents: read
packages: write
env:
NGROK_AUTHTOKEN: ${{ secrets.NGROK_AUTHTOKEN }}
NGROK_API_KEY: ${{ secrets.NGROK_API_KEY }}
RANCHER_HOSTNAME: ${{ secrets.NGROK_DOMAIN }}
RANCHER_PASSWORD: ${{ secrets.RANCHER_PASSWORD }}
CAPA_ENCODED_CREDS: ${{ secrets.CAPA_ENCODED_CREDS }}
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
GITHUB_USERNAME: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
AWS_REGION: eu-west-2
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
MANAGEMENT_CLUSTER_ENVIRONMENT: ${{ inputs.MANAGEMENT_CLUSTER_ENVIRONMENT }}
GINKGO_LABEL_FILTER: full
GINKGO_TESTS: ${{ github.workspace }}/${{ inputs.test_suite }}
jobs:
run_e2e_tests:
runs-on: [self-hosted, linux]
steps:
- name: Install eksctl
run: |
ARCH=amd64
PLATFORM=$(uname -s)_$ARCH
curl -sLO "https://github.com/eksctl-io/eksctl/releases/latest/download/eksctl_$PLATFORM.tar.gz"
curl -sL "https://github.com/eksctl-io/eksctl/releases/latest/download/eksctl_checksums.txt" | grep $PLATFORM | sha256sum --check
tar -xzf eksctl_$PLATFORM.tar.gz -C /tmp && rm eksctl_$PLATFORM.tar.gz
sudo mv /tmp/eksctl /usr/local/bin
- name: Install aws-iam-authenticator
run: |
curl -L -o aws-iam-authenticator https://github.com/kubernetes-sigs/aws-iam-authenticator/releases/download/v0.6.14/aws-iam-authenticator_0.6.14_linux_amd64
chmod +x ./aws-iam-authenticator
sudo mv ./aws-iam-authenticator /usr/local/bin
aws-iam-authenticator version
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: setupGo
uses: actions/setup-go@v5.1.0
with:
go-version: "=1.22.0"
- name: Docker login
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Cache Docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Run e2e tests
run: CACHE_DIR=/tmp/.buildx-cache make test-e2e
- name: Collect run artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: artifacts_${{ inputs.artifact_name }}
path: _artifacts
- name: Cleanup Azure Resources
if: ${{ inputs.run_azure_janitor && always() }}
uses: rancher/azure-janitor@v0.1.2
with:
resource-groups: highlander-e2e*
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID}}
client-id: ${{ secrets.AZURE_CLIENT_ID}}
client-secret: ${{ secrets.AZURE_CLIENT_SECRET}}
tenant-id: ${{ secrets.AZURE_TENANT_ID}}
commit: true
- name: Cleanup GCP Resources
if: ${{ inputs.run_gcp_janitor && always() }}
uses: rancher/gcp-janitor@v0.1.0
with:
credentials-json: ${{ secrets.GCP_CREDENTIALS }}
zones: ${{ secrets.GCP_ZONE }}
project-id: ${{ secrets.GCP_PROJECT }}
age-in-hours: 6
resource-label-key: ${{ secrets.GCP_LABEL_KEY }}
resource-label-value: ${{ secrets.GCP_LABEL_VALUE }}
- name: Send failed status to slack
if: failure()
uses: slackapi/slack-github-action@v1.27.0
with:
payload: |
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Rancher turtles E2E test (${{ inputs.test_name }}) run failed. Job trigger by ${{ github.event_name }} event."
},
"accessory": {
"type": "button",
"text": {
"type": "plain_text",
"text": ":github:",
"emoji": true
},
"url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
}
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK