Skip to content

Commit d92a4a1

Browse files
Merge pull request #174 from red-gate/add-code-review
Add code review to state prepare
2 parents d85e96f + 2dc1695 commit d92a4a1

File tree

24 files changed

+4129
-3616
lines changed

24 files changed

+4129
-3616
lines changed

.github/workflows/end-to-end-test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,7 @@ jobs:
293293
with:
294294
target-url: jdbc:sqlite:state-prepare-target.db
295295
working-directory: sample-projects/sqlite-state
296+
fail-on-code-review: 'false'
296297
- name: Run state deploy
297298
id: deploy
298299
uses: ./state/deploy

.github/workflows/zz-integration-test.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,7 @@ jobs:
545545
target-environment: production
546546
target-url: jdbc:sqlite:state-prepare-target.db
547547
working-directory: sample-projects/sqlite-state
548+
skip-code-review: 'true'
548549
- name: Test prepare outputs
549550
shell: bash
550551
run: |
@@ -593,6 +594,7 @@ jobs:
593594
target-environment: production
594595
target-url: jdbc:sqlite:../sqlite/database/drift.db
595596
working-directory: sample-projects/sqlite-state
597+
skip-code-review: 'true'
596598
drift-report-name: flyway-state-prepare-drift-report-${{ matrix.os }}
597599
drift-report-retention-days: '1'
598600
drift-resolution-scripts-name: flyway-state-prepare-drift-resolution-${{ matrix.os }}
@@ -623,6 +625,58 @@ jobs:
623625
test "${{ steps.prepare.outputs.exit-code }}" = "1"
624626
test "${{ steps.prepare.outputs.drift-detected }}" = "true"
625627
628+
state-prepare-fail-on-code-review:
629+
strategy:
630+
matrix:
631+
os: [ubuntu-latest, windows-latest, macos-latest]
632+
runs-on: ${{ matrix.os }}
633+
permissions:
634+
contents: read
635+
id-token: write
636+
steps:
637+
- name: Checkout
638+
uses: actions/checkout@v6
639+
- name: Retrieve secrets from Vault
640+
uses: hashicorp/vault-action@v3.4.0
641+
with:
642+
method: jwt
643+
path: ${{ vars.VAULT_AUTH_PATH }}
644+
url: ${{ vars.VAULT_URL }}
645+
role: "flyway-actions"
646+
secrets: |
647+
build-secrets/data/repos/red-gate/flyway-actions/flyway FLYWAY_PERMIT_ENTERPRISE | FLYWAY_PERMIT_ENTERPRISE;
648+
- name: Setup Flyway
649+
uses: red-gate/setup-flyway@v3
650+
env:
651+
REDGATE_LICENSING_PERMIT: ${{ env.FLYWAY_PERMIT_ENTERPRISE }}
652+
with:
653+
edition: enterprise
654+
i-agree-to-the-eula: true
655+
- name: Run state prepare with code review
656+
id: prepare
657+
uses: ./state/prepare
658+
continue-on-error: true
659+
env:
660+
REDGATE_LICENSING_PERMIT: ${{ env.FLYWAY_PERMIT_ENTERPRISE }}
661+
with:
662+
target-environment: production
663+
target-url: jdbc:sqlite:state-prepare-target.db
664+
working-directory: sample-projects/sqlite-state
665+
skip-drift-check: 'true'
666+
- name: Verify prepare failed due to code review
667+
shell: bash
668+
run: test "${{ steps.prepare.outcome }}" != "success"
669+
- name: Test outputs
670+
shell: bash
671+
run: |
672+
set -euo pipefail
673+
echo "Exit code: ${{ steps.prepare.outputs.exit-code }}"
674+
echo "Code violation count: ${{ steps.prepare.outputs.code-violation-count }}"
675+
echo "Code violation codes: ${{ steps.prepare.outputs.code-violation-codes }}"
676+
test "${{ steps.prepare.outputs.exit-code }}" = "1"
677+
test "${{ steps.prepare.outputs.code-violation-count }}" = "1"
678+
test "${{ steps.prepare.outputs.code-violation-codes }}" = "AM04"
679+
626680
state-deploy-no-drift:
627681
strategy:
628682
matrix:

0 commit comments

Comments
 (0)