|
1 | 1 | name: "Preview environment regression check"
|
2 | 2 | on:
|
| 3 | + workflow_run: |
| 4 | + workflows: ["Build"] |
| 5 | + types: [completed] |
| 6 | + branches: ["main"] |
3 | 7 | workflow_dispatch:
|
4 | 8 | inputs:
|
5 | 9 | name:
|
|
13 | 17 | required: false
|
14 | 18 | default: harvester
|
15 | 19 | jobs:
|
| 20 | + configuration: |
| 21 | + name: Configuration |
| 22 | + runs-on: [self-hosted] |
| 23 | + outputs: |
| 24 | + skip: ${{ steps.configuration.outputs.skip }} |
| 25 | + name: ${{ steps.configuration.outputs.name }} |
| 26 | + version: ${{ steps.configuration.outputs.version }} |
| 27 | + infrastructure_provider: ${{ steps.configuration.outputs.infrastructure_provider }} |
| 28 | + steps: |
| 29 | + - name: "Set outputs" |
| 30 | + id: configuration |
| 31 | + run: | |
| 32 | + if [[ '${{ github.event.inputs.name }}' != '' ]]; then |
| 33 | + # The workflow was triggered by workflow_dispatch |
| 34 | + { |
| 35 | + echo "version=${{ github.event.inputs.version }}" |
| 36 | + echo "name=${{ github.event.inputs.name }}" |
| 37 | + echo "infrastructure_provider=${{ github.event.inputs.infrastructure_provider }}" |
| 38 | + echo "skip=false" |
| 39 | + } >> $GITHUB_OUTPUT |
| 40 | + else |
| 41 | + # The workflow was triggered by workflow_run |
| 42 | + { |
| 43 | + echo "version=main-gha.${{ github.event.workflow_run.run_number }}" |
| 44 | + echo "name=preview-regression-check-main-${{ github.run_id }}-${{ github.run_attempt }}" |
| 45 | + echo "infrastructure_provider=harvester" |
| 46 | + echo "skip=${{ github.event.workflow_run.conclusion == 'failure' }}" |
| 47 | + } >> $GITHUB_OUTPUT |
| 48 | + fi |
16 | 49 | check:
|
17 | 50 | name: Check for regressions
|
| 51 | + needs: [configuration] |
| 52 | + if: ${{ needs.configuration.outputs.skip == 'false' }} |
18 | 53 | runs-on: [self-hosted]
|
19 | 54 | steps:
|
20 | 55 | - uses: actions/checkout@v3
|
21 | 56 | - name: Create preview environment infrastructure
|
22 | 57 | uses: ./.github/actions/preview-create
|
23 | 58 | with:
|
24 |
| - name: ${{ github.event.inputs.name }} |
25 |
| - infrastructure_provider: ${{ github.event.inputs.infrastructure_provider }} |
| 59 | + name: ${{ needs.configuration.outputs.name }} |
| 60 | + infrastructure_provider: ${{ needs.configuration.outputs.infrastructure_provider }} |
| 61 | + large_vm: false |
26 | 62 | sa_key: ${{ secrets.GCP_CREDENTIALS }}
|
27 | 63 | - name: Deploy Gitpod to the preview environment
|
28 | 64 | id: deploy-gitpod
|
29 | 65 | uses: ./.github/actions/deploy-gitpod
|
30 | 66 | with:
|
31 |
| - name: ${{ github.event.inputs.name }} |
| 67 | + name: ${{ needs.configuration.outputs.name }} |
32 | 68 | sa_key: ${{ secrets.GCP_CREDENTIALS }}
|
33 |
| - version: ${{ github.event.inputs.version}} |
| 69 | + version: ${{ needs.configuration.outputs.version}} |
34 | 70 | - name: Check
|
35 | 71 | run: |
|
36 | 72 | echo "No regressions caught because I didn't check anything 🤡 Sleeping for 2 minutes."
|
|
39 | 75 | if: always()
|
40 | 76 | uses: ./.github/actions/delete-preview
|
41 | 77 | with:
|
42 |
| - name: ${{ github.event.inputs.name }} |
| 78 | + name: ${{ needs.configuration.outputs.name }} |
43 | 79 | sa_key: ${{ secrets.GCP_CREDENTIALS }}
|
0 commit comments