-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DAC-1431 Create redshift migration workflow (#275)
Add new run-flyway-command workflow Add scripts to be called from new workflow Add needed role and VPC ingress to IaC code Add new skip-tests option to pull-request-deploy-and-test Fix formatting of code-quality-sonarcloud workflow and make file extension consistent Document sonarcloud and flyway workflows in README
- Loading branch information
1 parent
003b1c1
commit 1079513
Showing
7 changed files
with
220 additions
and
16 deletions.
There are no files selected for viewing
6 changes: 4 additions & 2 deletions
6
...ub/workflows/code-quality-sonarcloud.yaml → ...hub/workflows/code-quality-sonarcloud.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,22 @@ | ||
name: SonarCloud Code Analysis | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
|
||
jobs: | ||
sonarcloud: | ||
name: SonarCloud | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | ||
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | ||
- name: SonarCloud Scan | ||
uses: SonarSource/sonarcloud-github-action@master | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
name: ✳️ Run flyway command on redshift | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
environment: | ||
type: string | ||
required: true | ||
description: AWS environment - one of DEV, TEST, FEATURE, BUILD, STAGING, INTEGRATION or PRODUCTION | ||
command: | ||
type: choice | ||
required: true | ||
description: Flyway command to run | ||
options: | ||
- info | ||
- migrate | ||
- clean | ||
- clean migrate | ||
|
||
jobs: | ||
validate-environment: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out repository code | ||
uses: actions/checkout@v3 | ||
- name: Validate input environment | ||
run: scripts/validate-environment.sh ${{ inputs.environment }} | ||
|
||
run-flyway: | ||
needs: [validate-environment] | ||
# These permissions are needed to interact with GitHub's OIDC Token endpoint (enabling the aws-actions/configure-aws-credentials action) | ||
permissions: | ||
id-token: write | ||
contents: read | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out repository code | ||
uses: actions/checkout@v3 | ||
- name: Assume AWS DB migration role | ||
uses: aws-actions/configure-aws-credentials@v2 | ||
with: | ||
aws-region: eu-west-2 | ||
role-to-assume: ${{ secrets[format('DB_MIGRATION_ROLE_ARN_{0}', inputs.environment)] }} | ||
- name: Get AWS account id | ||
run: echo "account_id=$(aws sts get-caller-identity --output text --query 'Account')" >> $GITHUB_ENV | ||
- name: Prepare migrations folder | ||
run: scripts/prepare-redshift-migrations.sh ${{ inputs.environment }} $account_id | ||
- name: Download JARs | ||
run: | | ||
mkdir ${{ github.workspace }}/redshift-scripts/drivers | ||
cd ${{ github.workspace }}/redshift-scripts/drivers | ||
wget https://s3.amazonaws.com/redshift-downloads/drivers/jdbc/2.1.0.20/redshift-jdbc42-2.1.0.20.jar | ||
wget https://repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-databind/2.15.3/jackson-databind-2.15.3.jar | ||
- name: Run flyway command | ||
run: | | ||
ENVIRONMENT=$(echo ${{ inputs.environment }}) | ||
WORKGROUP_NAME="${ENVIRONMENT,,}-redshift-serverless-workgroup" | ||
scripts/run-flyway-command.sh $WORKGROUP_NAME ${{ inputs.command }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.