From 7fc45cce8191c9c65e00f40822ee6fb324a94509 Mon Sep 17 00:00:00 2001 From: Mikko Kauhanen Date: Thu, 12 Dec 2024 13:03:53 +0200 Subject: [PATCH] Add possibility to make cdk diff --- .github/workflows/deploy_dev.yml | 14 ++++++++++++-- deploy-scripts/deploy.sh | 26 ++++++++++++++++++++++---- 2 files changed, 34 insertions(+), 6 deletions(-) diff --git a/.github/workflows/deploy_dev.yml b/.github/workflows/deploy_dev.yml index 25ec2795..45b9e35e 100644 --- a/.github/workflows/deploy_dev.yml +++ b/.github/workflows/deploy_dev.yml @@ -6,6 +6,10 @@ on: branch: description: Branch to deploy required: true + proceedDeploy: + description: Set to true to skip CDK diff and directly proceed with deployment. Default is false. + required: true + default: 'false' concurrency: deploy-dev @@ -37,6 +41,12 @@ jobs: role-to-assume: ${{ secrets.AWS_AOE_DEV_ROLE_ARN }} role-session-name: aoe-runner-deploy-dev aws-region: eu-west-1 - - name: Deploy DEV - run: ./deploy-scripts/04-deploy-dev.sh + + - name: Run CDK Diff + if: ${{ github.event.inputs.proceedDeploy == 'false' }} + run: ./deploy-scripts/04-deploy-dev.sh diff + + - name: Run CDK Deploy + if: ${{ github.event.inputs.proceedDeploy == 'true' }} + run: ./deploy-scripts/04-deploy-dev.sh deploy diff --git a/deploy-scripts/deploy.sh b/deploy-scripts/deploy.sh index b29ac37d..9d3e5f36 100755 --- a/deploy-scripts/deploy.sh +++ b/deploy-scripts/deploy.sh @@ -4,20 +4,38 @@ set -o errexit -o nounset -o pipefail # shellcheck source=../scripts/common-functions.sh source "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/../scripts/common-functions.sh" +ACTION=$1 + function main { start_gh_actions_group "Setup" parse_env_from_script_name "..-deploy" use_correct_node_version end_gh_actions_group - start_gh_actions_group "Deploy $ENV" - deploy - end_gh_actions_group + + + if [[ "$ACTION" == "diff" ]]; then + start_gh_actions_group "Diff $ENV" + diff + end_gh_actions_group + elif [[ "$ACTION" == "deploy" ]]; then + start_gh_actions_group "Deploy $ENV" + deploy + end_gh_actions_group + fi + + } function deploy { pushd "$repo"/aoe-infra/infra - "./cdk.sh" diff # deploy --all + "./cdk.sh" deploy --all + popd +} + +function diff { + pushd "$repo"/aoe-infra/infra + "./cdk.sh" diff popd }