1616 type : string
1717 description : " Whether to recreate the VM"
1818 default : " false"
19+ simulate_scheduled_run :
20+ required : false
21+ type : boolean
22+ description : " Simulate a scheduled run"
23+ default : false
24+ schedule :
25+ # Run at midnight UTC every day
26+ - cron : ' 0 0 * * *'
1927
2028jobs :
2129 create-runner :
3644 cancel-in-progress : true
3745 outputs :
3846 is_main_branch : ${{ (github.head_ref || github.ref) == 'refs/heads/main' }}
47+ is_scheduled_run : ${{ github.event_name == 'schedule' || inputs.simulate_scheduled_run == true }}
3948 version : ${{ steps.branches.outputs.sanitized-branch-name }}-gha.${{github.run_number}}
4049 preview_enable : ${{ contains( steps.pr-details.outputs.pr_body, '[x] /werft with-preview') || (steps.output.outputs.with_integration_tests != '') }}
4150 preview_name : ${{ github.head_ref || github.ref_name }}
98107 name : Build previewctl
99108 if : |
100109 (needs.configuration.outputs.pr_no_diff_skip != 'true') &&
101- (needs.configuration.outputs.preview_enable == 'true')
110+ (needs.configuration.outputs.preview_enable == 'true') &&
111+ (needs.configuration.outputs.is_scheduled_run != 'true')
102112 needs : [ configuration, create-runner ]
103113 concurrency :
104114 group : ${{ github.ref == 'refs/heads/main' && github.run_id || github.sha }}-build-previewctl
@@ -126,7 +136,8 @@ jobs:
126136 if : |
127137 (needs.configuration.outputs.pr_no_diff_skip != 'true') &&
128138 (needs.configuration.outputs.preview_enable == 'true') &&
129- (needs.configuration.outputs.is_main_branch != 'true')
139+ (needs.configuration.outputs.is_main_branch != 'true') &&
140+ (needs.configuration.outputs.is_scheduled_run != 'true')
130141 runs-on : ${{ needs.create-runner.outputs.label }}
131142 concurrency :
132143 group : ${{ github.ref == 'refs/heads/main' && github.run_id || github.sha }}-infrastructure
@@ -299,7 +310,7 @@ jobs:
299310
300311 exit $RESULT
301312 - name : Tag the release
302- if : github.ref == 'refs/heads/main'
313+ if : github.ref == 'refs/heads/main' && needs.configuration.outputs.is_scheduled_run != 'true'
303314 run : |
304315 git config --global user.name $GITHUB_USER
305316 git config --global user.email $GITHUB_EMAIL
@@ -309,6 +320,11 @@ jobs:
309320 GITHUB_USER : roboquat
310321311322 VERSION : ${{ needs.configuration.outputs.version }}
323+ - name : Add failOn to workspace config (when scheduled)
324+ if : needs.configuration.outputs.is_scheduled_run == 'true'
325+ run : |
326+ # Add failOn: ["critical"] to the sbom block in WORKSPACE.yaml
327+ sed -i '/sbom:/,/^[a-z]/ s/enabled: true/enabled: true\n failOn: ["critical"]/' WORKSPACE.yaml
312328 - name : Scan for Vulnerabilities
313329 id : scan
314330 shell : bash
@@ -382,7 +398,7 @@ jobs:
382398 install-app :
383399 runs-on : ${{ needs.create-runner.outputs.label }}
384400 needs : [ configuration, build-gitpod, create-runner ]
385- if : ${{ needs.configuration.outputs.is_main_branch == 'true' }}
401+ if : ${{ needs.configuration.outputs.is_main_branch == 'true' && needs.configuration.outputs.is_scheduled_run != 'true' }}
386402 strategy :
387403 fail-fast : false
388404 matrix :
@@ -421,6 +437,7 @@ jobs:
421437 - build-gitpod
422438 - infrastructure
423439 - create-runner
440+ if : needs.configuration.outputs.is_scheduled_run != 'true'
424441 runs-on : ${{ needs.create-runner.outputs.label }}
425442 concurrency :
426443 group : ${{ github.ref == 'refs/heads/main' && github.run_id || github.sha }}-install
@@ -471,7 +488,7 @@ jobs:
471488 name : " Install Monitoring Satellite"
472489 needs : [ infrastructure, build-previewctl, create-runner ]
473490 runs-on : ${{ needs.create-runner.outputs.label }}
474- if : needs.configuration.outputs.with_monitoring == 'true'
491+ if : needs.configuration.outputs.with_monitoring == 'true' && needs.configuration.outputs.is_scheduled_run != 'true'
475492 concurrency :
476493 group : ${{ github.ref == 'refs/heads/main' && github.run_id || github.sha }}-monitoring
477494 cancel-in-progress : true
@@ -502,7 +519,7 @@ jobs:
502519 runs-on : ${{ needs.create-runner.outputs.label }}
503520 container :
504521 image : eu.gcr.io/gitpod-dev-artifact/dev/dev-environment:clu-leeway-sbom-scan-gha.32460
505- if : needs.configuration.outputs.with_integration_tests != ''
522+ if : needs.configuration.outputs.with_integration_tests != '' && needs.configuration.outputs.is_scheduled_run != 'true'
506523 concurrency :
507524 group : ${{ needs.configuration.outputs.preview_name }}-integration-test
508525 cancel-in-progress : true
@@ -532,7 +549,7 @@ jobs:
532549 - configuration
533550 - build-gitpod
534551 - create-runner
535- if : needs.configuration.outputs.is_main_branch == 'true'
552+ if : needs.configuration.outputs.is_main_branch == 'true' && needs.configuration.outputs.is_scheduled_run != 'true'
536553 uses : ./.github/workflows/workspace-integration-tests.yml
537554 with :
538555 version : ${{ needs.configuration.outputs.version }}
@@ -544,7 +561,7 @@ jobs:
544561 - configuration
545562 - build-gitpod
546563 - create-runner
547- if : needs.configuration.outputs.is_main_branch == 'true'
564+ if : needs.configuration.outputs.is_main_branch == 'true' && needs.configuration.outputs.is_scheduled_run != 'true'
548565 uses : ./.github/workflows/code-updates.yml
549566 secrets : inherit
550567
@@ -554,10 +571,31 @@ jobs:
554571 - configuration
555572 - build-gitpod
556573 - create-runner
557- if : needs.configuration.outputs.is_main_branch == 'true'
574+ if : needs.configuration.outputs.is_main_branch == 'true' && needs.configuration.outputs.is_scheduled_run != 'true'
558575 uses : ./.github/workflows/jetbrains-updates.yml
559576 secrets : inherit
560577
578+ notify-scheduled-failure :
579+ name : " Notify on scheduled run failure"
580+ if : needs.configuration.outputs.is_scheduled_run == 'true' && failure()
581+ needs :
582+ - configuration
583+ - build-gitpod
584+ - workspace-integration-tests-main
585+ - ide-code-updates
586+ - ide-jb-updates
587+ runs-on : ubuntu-latest
588+ steps :
589+ - name : Slack Notification
590+ uses : rtCamp/action-slack-notify@v2
591+ env :
592+ SLACK_WEBHOOK : ${{ secrets.ENTERPRISE_JOBS_SLACK_WEBHOOK }}
593+ SLACK_ICON_EMOJI : " :x:"
594+ SLACK_USERNAME : " Scheduled Build"
595+ SLACK_COLOR : " danger"
596+ SLACK_MESSAGE : " Daily scheduled build failed! Please check the logs for details."
597+ SLACK_FOOTER : " <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View Workflow Logs>"
598+
561599 delete-runner :
562600 if : always()
563601 needs :
@@ -570,6 +608,7 @@ jobs:
570608 - install
571609 - monitoring
572610 - integration-test
611+ - notify-scheduled-failure
573612 uses : gitpod-io/gce-github-runner/.github/workflows/delete-vm.yml@main
574613 secrets :
575614 gcp_credentials : ${{ secrets.SELF_HOSTED_GITHUB_RUNNER_GCP_CREDENTIALS }}
0 commit comments