forked from prometheus-operator/prometheus-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
102 lines (101 loc) · 3.15 KB
/
e2e.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
name: e2e
on:
workflow_dispatch:
pull_request:
push:
branches:
- 'release-*'
- 'master'
- 'main'
tags:
- 'v*'
# To cancel running workflow when new commits pushed in a pull request
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
changed-files:
uses: ./.github/workflows/changed-files.yaml
e2e-tests:
name: E2E tests
runs-on: ubuntu-latest
needs: changed-files
if: ${{ needs.changed-files.outputs.non-markdown-files }}
strategy:
matrix:
suite: [alertmanager, prometheus, prometheusAllNS, thanosruler, operatorUpgrade]
include:
- suite: alertmanager
target: test-e2e-alertmanager
- suite: prometheus
target: test-e2e-prometheus
- suite: prometheusAllNS
target: test-e2e-prometheus-all-namespaces
- suite: thanosruler
target: test-e2e-thanos-ruler
- suite: operatorUpgrade
target: test-e2e-operator-upgrade
steps:
- uses: actions/checkout@v4
- name: Import environment variables from file
run: |
cat ".github/env" >> "$GITHUB_ENV"
echo "E2E_DIAGNOSTIC_DIRECTORY=$(mktemp -d)" >> "$GITHUB_ENV"
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: '${{ env.golang-version }}'
check-latest: true
- name: Build images
run: |
export SHELL="/bin/bash"
make build image
- name: Start kind cluster
uses: helm/kind-action@v1.12.0
with:
version: ${{ env.kind-version }}
node_image: ${{ env.kind-image }}
wait: 300s
config: ./test/e2e/kind-conf.yaml
cluster_name: e2e
- name: Wait for cluster to finish bootstraping
run: |
echo "Waiting for all nodes to be ready..."
kubectl wait --for=condition=Ready nodes --all --timeout=120s
kubectl get nodes
echo "Waiting for all pods to be ready..."
kubectl wait --for=condition=Ready pods --all --all-namespaces --timeout=300s
kubectl get pods -A
echo "Cluster information"
kubectl cluster-info
- name: Load images
run: |
make test-e2e-images
kubectl apply -f scripts/kind-rbac.yaml
- name: Run tests
env:
E2E_DIAGNOSTIC_DIRECTORY: ${{ env.E2E_DIAGNOSTIC_DIRECTORY }}
run: |
make ${{ matrix.target }}
- name: Upload diagnostics artifact
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: cluster-state
path: ${{ env.E2E_DIAGNOSTIC_DIRECTORY }}
retention-days: 15
# Added to summarize the matrix and allow easy branch protection rules setup
e2e-tests-result:
name: End-to-End Test Results
if: ${{ needs.changed-files.outputs.non-markdown-files }}
needs:
- changed-files
- e2e-tests
runs-on: ubuntu-latest
steps:
- name: Mark the job as a success
if: needs.e2e-tests.result == 'success'
run: exit 0
- name: Mark the job as a failure
if: needs.e2e-tests.result != 'success'
run: exit 1