Skip to content

Commit 77e4d56

Browse files
committed
Refactor e2e-deployment: separate check job from execution
- Added check-e2e-needed job to determine if E2E should run - Moved path filtering logic to dedicated job - Main e2e-deployment job now depends on check job with needs/if - Removed all step-level conditionals (cleaner workflow) - Added environment: enclave-ci to e2e-deployment job - Updated to use secrets context for environment variables - Kept deployment mode conditional for mirror registry step
1 parent e8de04b commit 77e4d56

1 file changed

Lines changed: 39 additions & 36 deletions

File tree

.github/workflows/e2e-deployment.yml

Lines changed: 39 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -45,27 +45,18 @@ concurrency:
4545
cancel-in-progress: false
4646

4747
jobs:
48-
e2e-deployment:
49-
name: E2E Deployment Test
50-
runs-on: [self-hosted, enclave-large]
51-
timeout-minutes: 180 # 3 hours
52-
53-
env:
54-
DEV_SCRIPTS_PATH: ${{ vars.DEV_SCRIPTS_PATH }}
55-
WORKING_DIR: ${{ vars.WORKING_DIR }}
56-
PULL_SECRET: ${{ secrets.PULL_SECRET }}
57-
# Use manual input if available, otherwise default to 'connected' for PR runs
58-
ENCLAVE_DEPLOYMENT_MODE: ${{ github.event.inputs.deployment_mode || 'connected' }}
59-
# Use manual input if available, otherwise default to 'true' for PR runs
60-
CLEANUP_AFTER: ${{ github.event.inputs.cleanup_after || 'true' }}
61-
# Bypass CI_TOKEN requirement (we only use dev-scripts for infra, not cluster install)
62-
OPENSHIFT_CI: "true"
48+
check-e2e-needed:
49+
name: Check if E2E should run
50+
runs-on: [self-hosted, enclave-small]
51+
timeout-minutes: 5
52+
outputs:
53+
should_run: ${{ steps.decision.outputs.should_run }}
6354

6455
steps:
6556
- name: Checkout code
6657
uses: actions/checkout@v4
6758

68-
- name: Check if E2E should run
59+
- name: Check if E2E-relevant files changed
6960
uses: dorny/paths-filter@v3
7061
id: filter
7162
with:
@@ -89,20 +80,44 @@ jobs:
8980
- 'validations.sh'
9081
- 'setup_*.sh'
9182
92-
- name: Report E2E decision
83+
- name: Make decision
84+
id: decision
9385
run: |
9486
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
95-
echo "▶️ Manual trigger - E2E will run"
87+
echo "should_run=true" >> $GITHUB_OUTPUT
88+
echo "▶️ Manual trigger - E2E will run" | tee -a $GITHUB_STEP_SUMMARY
9689
elif [[ "${{ steps.filter.outputs.e2e }}" == "true" ]]; then
97-
echo "✓ E2E-relevant files changed - E2E will run"
90+
echo "should_run=true" >> $GITHUB_OUTPUT
91+
echo "✓ E2E-relevant files changed - E2E will run" | tee -a $GITHUB_STEP_SUMMARY
9892
else
99-
echo "ℹ️ Only documentation/config files changed - E2E will be skipped"
100-
echo "To run E2E anyway, use manual workflow_dispatch"
93+
echo "should_run=false" >> $GITHUB_OUTPUT
94+
echo "ℹ️ Only documentation/config files changed - E2E will be skipped" | tee -a $GITHUB_STEP_SUMMARY
95+
echo "To run E2E anyway, use manual workflow_dispatch" | tee -a $GITHUB_STEP_SUMMARY
10196
fi
10297
98+
e2e-deployment:
99+
name: E2E Deployment Test
100+
runs-on: [self-hosted, enclave-large]
101+
timeout-minutes: 180 # 3 hours
102+
needs: check-e2e-needed
103+
if: needs.check-e2e-needed.outputs.should_run == 'true'
104+
105+
env:
106+
DEV_SCRIPTS_PATH: ${{ vars.DEV_SCRIPTS_PATH }}
107+
WORKING_DIR: ${{ vars.WORKING_DIR }}
108+
PULL_SECRET: ${{ secrets.PULL_SECRET }}
109+
# Use manual input if available, otherwise default to 'connected' for PR runs
110+
ENCLAVE_DEPLOYMENT_MODE: ${{ github.event.inputs.deployment_mode || 'connected' }}
111+
# Use manual input if available, otherwise default to 'true' for PR runs
112+
CLEANUP_AFTER: ${{ github.event.inputs.cleanup_after || 'true' }}
113+
# Bypass CI_TOKEN requirement (we only use dev-scripts for infra, not cluster install)
114+
OPENSHIFT_CI: "true"
115+
116+
steps:
117+
- name: Checkout code
118+
uses: actions/checkout@v4
119+
103120
- name: Generate unique cluster name
104-
# Run if: manual trigger OR relevant files changed
105-
if: github.event_name == 'workflow_dispatch' || steps.filter.outputs.e2e == 'true'
106121
id: cluster_name
107122
run: |
108123
# Generate short hash from run_id to stay within 15-char bridge name limit
@@ -114,7 +129,6 @@ jobs:
114129
echo "Generated cluster name: ${CLUSTER_NAME}"
115130
116131
- name: Pre-flight checks
117-
if: github.event_name == 'workflow_dispatch' || steps.filter.outputs.e2e == 'true'
118132
id: preflight
119133
shell: bash {0}
120134
run: |
@@ -174,7 +188,6 @@ jobs:
174188
fi
175189
176190
- name: Clean existing infrastructure
177-
if: github.event_name == 'workflow_dispatch' || steps.filter.outputs.e2e == 'true'
178191
id: clean
179192
run: |
180193
echo "## Cleaning Existing Infrastructure" >> $GITHUB_STEP_SUMMARY
@@ -186,7 +199,6 @@ jobs:
186199
echo "✅ Cleanup complete" >> $GITHUB_STEP_SUMMARY
187200
188201
- name: Create infrastructure
189-
if: github.event_name == 'workflow_dispatch' || steps.filter.outputs.e2e == 'true'
190202
id: create_infra
191203
run: |
192204
echo "## Creating Test Infrastructure" >> $GITHUB_STEP_SUMMARY
@@ -198,7 +210,6 @@ jobs:
198210
echo "✅ Infrastructure created" >> $GITHUB_STEP_SUMMARY
199211
200212
- name: Provision Landing Zone
201-
if: github.event_name == 'workflow_dispatch' || steps.filter.outputs.e2e == 'true'
202213
id: provision_lz
203214
run: |
204215
echo "## Provisioning Landing Zone" >> $GITHUB_STEP_SUMMARY
@@ -210,7 +221,6 @@ jobs:
210221
echo "✅ Landing Zone provisioned" >> $GITHUB_STEP_SUMMARY
211222
212223
- name: Install Enclave Lab
213-
if: github.event_name == 'workflow_dispatch' || steps.filter.outputs.e2e == 'true'
214224
id: install_enclave
215225
run: |
216226
echo "## Installing Enclave Lab" >> $GITHUB_STEP_SUMMARY
@@ -222,7 +232,6 @@ jobs:
222232
echo "✅ Enclave Lab installed" >> $GITHUB_STEP_SUMMARY
223233
224234
- name: Phase 1 - Prepare binaries and content
225-
if: github.event_name == 'workflow_dispatch' || steps.filter.outputs.e2e == 'true'
226235
id: deploy_prepare
227236
run: |
228237
echo "## Phase 1: Prepare" >> $GITHUB_STEP_SUMMARY
@@ -234,7 +243,7 @@ jobs:
234243
echo "✅ Phase 1 complete" >> $GITHUB_STEP_SUMMARY
235244
236245
- name: Phase 2 - Mirror registry setup
237-
if: (github.event_name == 'workflow_dispatch' || steps.filter.outputs.e2e == 'true') && env.ENCLAVE_DEPLOYMENT_MODE != 'connected'
246+
if: env.ENCLAVE_DEPLOYMENT_MODE != 'connected'
238247
id: deploy_mirror
239248
run: |
240249
echo "## Phase 2: Mirror Registry" >> $GITHUB_STEP_SUMMARY
@@ -246,7 +255,6 @@ jobs:
246255
echo "✅ Phase 2 complete" >> $GITHUB_STEP_SUMMARY
247256
248257
- name: Phase 3 - Deploy OpenShift cluster
249-
if: github.event_name == 'workflow_dispatch' || steps.filter.outputs.e2e == 'true'
250258
id: deploy_install
251259
run: |
252260
echo "## Phase 3: Deploy Cluster" >> $GITHUB_STEP_SUMMARY
@@ -258,7 +266,6 @@ jobs:
258266
echo "✅ Phase 3 complete - Cluster deployed" >> $GITHUB_STEP_SUMMARY
259267
260268
- name: Phase 4 - Post-install configuration
261-
if: github.event_name == 'workflow_dispatch' || steps.filter.outputs.e2e == 'true'
262269
id: deploy_post_install
263270
run: |
264271
echo "## Phase 4: Post-Install Configuration" >> $GITHUB_STEP_SUMMARY
@@ -270,7 +277,6 @@ jobs:
270277
echo "✅ Phase 4 complete" >> $GITHUB_STEP_SUMMARY
271278
272279
- name: Phase 5 - Install operators
273-
if: github.event_name == 'workflow_dispatch' || steps.filter.outputs.e2e == 'true'
274280
id: deploy_operators
275281
run: |
276282
echo "## Phase 5: Operators" >> $GITHUB_STEP_SUMMARY
@@ -282,7 +288,6 @@ jobs:
282288
echo "✅ Phase 5 complete" >> $GITHUB_STEP_SUMMARY
283289
284290
- name: Phase 6 - Day-2 operations
285-
if: github.event_name == 'workflow_dispatch' || steps.filter.outputs.e2e == 'true'
286291
id: deploy_day2
287292
run: |
288293
echo "## Phase 6: Day-2 Operations" >> $GITHUB_STEP_SUMMARY
@@ -294,7 +299,6 @@ jobs:
294299
echo "✅ Phase 6 complete" >> $GITHUB_STEP_SUMMARY
295300
296301
- name: Phase 7 - Configure hardware discovery
297-
if: github.event_name == 'workflow_dispatch' || steps.filter.outputs.e2e == 'true'
298302
id: deploy_discovery
299303
run: |
300304
echo "## Phase 7: Hardware Discovery" >> $GITHUB_STEP_SUMMARY
@@ -306,7 +310,6 @@ jobs:
306310
echo "✅ Phase 7 complete - Full deployment complete" >> $GITHUB_STEP_SUMMARY
307311
308312
- name: Verify cluster deployment
309-
if: github.event_name == 'workflow_dispatch' || steps.filter.outputs.e2e == 'true'
310313
id: verify_cluster
311314
run: |
312315
set +e # Don't exit on error, handle errors explicitly

0 commit comments

Comments
 (0)