-
Notifications
You must be signed in to change notification settings - Fork 29
125 lines (124 loc) · 4.21 KB
/
e2e-branch.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
name: E2E test branch
on:
workflow_call:
secrets:
AZURE_CLIENT_ID:
description: "Azure client ID"
required: true
AZURE_CLIENT_SECRET:
description: "Azure client secret"
required: true
AZURE_SUBSCRIPTION_ID:
description: "Azure subscription ID"
required: true
AZURE_RESOURCE_GROUP:
description: "Azure resource group"
required: true
SLACK_WEBHOOK_URL:
description: "WebHook URL to use for Slack"
required: true
inputs:
branch:
type: string
default: "release-v2.9"
jobs:
e2e-tests:
env:
BRANCH: ${{ inputs.branch }}
REPO: ttl.sh/aks-operator-ci
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: |
${{ env.BRANCH }}
- name: Export tag
id: export_tag
run: |
TAG="v0.0.0"
COMMITDATE=`date -d @$(git log -n1 --format="%at") "+%FT%TZ"`
COMMIT=`git rev-parse HEAD`
COMMIT_SHORT=`git rev-parse --short HEAD`
echo "operator_tag=$TAG" >> $GITHUB_OUTPUT
echo "commit_date=$COMMITDATE" >> $GITHUB_OUTPUT
echo "commit=$COMMIT" >> $GITHUB_OUTPUT
echo "commit_short=$COMMIT_SHORT" >> $GITHUB_OUTPUT
- name: Docker meta
id: meta
uses: docker/metadata-action@369eb591f429131d6889c46b94e711f089e6ca96 # v5.6.1
with:
images: |
${{ env.REPO }}
tags: |
type=raw,value=${{ steps.export_tag.outputs.operator_tag }}-${{ steps.export_tag.outputs.commit_short }}
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0
- name: Build and push image
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6.10.0
with:
context: .
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
target: aks-operator
file: test/e2e/Dockerfile.e2e
build-args: |
TAG=${{ steps.export_tag.outputs.operator_tag }}
COMMITDATE=${{ steps.export_tag.outputs.commit_date }}
COMMIT=${{ steps.export_tag.outputs.commit }}
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: 1.22.x
- uses: helm/kind-action@0025e74a8c7512023d06dc019c617aa3cf561fde # v1.10.0
with:
version: v0.23.0
install_only: true
- name: Create kind cluster
run: make setup-kind
- name: E2E tests
env:
AZURE_CLIENT_ID: "${{ secrets.AZURE_CLIENT_ID }}"
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
AZURE_RESOURCE_GROUP: ${{ secrets.AZURE_RESOURCE_GROUP }}
run: make e2e-tests
- name: Archive artifacts
if: always()
uses: actions/[email protected]
with:
name: ci-artifacts-${{ env.BRANCH }}
path: _artifacts
if-no-files-found: ignore
- name: Send failed status to slack
if: failure() && github.event_name == 'schedule'
uses: slackapi/[email protected]
with:
payload: |
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "AKS Operator E2E test run failed."
},
"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