-
Notifications
You must be signed in to change notification settings - Fork 1
89 lines (73 loc) · 2.87 KB
/
e2e-test-gcp-runner.yml
File metadata and controls
89 lines (73 loc) · 2.87 KB
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
name: GCP Runner E2E Tests
on:
schedule:
# Run daily at 6 AM UTC
- cron: "0 6 * * *"
workflow_dispatch:
permissions:
contents: read
defaults:
run:
shell: bash
env:
# GCP Configuration - Override with variables if provided
GCP_PROJECT_ID: ${{ vars.E2E_GCP_PROJECT_ID || 'gitpod-gcp-runner-e2e-tests' }}
GCP_REGION: ${{ vars.E2E_GCP_REGION || 'us-central1' }}
GITPOD_API_ENDPOINT: ${{ vars.E2E_GITPOD_API_ENDPOINT || 'https://app.gitpod.io/api' }}
jobs:
e2e-test:
name: Run E2E Test
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v2
with:
version: 'latest'
- name: Set up Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: "latest"
- name: Configure environment and authentication
run: |
# Set sensitive environment variables for e2e script
echo "GITPOD_TOKEN=${{ secrets.E2E_GITPOD_TOKEN }}" >> $GITHUB_ENV
# Set up service account authentication directly (like dev container)
echo '${{ secrets.E2E_GOOGLE_APPLICATION_CREDENTIALS }}' > /tmp/gcp-sa-key.json
chmod 600 /tmp/gcp-sa-key.json
echo "GOOGLE_APPLICATION_CREDENTIALS=/tmp/gcp-sa-key.json" >> $GITHUB_ENV
- name: Run E2E Test
run: |
echo "Starting GCP Runner E2E test..."
echo "Project: $GCP_PROJECT_ID | Region: $GCP_REGION"
# Run the E2E test script
chmod +x tests/e2e/scripts/e2e-test.sh
./tests/e2e/scripts/e2e-test.sh
- name: Cleanup service account file
if: always()
run: |
# Clean up temporary service account key file
if [[ -f "/tmp/gcp-sa-key.json" ]]; then
rm -f /tmp/gcp-sa-key.json
fi
- name: Slack Notification on Failure
if: failure() && github.ref == 'refs/heads/main'
uses: rtCamp/action-slack-notify@v2.3.3
env:
SLACK_WEBHOOK: ${{ secrets.NEXT_ALERTS_SLACK_WEBHOOK }}
SLACK_ICON_EMOJI: ":gcp:"
SLACK_USERNAME: "GCP Runner E2E Tests"
SLACK_COLOR: "danger"
SLACK_MESSAGE: |
:warning: GCP Runner end-to-end tests have failed
**Details:**
• Project: ${{ env.GCP_PROJECT_ID }}
• Region: ${{ env.GCP_REGION }}
• Workflow: ${{ github.workflow }}
• Commit: ${{ github.sha }}
The test creates a runner via RunnerService API, deploys infrastructure with Terraform, and verifies the runner comes online.
SLACK_FOOTER: "<https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}|View workflow logs>"