From 666b9471ca88b34c21229bf6b35abdb9244f07c8 Mon Sep 17 00:00:00 2001 From: Michael McGuinness Date: Mon, 23 Sep 2024 17:44:15 +0100 Subject: [PATCH] envvars --- bitbucket-pipelines.yml | 19 ++----- pipelines/deployment.yml | 109 --------------------------------------- 2 files changed, 3 insertions(+), 125 deletions(-) delete mode 100644 pipelines/deployment.yml diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml index 8e382b3..5d4878b 100644 --- a/bitbucket-pipelines.yml +++ b/bitbucket-pipelines.yml @@ -12,14 +12,6 @@ definitions: name: deployment deployment: development trigger: manual - environment: - SNOWFLAKE_DATABASE: $DEV_SNOWFLAKE_DATABASE - SNOWFLAKE_ROLE: $DEV_SNOWFLAKE_ROLE - AWS_IODC_ROLE: $IODC_ROLE - INSTANCE_ID_TF: $DEV_INSTANCE_ID_TF - IS_DEPLOY_ALL: true - BB_PIPELINE_BRANCH: $BITBUCKET_BRANCH - ENVIRONMENT: dev steps: - step: name: "Deploy Snowflake Changes" @@ -115,7 +107,9 @@ definitions: name: "Example" script: - echo $BITBUCKET_DEPLOYMENT_ENVIRONMENT - - echo $CUSTOM_ENV HEELOO + - echo SNOWFLAKE_DATABASE $DEV_SNOWFLAKE_DATABASE + - echo SNOWFLAKE_ROLE $DEV_SNOWFLAKE_ROLE + - echo AWS_IODC_ROLE $IODC_ROLE pipelines: default: @@ -128,13 +122,6 @@ pipelines: name: deployment-dev deployment: development #trigger: automatic - environment: - SNOWFLAKE_DATABASE: $DEV_SNOWFLAKE_DATABASE - SNOWFLAKE_ROLE: $DEV_SNOWFLAKE_ROLE - AWS_IODC_ROLE: $IODC_ROLE - INSTANCE_ID_TF: $DEV_INSTANCE_ID_TF - IS_DEPLOY_ALL: true - ENVIRONMENT: dev - stage: *deployment name: deployment-uat deployment: staging diff --git a/pipelines/deployment.yml b/pipelines/deployment.yml deleted file mode 100644 index b5ff556..0000000 --- a/pipelines/deployment.yml +++ /dev/null @@ -1,109 +0,0 @@ -definitions: - scripts: - - script: &aws-context - export AWS_ROLE_ARN=arn:aws:iam::$AWS_ACCOUNT_NO:role/$AWS_OIDC_ROLE; - export AWS_WEB_IDENTITY_TOKEN_FILE=$(pwd)/web-identity-token; - echo $BITBUCKET_STEP_OIDC_TOKEN > $(pwd)/web-identity-token; - export AWS_ACCESS_KEY_ID=$(echo $STS_OUTPUT | jq -r '.Credentials.AccessKeyId'); - export AWS_SECRET_ACCESS_KEY=$(echo $STS_OUTPUT | jq -r '.Credentials.SecretAccessKey'); - export AWS_SECURITY_TOKEN=$(echo $STS_OUTPUT | jq -r '.Credentials.SessionToken'); - export AWS_REGION='us-east-2'; - -stage: - name: deployment - deployment: development - trigger: manual - environment: - SNOWFLAKE_DATABASE: $DEV_SNOWFLAKE_DATABASE - SNOWFLAKE_ROLE: $DEV_SNOWFLAKE_ROLE - AWS_IODC_ROLE: $IODC_ROLE - INSTANCE_ID_TF: $DEV_INSTANCE_ID_TF - IS_DEPLOY_ALL: true - BB_PIPELINE_BRANCH: $BITBUCKET_BRANCH - ENVIRONMENT: dev - steps: - - step: - name: "Deploy Snowflake Changes" - image: python:3.7 - size: 2x - script: - - python -m pip install --upgrade pip - - pip install snowflake-connector-python - - pip install schemachange --upgrade - - schemachange -a $SNOWFLAKE_ACCOUNT -u $SNOWFLAKE_USER -r $SNOWFLAKE_ROLE -w $SNOWFLAKE_WAREHOUSE -d $SNOWFLAKE_DATABASE -c $SNOWFLAKE_DATABASE.SCHEMACHANGE.CHANGE_HISTORY --create-change-history-table -v - caches: - - pip - condition: - changesets: - includePaths: - - snowflake/**/* - - snowflake/**/**/* - - snowflake/**/**/**/* - - step: - image: python:3.8 - name: "Deploy streamlit to EC2" - oidc: true - script: - - python -m pip install --upgrade pip - - apt-get update && apt-get install -y jq git - - pip install awscli - - *aws-context - - aws ssm send-command --document-name "AWS-RunShellScript" --instance-ids $INSTANCE_ID_TF --region $AWS_DEFAULT_REGION --parameters commands='[ - "sudo -u ubuntu -i <