Skip to content

Commit

Permalink
ci: fix change detection in backport branches.
Browse files Browse the repository at this point in the history
Signed-off-by: i4ki <[email protected]>
Signed-off-by: i4k <[email protected]>
  • Loading branch information
i4ki committed Oct 22, 2024
1 parent 0264aad commit 35fdf20
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
15 changes: 9 additions & 6 deletions .github/workflows/ci-sync-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,18 @@ jobs:
- name: make generate
run: make generate

- name: fetch base ref (${{ github.base_ref }})
run: git fetch origin ${{ github.base_ref }}

### Check for changed stacks

- name: List changed Go packages
id: list_go_packages
run: terramate list --tags golang --changed
run: terramate list --tags golang --changed --git-change-base origin/${{ github.base_ref }}

- name: List changed e2e tests packages
id: list_e2e_packages
run: terramate list --tags e2etests --changed
run: terramate list --tags e2etests --changed --git-change-base origin/${{ github.base_ref }}

### Linting

Expand All @@ -96,14 +99,14 @@ jobs:
### Run the Terramate tests and create a Cloud deployment

- name: Run Terraform deployment on changed packages
if: ${{ steps.list_go_packages.outputs.stdout || steps.list_e2e_packages }}
if: ${{ steps.list_go_packages.outputs.stdout }}
timeout-minutes: 30
run: terramate script run --changed --tags golang --continue-on-error --target ${{ matrix.os.name }}-go-packages --parallel 12 deploy
run: terramate script run --changed --git-change-base origin/${{ github.base_ref }} --tags golang --continue-on-error --target ${{ matrix.os.name }}-go-packages --parallel 12 deploy
env:
GITHUB_TOKEN: ${{ github.token }}
TM_TEST_TERRAFORM_REQUIRED_VERSION: "1.7.5"

- name: Run all e2e tests Preview if any Go packages changed
- name: Run all e2e tests if any Go packages changed
if: ${{ steps.list_go_packages.outputs.stdout }}
timeout-minutes: 30
run: terramate script run --tags e2etests --target ${{ matrix.os.name }}-e2e --parallel 12 deploy
Expand All @@ -114,7 +117,7 @@ jobs:
- name: Else only run the changed e2e packages
if: ${{ !steps.list_e2e_packages.outputs.stdout && steps.list_e2e_packages.outputs.stdout }}
timeout-minutes: 30
run: terramate script run --tags e2etests --changed --target "${{ matrix.os.name }}-e2e" --parallel 12 deploy
run: terramate script run --tags e2etests --changed --git-change-base origin/${{ github.base_ref }} --target "${{ matrix.os.name }}-e2e" --parallel 12 deploy
env:
GITHUB_TOKEN: ${{ github.token }}
TM_TEST_TERRAFORM_REQUIRED_VERSION: "1.7.5"
Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/ci-sync-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,18 @@ jobs:
- name: make generate
run: make generate

- name: fetch base ref (${{ github.base_ref }})
run: git fetch origin ${{ github.base_ref }}

### Check for changed stacks

- name: List changed Go packages
id: list_go_packages
run: terramate list --tags golang --changed
run: terramate list --tags golang --changed --git-change-base origin/${{ github.base_ref }}

- name: List changed e2e tests packages
id: list_e2e_packages
run: terramate list --tags e2etests --changed
run: terramate list --tags e2etests --changed --git-change-base origin/${{ github.base_ref }}

### Linting

Expand Down Expand Up @@ -101,7 +104,7 @@ jobs:
- name: Run Preview on changed Go packages
if: ${{ steps.list_go_packages.outputs.stdout }}
timeout-minutes: 30
run: terramate script run --changed --tags golang --target "${{ matrix.os.name }}-go-packages" --parallel 12 preview
run: terramate script run --changed --git-change-base origin/${{ github.base_ref }} --tags golang --target "${{ matrix.os.name }}-go-packages" --parallel 12 preview
env:
GITHUB_TOKEN: ${{ github.token }}
TM_TEST_TERRAFORM_REQUIRED_VERSION: "1.7.5"
Expand All @@ -117,7 +120,7 @@ jobs:
- name: Else only run the changed e2e packages
if: ${{ !steps.list_e2e_packages.outputs.stdout && steps.list_e2e_packages.outputs.stdout }}
timeout-minutes: 30
run: terramate script run --tags e2etests --changed --target "${{ matrix.os.name }}-e2e" --parallel 12 preview
run: terramate script run --tags e2etests --changed --git-change-base origin/${{ github.base_ref }} --target "${{ matrix.os.name }}-e2e" --parallel 12 preview
env:
GITHUB_TOKEN: ${{ github.token }}
TM_TEST_TERRAFORM_REQUIRED_VERSION: "1.7.5"
Expand Down

0 comments on commit 35fdf20

Please sign in to comment.