Skip to content

Commit 73c2ff5

Browse files
committed
Add e2e-release-validation workflow
1 parent feb8e8d commit 73c2ff5

1 file changed

Lines changed: 211 additions & 0 deletions

File tree

Lines changed: 211 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,211 @@
1+
# Copyright (c) Microsoft Corporation.
2+
# Licensed under the MIT License.
3+
#
4+
# E2E Release Validation — GitHub Actions Workflow
5+
6+
7+
name: E2E Release Validation
8+
9+
on:
10+
workflow_dispatch:
11+
inputs:
12+
github_ref:
13+
description: "Git ref to test (branch/tag/SHA)"
14+
required: false
15+
default: "main"
16+
distros:
17+
description: "Comma-separated distros"
18+
required: false
19+
default: "rhel,sles,ubuntu"
20+
workspace_configs:
21+
description: "Workspaces to test (empty = all)"
22+
required: false
23+
type: choice
24+
default: ""
25+
options:
26+
- ""
27+
- "SLE-AFS-AFA-SU-ANGI"
28+
- "RHE-ANF-ISCSI-SU"
29+
- "SLE-AFS-AFA-SU"
30+
- "SLE-ANF-AFA-SO"
31+
test_groups:
32+
description: "Test groups to run (empty = all)"
33+
required: false
34+
type: choice
35+
default: ""
36+
options:
37+
- ""
38+
- "ConfigurationChecks"
39+
- "CentralServicesHighAvailability"
40+
- "DatabaseHighAvailability"
41+
dry_run:
42+
description: "Deploy + discover only, skip tests"
43+
required: false
44+
default: "false"
45+
skip_teardown:
46+
description: "Keep VMs alive after tests (debugging)"
47+
required: false
48+
default: "false"
49+
50+
release:
51+
types: [prereleased, published]
52+
53+
permissions:
54+
contents: read
55+
id-token: write
56+
checks: write
57+
actions: read
58+
59+
concurrency:
60+
group: e2e-validation-${{ github.ref }}
61+
cancel-in-progress: true
62+
63+
env:
64+
# Azure — only 3 secrets needed; everything else loaded from Key Vault
65+
E2E_AZURE_SUBSCRIPTION_ID: ${{ secrets.E2E_AZURE_SUBSCRIPTION_ID }}
66+
E2E_KEY_VAULT_NAME: ${{ secrets.E2E_KEY_VAULT_NAME }}
67+
E2E_AZURE_RESOURCE_GROUP: "rg-sap-qa-e2e-${{ github.run_id }}"
68+
E2E_AZURE_LOCATION: "swedencentral"
69+
70+
# GitHub repo to clone on each deployer VM
71+
E2E_GITHUB_REPO: ${{ github.server_url }}/${{ github.repository }}.git
72+
E2E_GITHUB_REF: ${{ github.event.inputs.github_ref || github.head_ref || github.sha }}
73+
74+
# Test configuration
75+
E2E_DISTROS: ${{ github.event.inputs.distros || 'rhel,sles,ubuntu' }}
76+
E2E_TEST_GROUPS: ${{ github.event.inputs.test_groups || '' }}
77+
E2E_WORKSPACE_CONFIGS: ${{ github.event.inputs.workspace_configs || '' }}
78+
E2E_EXECUTION_MODES: ${{ github.event.inputs.execution_modes || 'local,container' }}
79+
E2E_DRY_RUN: ${{ github.event.inputs.dry_run || 'false' }}
80+
E2E_SKIP_TEARDOWN: ${{ github.event.inputs.skip_teardown || 'false' }}
81+
E2E_VM_SIZE: ${{ github.event.inputs.vm_size || 'Standard_D4s_v5' }}
82+
E2E_AUTHENTICATION_TYPE: ${{ github.event.inputs.authentication_type || 'VMPASSWORD' }}
83+
84+
# Timeouts
85+
E2E_DEPLOY_TIMEOUT: "900"
86+
E2E_TEST_TIMEOUT: "7200"
87+
E2E_HEALTH_RETRIES: "30"
88+
E2E_HEALTH_RETRY_DELAY: "20"
89+
E2E_REPORT_DIR: "e2e/reports"
90+
91+
jobs:
92+
e2e-validation:
93+
name: "E2E Validation"
94+
runs-on: [self-hosted, e2e-runner]
95+
environment: "e2e"
96+
timeout-minutes: 180
97+
98+
steps:
99+
- name: Checkout repository
100+
uses: actions/checkout@v4
101+
with:
102+
ref: ${{ github.event.inputs.github_ref || github.ref }}
103+
104+
- name: Set up Python 3.12
105+
uses: actions/setup-python@v5
106+
with:
107+
python-version: "3.12"
108+
109+
- name: Install E2E test dependencies
110+
run: |
111+
python -m pip install --upgrade pip
112+
pip install -r e2e/requirements.txt
113+
# sshpass is needed for password-based SSH
114+
sudo apt-get update -y && sudo apt-get install -y sshpass
115+
116+
- name: Azure Login (OIDC — uses deployed MSI with federated credential)
117+
uses: azure/login@v2
118+
with:
119+
client-id: ${{ secrets.AZURE_CLIENT_ID }}
120+
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
121+
subscription-id: ${{ secrets.E2E_AZURE_SUBSCRIPTION_ID }}
122+
123+
- name: Verify Azure CLI
124+
run: |
125+
az account show --output table
126+
echo "Subscription: $(az account show --query name -o tsv)"
127+
128+
- name: Load secrets from Key Vault
129+
run: |
130+
echo "Loading secrets from Key Vault: $E2E_KEY_VAULT_NAME"
131+
for secret_name in $(az keyvault secret list \
132+
--vault-name "$E2E_KEY_VAULT_NAME" \
133+
--query "[].name" -o tsv); do
134+
env_name=$(echo "$secret_name" | tr '-' '_' | tr '[:lower:]' '[:upper:]')
135+
value=$(az keyvault secret show \
136+
--vault-name "$E2E_KEY_VAULT_NAME" \
137+
--name "$secret_name" \
138+
--query "value" -o tsv)
139+
echo "::add-mask::$value"
140+
echo "${env_name}=${value}" >> "$GITHUB_ENV"
141+
echo " Loaded: $secret_name -> $env_name"
142+
done
143+
144+
- name: Run E2E validation suite
145+
run: |
146+
echo "=== E2E Release Validation ==="
147+
echo "Ref: $E2E_GITHUB_REF"
148+
echo "Distros: $E2E_DISTROS"
149+
echo "Workspaces: ${E2E_WORKSPACE_CONFIGS:-all}"
150+
echo "Groups: ${E2E_TEST_GROUPS:-all}"
151+
echo "Modes: $E2E_EXECUTION_MODES"
152+
echo "Auth: $E2E_AUTHENTICATION_TYPE"
153+
echo "Dry run: $E2E_DRY_RUN"
154+
echo "==============================="
155+
156+
python -m pytest e2e/tests/ \
157+
--tb=short \
158+
--no-header \
159+
-v \
160+
--timeout=7200 \
161+
--junitxml=e2e/reports/e2e-results.xml \
162+
-o log_cli=true \
163+
-o log_cli_level=INFO \
164+
2>&1 | tee e2e/reports/e2e-output.log
165+
166+
- name: Upload E2E reports
167+
if: always()
168+
uses: actions/upload-artifact@v4
169+
with:
170+
name: e2e-reports-${{ github.run_id }}
171+
path: |
172+
e2e/reports/*.html
173+
e2e/reports/*.xml
174+
e2e/reports/*.log
175+
retention-days: 30
176+
177+
- name: Publish test results
178+
if: always()
179+
uses: EnricoMi/publish-unit-test-result-action@v2
180+
with:
181+
files: e2e/reports/e2e-results.xml
182+
check_name: "E2E Test Results"
183+
comment_mode: "off"
184+
185+
# Safety net: even if pytest teardown fails, clean up
186+
- name: Teardown Azure resources (safety net)
187+
if: always() && env.E2E_SKIP_TEARDOWN != 'true'
188+
run: |
189+
echo "Safety-net teardown of $E2E_AZURE_RESOURCE_GROUP"
190+
az group delete \
191+
--name "$E2E_AZURE_RESOURCE_GROUP" \
192+
--yes --no-wait || true
193+
continue-on-error: true
194+
195+
# ================================================================
196+
# Job 2: Summary notification
197+
# ================================================================
198+
notify:
199+
name: "Notify"
200+
needs: e2e-validation
201+
runs-on: ubuntu-latest
202+
if: always()
203+
204+
steps:
205+
- name: Check result
206+
run: |
207+
if [[ "${{ needs.e2e-validation.result }}" == "success" ]]; then
208+
echo "::notice::E2E validation PASSED for ref ${{ env.E2E_GITHUB_REF }}"
209+
else
210+
echo "::error::E2E validation FAILED for ref ${{ env.E2E_GITHUB_REF }}"
211+
fi

0 commit comments

Comments
 (0)