Feature/helm * Add helm details * Modify ecr as medicalalert-web-reloaded * Modify pipeline file * Remove old deployment artifacts except common and pvc * Modify for weca namesapce * Modify for weca namesapce * Revert the APP Change * Revert APP to weareconnectamerica-web Again * merge conflicts Approved-by: Rachit Bhargava
600 lines
26 KiB
YAML
600 lines
26 KiB
YAML
definitions:
|
|
set-variables: &set-variables
|
|
- variables:
|
|
- name: VERSION
|
|
default: "latest"
|
|
# --------------------------------------------------------
|
|
set-variables-jobs: &set-variables-schedule-pipelines
|
|
- variables:
|
|
- name: ACTION
|
|
default: "SELECT_FROM_DROP_DOWN"
|
|
allowed-values: # Optionally restrict variable values
|
|
- "create-schedule-pipelines"
|
|
- "delete-schedule-pipelines-all"
|
|
- "delete-schedule-pipelines-single"
|
|
- "list-schedule-pipelines"
|
|
- "update-schedule-pipelines"
|
|
- "list-schedule-pipelines-run"
|
|
- "SELECT_FROM_DROP_DOWN"
|
|
- name: UUID
|
|
default: "ENTER_UUID_FOR_DELETION_ONLY"
|
|
- name: PIPELINE_NAME
|
|
default: "common-jobs-dev"
|
|
allowed-values: # Optionally restrict variable values
|
|
- "backup-mysql-monthly-prod"
|
|
- "backup-static-monthly-prod"
|
|
- "cleanup-backup-monthly-prod"
|
|
- "common-jobs-dev" # for patch with default values
|
|
- name: BRANCH_NAME
|
|
default: "develop"
|
|
allowed-values: # Optionally restrict variable values
|
|
- "develop"
|
|
- name: CRONTIME
|
|
default: "ENTER_CRON_SCHEDULE"
|
|
|
|
# -------------------------------------------------------
|
|
# allowed-values: # Optionally restrict variable values
|
|
# - "0 * * * 1 ? *" # On 1st every month
|
|
# - "0 * * * * 7 *" # Every sunday
|
|
# - ""
|
|
# - "ENTER_CRON_SCHEDULE"
|
|
# ----------------------------------------------------
|
|
set-variables-jobs: &set-variables-jobs-dev
|
|
- variables:
|
|
- name: ENV
|
|
default: "dev"
|
|
allowed-values: # Optionally restrict variable values
|
|
- "dev"
|
|
- name: JOBNAME
|
|
default: "wp-auto-patch"
|
|
allowed-values: # Optionally restrict variable values
|
|
- "wp-auto-patch"
|
|
- "mysql-backup"
|
|
- "wp-data-backup"
|
|
- "mysql-restore"
|
|
- "wp-data-restore"
|
|
- name: SUBDOMAIN
|
|
default: dev01
|
|
allowed-values: # Optionally restrict variable values
|
|
- "dev01"
|
|
- "www"
|
|
- "dev02"
|
|
- "dev03"
|
|
- "dev04"
|
|
- "dev05"
|
|
- name: RESTORE_VERSION
|
|
default: "PASTE_RESTORE_VERSION_FILE_NAME"
|
|
|
|
set-variables-jobs: &set-variables-jobs
|
|
- variables:
|
|
- name: ENV
|
|
default: "qa"
|
|
allowed-values: # Optionally restrict variable values
|
|
- "qa"
|
|
- "stage"
|
|
- "prod"
|
|
- name: JOBNAME
|
|
default: "mysql-backup"
|
|
allowed-values: # Optionally restrict variable values
|
|
- "mysql-backup"
|
|
- "wp-data-backup"
|
|
- "mysql-restore"
|
|
- "wp-data-restore"
|
|
- name: SUBDOMAIN
|
|
default: www
|
|
allowed-values: # Optionally restrict variable values
|
|
- "www"
|
|
- name: RESTORE_VERSION
|
|
default: "PASTE_RESTORE_VERSION_FILE_NAME"
|
|
|
|
|
|
set-variables-subdomain: &set-variables-subdomain
|
|
- variables:
|
|
- name: ENV
|
|
default: "dev"
|
|
allowed-values: # Optionally restrict variable values
|
|
- "dev"
|
|
- name: URL_DOMAIN
|
|
default: dev01.dev-weareconnectamerica.com
|
|
allowed-values: # Optionally restrict variable values
|
|
- "dev01.dev-weareconnectamerica.com"
|
|
- "dev02.dev-weareconnectamerica.com"
|
|
- "dev03.dev-weareconnectamerica.com"
|
|
- "dev04.dev-weareconnectamerica.com"
|
|
- "dev05.dev-weareconnectamerica.com"
|
|
- name: MYSQL_FILE_NAME
|
|
default: "MYSQL_FILE_NAME_TO_DEPLOY"
|
|
- name: STATIC_FILE_NAME
|
|
default: "STATIC_FILE_NAME_TO_DEPLOY"
|
|
|
|
steps:
|
|
- step: &helmpush
|
|
name: Helm package creation for env
|
|
image:
|
|
name: 716593996126.dkr.ecr.us-east-1.amazonaws.com/common-images:atlassian-default-image4.x-v02
|
|
aws:
|
|
oidc-role: arn:aws:iam::716593996126:role/bitbucket-to-ecr
|
|
oidc: true
|
|
script:
|
|
- if [ -e setenv.sh ]; then cat setenv.sh ; source setenv.sh ; fi && echo "This is for $ENV environment"
|
|
- git clone --branch="develop" https://x-token-auth:${cswtoken}@bitbucket.org/connectamerica/common-scripts-web.git && ls -lrth
|
|
- cp -rf ./common-scripts-web/deployment/helm/* ./deployment/helm/ && ls -lrth && cd deployment/helm && ls -lrth
|
|
- if [[ "$ENV" = "dev" || "$ENV" = "qa" ]]; then DBENV="dev qa"; else DBENV="stage prod"; fi
|
|
- >-
|
|
for ENV in $DBENV;
|
|
do
|
|
export DB_PASSWORD=$(aws ssm get-parameters --names $ENV-weareconnectamerica-masterdbpass --query "Parameters[*].{Value:Value}" --output text);
|
|
export CACHE_PASSWORD=$(aws ssm get-parameters --names redis-password --query "Parameters[*].{Value:Value}" --output text);
|
|
|
|
export DB_PASSWORD=`echo -n "$DB_PASSWORD" | base64` && sed -i "/DB_PASSWORD/c\ DB_PASSWORD:\ $DB_PASSWORD" values-$ENV.tmpl;
|
|
export CACHE_PASSWORD=`echo -n "$CACHE_PASSWORD" | base64` && sed -i "/CACHE_PASSWORD/c\ CACHE_PASSWORD:\ $CACHE_PASSWORD" values-$ENV.tmpl;
|
|
|
|
envsubst '${VERSION}' < values-$ENV.tmpl > values-$ENV.yaml;
|
|
cat values-$ENV.yaml;
|
|
done
|
|
- envsubst '${VERSION} ${APP} ${HELMREPO}' < Chart.tmpl > Chart.yaml && echo ------------ && cat Chart.yaml
|
|
- helm package .
|
|
- aws ecr get-login-password --region us-east-1 | helm registry login --username AWS --password-stdin 716593996126.dkr.ecr.us-east-1.amazonaws.com
|
|
- helm push $HELMREPO-$VERSION-$APP.tgz oci://716593996126.dkr.ecr.us-east-1.amazonaws.com/
|
|
- step: &deploy
|
|
name: deploy to $ENV environment
|
|
image:
|
|
name: 716593996126.dkr.ecr.us-east-1.amazonaws.com/common-images:atlassian-default-image4.x-v02
|
|
aws:
|
|
oidc-role: arn:aws:iam::716593996126:role/bitbucket-to-ecr
|
|
oidc: true
|
|
script:
|
|
# check if env file exists
|
|
- if [ -e setenv.sh ]; then
|
|
- cat setenv.sh
|
|
- source setenv.sh
|
|
- fi
|
|
- echo "This is for $ENV environment"
|
|
- aws eks update-kubeconfig --name caresage-eks-cluster-$ENV --region us-east-1
|
|
- aws ecr get-login-password --region us-east-1 | helm registry login --username AWS --password-stdin 716593996126.dkr.ecr.us-east-1.amazonaws.com
|
|
- export APP="weareconnectamerica-web"
|
|
- mkdir helm && cd helm && helm pull oci://716593996126.dkr.ecr.us-east-1.amazonaws.com/$HELMREPO --version $VERSION-$APP
|
|
- tar -xzvf *$HELMREPO-$VERSION-$APP.tgz && cd $HELMREPO && helm upgrade --install --timeout 20m $APP . --namespace $APP -f values-$ENV.yaml --debug
|
|
after-script:
|
|
- aws eks update-kubeconfig --name caresage-eks-cluster-$ENV --region us-east-1
|
|
- sleep 10 && while kubectl get po -A |grep -i weareconnectamerica-web|egrep -i '0/1|crash|term'; do sleep 10; echo "--- still getting 0/1 or crash pods-----"; done
|
|
|
|
pipelines:
|
|
# our custom pipeline, what shows up Bitbucket web app
|
|
custom:
|
|
|
|
# -------------------------------------------
|
|
schedule-pipelines:
|
|
- <<: *set-variables-schedule-pipelines
|
|
- step:
|
|
name: vars for schedule-pipelines
|
|
image:
|
|
name: 716593996126.dkr.ecr.us-east-1.amazonaws.com/common-images:atlassian-default-image4.x-v02
|
|
aws:
|
|
oidc-role: arn:aws:iam::716593996126:role/bitbucket-to-ecr
|
|
oidc: true
|
|
script:
|
|
- git clone --branch="develop" https://x-token-auth:${cswtoken}@bitbucket.org/connectamerica/common-scripts-web.git && ls -lrth
|
|
- cp -rf ./common-scripts-web/* . && ls -lrth
|
|
- echo "export BITBUCKET_REPO_SLUG=$BITBUCKET_REPO_SLUG" >> schedule-setenv.sh
|
|
- echo "export BITBUCKET_WORKSPACE=$BITBUCKET_WORKSPACE" >> schedule-setenv.sh
|
|
- echo "export TOKEN=$TOKEN" >> schedule-setenv.sh
|
|
- echo "export ACTION=$ACTION" >> schedule-setenv.sh
|
|
- echo "export PIPELINE_NAME=$PIPELINE_NAME" >> schedule-setenv.sh
|
|
- echo "export BRANCH_NAME=$BRANCH_NAME" >> schedule-setenv.sh
|
|
- echo "export CRONTIME=\"$CRONTIME\"" >> schedule-setenv.sh
|
|
artifacts: # define the artifacts to be passed to each future step
|
|
- schedule-setenv.sh
|
|
|
|
- step:
|
|
name: Actions for schedule-pipelines
|
|
image:
|
|
name: 716593996126.dkr.ecr.us-east-1.amazonaws.com/common-images:pipelines-awscli-latest-v01
|
|
aws:
|
|
oidc-role: arn:aws:iam::716593996126:role/bitbucket-to-ecr
|
|
oidc: true
|
|
script:
|
|
- git clone --branch="develop" https://x-token-auth:${cswtoken}@bitbucket.org/connectamerica/common-scripts-web.git && ls -lrth && cp -rf ./common-scripts-web/* . && ls -lrth
|
|
- cat schedule-setenv.sh && chmod 755 ./schedule-pipeline.sh && ./schedule-pipeline.sh $ACTION
|
|
# -------------------------------------------------
|
|
wp-auto-patch-schedule:
|
|
- step:
|
|
name: vars for dev01 for wp-auto-patch-schedule
|
|
script:
|
|
- echo "export JOBNAME=wp-auto-patch-schedule" >> setenv.sh
|
|
- echo "export ENV=dev" >> setenv.sh
|
|
- echo "export CLUSTER=caresage-eks-cluster-dev" >> setenv.sh
|
|
- echo "export VERSION=$BITBUCKET_BUILD_NUMBER" >> setenv.sh
|
|
- echo "export SUBDOMAIN=dev01" >> setenv.sh
|
|
- echo "export BITBUCKET_REPO_SLUG=$BITBUCKET_REPO_SLUG" >> setenv.sh
|
|
- echo "export TOKEN=$TOKEN" >> setenv.sh
|
|
artifacts: # define the artifacts to be passed to each future step
|
|
- setenv.sh
|
|
|
|
- step:
|
|
name: common jobs for wp-auto-patch-schedule
|
|
image:
|
|
name: 716593996126.dkr.ecr.us-east-1.amazonaws.com/common-images:pipelines-awscli-latest-v01
|
|
aws:
|
|
oidc-role: arn:aws:iam::716593996126:role/bitbucket-to-ecr
|
|
oidc: true
|
|
script:
|
|
- git clone --branch="develop" https://x-token-auth:${cswtoken}@bitbucket.org/connectamerica/common-scripts-web.git && ls -lrth && cp -rf ./common-scripts-web/* . && ls -lrth
|
|
- source setenv.sh && chmod 755 ./common-jobs-bitbucket.sh
|
|
- ./common-jobs-bitbucket.sh $JOBNAME
|
|
|
|
backup-mysql-monthly-prod:
|
|
- step:
|
|
name: vars for common-jobs-prod
|
|
image:
|
|
name: 716593996126.dkr.ecr.us-east-1.amazonaws.com/common-images:atlassian-default-image4.x-v02
|
|
aws:
|
|
oidc-role: arn:aws:iam::716593996126:role/bitbucket-to-ecr
|
|
oidc: true
|
|
script:
|
|
- echo "export JOBNAME=mysql-backup" >> setenv.sh
|
|
- echo "export ENV=prod" >> setenv.sh
|
|
- echo "export CLUSTER=caresage-eks-cluster-prod" >> setenv.sh
|
|
- echo "export VERSION=$BITBUCKET_BUILD_NUMBER" >> setenv.sh
|
|
- echo "export SUBDOMAIN=www" >> setenv.sh
|
|
- echo "export BITBUCKET_REPO_SLUG=$BITBUCKET_REPO_SLUG" >> setenv.sh
|
|
- echo "export TOKEN=$TOKEN" >> setenv.sh
|
|
artifacts: # define the artifacts to be passed to each future step
|
|
- setenv.sh
|
|
|
|
- step:
|
|
name: common jobs for SQL and WWW backup and restore DEV
|
|
image:
|
|
name: 716593996126.dkr.ecr.us-east-1.amazonaws.com/common-images:pipelines-awscli-latest-v01
|
|
aws:
|
|
oidc-role: arn:aws:iam::716593996126:role/bitbucket-to-ecr
|
|
oidc: true
|
|
script:
|
|
- git clone --branch="develop" https://x-token-auth:${cswtoken}@bitbucket.org/connectamerica/common-scripts-web.git && ls -lrth && cp -rf ./common-scripts-web/* . && ls -lrth
|
|
- source setenv.sh && chmod 755 ./common-jobs-bitbucket.sh
|
|
- ./common-jobs-bitbucket.sh $JOBNAME
|
|
|
|
backup-static-monthly-prod:
|
|
- step:
|
|
name: vars for common-jobs-prod
|
|
image:
|
|
name: 716593996126.dkr.ecr.us-east-1.amazonaws.com/common-images:atlassian-default-image4.x-v02
|
|
aws:
|
|
oidc-role: arn:aws:iam::716593996126:role/bitbucket-to-ecr
|
|
oidc: true
|
|
script:
|
|
- echo "export JOBNAME=wp-data-backup" >> setenv.sh
|
|
- echo "export ENV=prod" >> setenv.sh
|
|
- echo "export CLUSTER=caresage-eks-cluster-prod" >> setenv.sh
|
|
- echo "export VERSION=$BITBUCKET_BUILD_NUMBER" >> setenv.sh
|
|
- echo "export SUBDOMAIN=www" >> setenv.sh
|
|
- echo "export BITBUCKET_REPO_SLUG=$BITBUCKET_REPO_SLUG" >> setenv.sh
|
|
- echo "export TOKEN=$TOKEN" >> setenv.sh
|
|
artifacts: # define the artifacts to be passed to each future step
|
|
- setenv.sh
|
|
|
|
- step:
|
|
name: common jobs for SQL and WWW backup and restore DEV
|
|
image:
|
|
name: 716593996126.dkr.ecr.us-east-1.amazonaws.com/common-images:pipelines-awscli-latest-v01
|
|
aws:
|
|
oidc-role: arn:aws:iam::716593996126:role/bitbucket-to-ecr
|
|
oidc: true
|
|
script:
|
|
- git clone --branch="develop" https://x-token-auth:${cswtoken}@bitbucket.org/connectamerica/common-scripts-web.git && ls -lrth && cp -rf ./common-scripts-web/* . && ls -lrth
|
|
- source setenv.sh && chmod 755 ./common-jobs-bitbucket.sh && ./common-jobs-bitbucket.sh $JOBNAME
|
|
|
|
cleanup-backup-monthly-prod:
|
|
- step:
|
|
name: vars for common-jobs-prod
|
|
image:
|
|
name: 716593996126.dkr.ecr.us-east-1.amazonaws.com/common-images:atlassian-default-image4.x-v02
|
|
aws:
|
|
oidc-role: arn:aws:iam::716593996126:role/bitbucket-to-ecr
|
|
oidc: true
|
|
script:
|
|
- echo "export JOBNAME=cleanup-backup" >> setenv.sh
|
|
- echo "export ENV=prod" >> setenv.sh
|
|
- echo "export CLUSTER=caresage-eks-cluster-prod" >> setenv.sh
|
|
- echo "export VERSION=$BITBUCKET_BUILD_NUMBER" >> setenv.sh
|
|
- echo "export SUBDOMAIN=www" >> setenv.sh
|
|
- echo "export BITBUCKET_REPO_SLUG=$BITBUCKET_REPO_SLUG" >> setenv.sh
|
|
- echo "export TOKEN=$TOKEN" >> setenv.sh
|
|
artifacts: # define the artifacts to be passed to each future step
|
|
- setenv.sh
|
|
|
|
- step:
|
|
name: common jobs for SQL and WWW backup and restore DEV
|
|
image:
|
|
name: 716593996126.dkr.ecr.us-east-1.amazonaws.com/common-images:pipelines-awscli-latest-v01
|
|
aws:
|
|
oidc-role: arn:aws:iam::716593996126:role/bitbucket-to-ecr
|
|
oidc: true
|
|
script:
|
|
- git clone --branch="develop" https://x-token-auth:${cswtoken}@bitbucket.org/connectamerica/common-scripts-web.git && ls -lrth && cp -rf ./common-scripts-web/* . && ls -lrth
|
|
- source setenv.sh && chmod 755 ./common-jobs-bitbucket.sh && ./common-jobs-bitbucket.sh $JOBNAME
|
|
deploy-dev:
|
|
- <<: *set-variables
|
|
- step:
|
|
<<: *deploy
|
|
deployment: dev
|
|
name: "deploy to dev"
|
|
|
|
deploy-qa:
|
|
- <<: *set-variables
|
|
- step:
|
|
<<: *deploy
|
|
deployment: qa
|
|
name: "deploy to qa"
|
|
|
|
release-stg:
|
|
- <<: *set-variables
|
|
- step:
|
|
<<: *deploy
|
|
deployment: stage
|
|
name: "deploy to stage"
|
|
|
|
release-prod:
|
|
- <<: *set-variables
|
|
- step:
|
|
<<: *deploy
|
|
deployment: prod
|
|
name: "deploy to prod"
|
|
|
|
1-common-jobs-dev:
|
|
- <<: *set-variables-jobs-dev
|
|
- step:
|
|
name: vars for common-jobs-dev
|
|
image:
|
|
name: 716593996126.dkr.ecr.us-east-1.amazonaws.com/common-images:atlassian-default-image4.x-v02
|
|
aws:
|
|
oidc-role: arn:aws:iam::716593996126:role/bitbucket-to-ecr
|
|
oidc: true
|
|
script:
|
|
- echo "export JOBNAME=$JOBNAME" >> setenv.sh
|
|
- echo "export ENV=$ENV" >> setenv.sh
|
|
- echo "export CLUSTER=caresage-eks-cluster-$ENV" >> setenv.sh
|
|
- echo "export VERSION=$BITBUCKET_BUILD_NUMBER" >> setenv.sh
|
|
- echo "export RESTORE_VERSION=$RESTORE_VERSION" >> setenv.sh
|
|
- echo "export SUBDOMAIN=$SUBDOMAIN" >> setenv.sh
|
|
- echo "export BITBUCKET_REPO_SLUG=$BITBUCKET_REPO_SLUG" >> setenv.sh
|
|
- echo "export TOKEN=$TOKEN" >> setenv.sh
|
|
artifacts: # define the artifacts to be passed to each future step
|
|
- setenv.sh
|
|
|
|
- step:
|
|
name: common jobs for SQL and WWW backup and restore DEV
|
|
image:
|
|
name: 716593996126.dkr.ecr.us-east-1.amazonaws.com/common-images:pipelines-awscli-latest-v01
|
|
aws:
|
|
oidc-role: arn:aws:iam::716593996126:role/bitbucket-to-ecr
|
|
oidc: true
|
|
script:
|
|
- git clone --branch="develop" https://x-token-auth:${cswtoken}@bitbucket.org/connectamerica/common-scripts-web.git && ls -lrth && cp -rf ./common-scripts-web/* . && ls -lrth
|
|
- source setenv.sh && chmod 755 ./common-jobs-bitbucket.sh
|
|
- ./common-jobs-bitbucket.sh $JOBNAME
|
|
|
|
|
|
2-common-jobs:
|
|
- <<: *set-variables-jobs
|
|
- step:
|
|
name: vars for common-jobs qa/stage/prod
|
|
image:
|
|
name: 716593996126.dkr.ecr.us-east-1.amazonaws.com/common-images:atlassian-default-image4.x-v02
|
|
aws:
|
|
oidc-role: arn:aws:iam::716593996126:role/bitbucket-to-ecr
|
|
oidc: true
|
|
script:
|
|
- echo "export JOBNAME=$JOBNAME" >> setenv.sh
|
|
- echo "export ENV=$ENV" >> setenv.sh
|
|
- echo "export CLUSTER=caresage-eks-cluster-$ENV" >> setenv.sh
|
|
- echo "export VERSION=$BITBUCKET_BUILD_NUMBER" >> setenv.sh
|
|
- echo "export RESTORE_VERSION=$RESTORE_VERSION" >> setenv.sh
|
|
- echo "export SUBDOMAIN=$SUBDOMAIN" >> setenv.sh
|
|
- echo "export BITBUCKET_REPO_SLUG=$BITBUCKET_REPO_SLUG" >> setenv.sh
|
|
- echo "export TOKEN=$TOKEN" >> setenv.sh
|
|
artifacts: # define the artifacts to be passed to each future step
|
|
- setenv.sh
|
|
|
|
- step:
|
|
name: common jobs for SQL and WWW backup and restore.
|
|
image:
|
|
name: 716593996126.dkr.ecr.us-east-1.amazonaws.com/common-images:pipelines-awscli-latest-v01
|
|
aws:
|
|
oidc-role: arn:aws:iam::716593996126:role/bitbucket-to-ecr
|
|
oidc: true
|
|
script:
|
|
- git clone --branch="develop" https://x-token-auth:${cswtoken}@bitbucket.org/connectamerica/common-scripts-web.git && ls -lrth && cp -rf ./common-scripts-web/* . && ls -lrth
|
|
- source setenv.sh && chmod 755 ./common-jobs-bitbucket.sh
|
|
- ./common-jobs-bitbucket.sh $JOBNAME
|
|
|
|
4-subdomain-deploy:
|
|
- <<: *set-variables-subdomain
|
|
- step:
|
|
name: vars for subdomain
|
|
image:
|
|
name: 716593996126.dkr.ecr.us-east-1.amazonaws.com/common-images:atlassian-default-image4.x-v02
|
|
aws:
|
|
oidc-role: arn:aws:iam::716593996126:role/bitbucket-to-ecr
|
|
oidc: true
|
|
script:
|
|
- echo "export SUBDOMAIN=`echo $URL_DOMAIN | awk -F. '{print $1}'`" >> setenv.sh
|
|
- echo "export ENV=$ENV" >> setenv.sh
|
|
- echo "export CLUSTER=caresage-eks-cluster-$ENV" >> setenv.sh
|
|
- echo "export VERSION=$BITBUCKET_BUILD_NUMBER" >> setenv.sh
|
|
- echo "export RESTORE_VERSION=$RESTORE_VERSION" >> setenv.sh
|
|
- echo "export URL_DOMAIN=$URL_DOMAIN" >> setenv.sh
|
|
- echo "export MYSQL_FILE_NAME=$MYSQL_FILE_NAME" >> setenv.sh
|
|
- echo "export STATIC_FILE_NAME=$STATIC_FILE_NAME" >> setenv.sh
|
|
- echo "export BITBUCKET_REPO_SLUG=$BITBUCKET_REPO_SLUG" >> setenv.sh
|
|
- echo "export TOKEN=$TOKEN" >> setenv.sh
|
|
artifacts:
|
|
- setenv.sh
|
|
|
|
- step:
|
|
name: Deploy the wp source code
|
|
trigger: manual
|
|
image:
|
|
name: 716593996126.dkr.ecr.us-east-1.amazonaws.com/common-images:pipelines-awscli-latest-v01
|
|
aws:
|
|
oidc-role: arn:aws:iam::716593996126:role/bitbucket-to-ecr
|
|
oidc: true
|
|
script:
|
|
- git clone --branch="develop" https://x-token-auth:${cswtoken}@bitbucket.org/connectamerica/common-scripts-web.git && ls -lrth && cp -rf ./common-scripts-web/* . && ls -lrth
|
|
- source setenv.sh
|
|
- chmod 755 ./common-jobs-bitbucket.sh && ./common-jobs-bitbucket.sh subdomain_deploy
|
|
artifacts:
|
|
- setenv.sh
|
|
|
|
|
|
- step:
|
|
name: Deploy the mysql database
|
|
trigger: manual
|
|
image:
|
|
name: 716593996126.dkr.ecr.us-east-1.amazonaws.com/common-images:pipelines-awscli-latest-v01
|
|
aws:
|
|
oidc-role: arn:aws:iam::716593996126:role/bitbucket-to-ecr
|
|
oidc: true
|
|
script:
|
|
- git clone --branch="develop" https://x-token-auth:${cswtoken}@bitbucket.org/connectamerica/common-scripts-web.git && ls -lrth && cp -rf ./common-scripts-web/* . && ls -lrth
|
|
- source setenv.sh
|
|
- chmod 755 ./common-jobs-bitbucket.sh && ./common-jobs-bitbucket.sh mysql-restore $MYSQL_FILE_NAME
|
|
artifacts:
|
|
- setenv.sh
|
|
|
|
- step:
|
|
name: Deploy the static data
|
|
trigger: manual
|
|
image:
|
|
name: 716593996126.dkr.ecr.us-east-1.amazonaws.com/common-images:pipelines-awscli-latest-v01
|
|
aws:
|
|
oidc-role: arn:aws:iam::716593996126:role/bitbucket-to-ecr
|
|
oidc: true
|
|
script:
|
|
- git clone --branch="develop" https://x-token-auth:${cswtoken}@bitbucket.org/connectamerica/common-scripts-web.git && ls -lrth && cp -rf ./common-scripts-web/* . && ls -lrth
|
|
- source setenv.sh
|
|
- chmod 755 ./common-jobs-bitbucket.sh && ./common-jobs-bitbucket.sh wp-data-restore $STATIC_FILE_NAME
|
|
|
|
|
|
3-release:
|
|
- <<: *set-variables
|
|
- step:
|
|
name: "plan for the release and push the given version to helm repo"
|
|
image:
|
|
name: 716593996126.dkr.ecr.us-east-1.amazonaws.com/common-images:pipelines-awscli-latest-v01
|
|
aws:
|
|
oidc-role: arn:aws:iam::716593996126:role/bitbucket-to-ecr
|
|
oidc: true
|
|
script:
|
|
#- chmod 755 ./validation.sh && ./validation.sh default
|
|
- echo "make sure that release version file and plan has been added to the release repo"
|
|
- source release
|
|
- export MANIFEST=$(aws ecr batch-get-image --repository-name $BITBUCKET_REPO_SLUG --image-ids imageTag=$VERSION --output json | jq --raw-output --join-output '.images[0].imageManifest')
|
|
- aws ecr put-image --repository-name $BITBUCKET_REPO_SLUG --image-tag $RELEASE --image-manifest "$MANIFEST" && echo ------ image $VERSION has been retagged as $RELEASE || exit 9
|
|
- echo "export VERSION=$RELEASE" >> setenv.sh
|
|
- echo "export ENV=stage" >> setenv.sh
|
|
- echo "export APP="weareconnectamerica-web"" >> setenv.sh
|
|
- echo "export HELMREPO=helm-release" >> setenv.sh
|
|
artifacts: # define the artifacts to be passed to each future step
|
|
- setenv.sh
|
|
- step:
|
|
<<: *helmpush
|
|
name: "helmpush for stage and prod release"
|
|
- step:
|
|
<<: *deploy
|
|
deployment: stage
|
|
name: "deploy the release to stage"
|
|
trigger: manual
|
|
- step:
|
|
name: vars for prod
|
|
image:
|
|
name: 716593996126.dkr.ecr.us-east-1.amazonaws.com/common-images:atlassian-default-image4.x-v02
|
|
aws:
|
|
oidc-role: arn:aws:iam::716593996126:role/bitbucket-to-ecr
|
|
oidc: true
|
|
script:
|
|
- source release
|
|
- echo "export VERSION=$RELEASE" >> setenv.sh
|
|
- echo "export ENV=prod" >> setenv.sh
|
|
- echo "export APP="weareconnectamerica-web"" >> setenv.sh
|
|
- echo "export HELMREPO=helm-release" >> setenv.sh
|
|
artifacts: # define the artifacts to be passed to each future step
|
|
- setenv.sh
|
|
- step:
|
|
<<: *deploy
|
|
deployment: prod
|
|
name: "deploy the release to production"
|
|
trigger: manual
|
|
|
|
pull-requests:
|
|
develop:
|
|
- step:
|
|
name: build the application and push that to dev env.
|
|
image:
|
|
name: 716593996126.dkr.ecr.us-east-1.amazonaws.com/common-images:atlassian-default-image4.x-v02
|
|
aws:
|
|
oidc-role: arn:aws:iam::716593996126:role/bitbucket-to-ecr
|
|
oidc: true
|
|
script:
|
|
# importing csw-token common scripts to the workspace #
|
|
- git clone --branch="develop" https://x-token-auth:${cswtoken}@bitbucket.org/connectamerica/common-scripts-web.git && ls -lrth
|
|
- cp -rf ./common-scripts-web/* . && ls -lrth && export ENV=dev
|
|
#- chmod 755 ./validation.sh && ./validation.sh default
|
|
|
|
- export IMAGE="$BITBUCKET_REPO_SLUG" && export VERSION="$BITBUCKET_BUILD_NUMBER" && export APP="weareconnectamerica-web"
|
|
- aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin 716593996126.dkr.ecr.us-east-1.amazonaws.com
|
|
- docker build -t ${IMAGE} .
|
|
- docker tag ${IMAGE} ${IMAGE}:${VERSION}
|
|
- pipe: atlassian/aws-ecr-push-image:1.6.2
|
|
variables:
|
|
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
|
|
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
|
|
AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
|
|
IMAGE_NAME: $IMAGE
|
|
TAGS: $VERSION
|
|
services:
|
|
- docker
|
|
caches:
|
|
- docker
|
|
|
|
- step:
|
|
name: vars for dev
|
|
image:
|
|
name: 716593996126.dkr.ecr.us-east-1.amazonaws.com/common-images:atlassian-default-image4.x-v02
|
|
aws:
|
|
oidc-role: arn:aws:iam::716593996126:role/bitbucket-to-ecr
|
|
oidc: true
|
|
script:
|
|
- echo "export VERSION=$BITBUCKET_BUILD_NUMBER" >> setenv.sh
|
|
- echo "export APP="weareconnectamerica-web"" >> setenv.sh
|
|
- echo "export ENV=dev" >> setenv.sh
|
|
- echo "export HELMREPO=helm-develop" >> setenv.sh
|
|
artifacts: # define the artifacts to be passed to each future step
|
|
- setenv.sh
|
|
- step:
|
|
<<: *helmpush
|
|
name: "helmpush for dev and qa"
|
|
|
|
- step:
|
|
<<: *deploy
|
|
deployment: dev
|
|
name: "deploy to dev"
|
|
- step:
|
|
name: vars for qa
|
|
image:
|
|
name: 716593996126.dkr.ecr.us-east-1.amazonaws.com/common-images:atlassian-default-image4.x-v02
|
|
aws:
|
|
oidc-role: arn:aws:iam::716593996126:role/bitbucket-to-ecr
|
|
oidc: true
|
|
script:
|
|
- echo "export VERSION=$BITBUCKET_BUILD_NUMBER" >> setenv.sh
|
|
- echo "export ENV=qa" >> setenv.sh
|
|
- echo "export APP="weareconnectamerica-web"" >> setenv.sh
|
|
- echo "export HELMREPO=helm-develop" >> setenv.sh
|
|
artifacts:
|
|
- setenv.sh
|
|
- step:
|
|
<<: *deploy
|
|
deployment: qa
|
|
name: "deploy to qa"
|
|
trigger: manual |