Skip to content

Commit

Permalink
buildspec updated
Browse files Browse the repository at this point in the history
  • Loading branch information
sfdevops committed Aug 23, 2024
1 parent f08e5e0 commit d9b5f60
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions files/tenant-samples/silo/buildspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ phases:
on-failure: ABORT
commands:
# install dependencies
- cd $CODEBUILD_SRC_DIR/tenant-samples/silo
- export WEBHOOK_PATH = '$CODEBUILD_SRC_DIR/tenant-samples/silo/webhook.js'
- curl -sS -o aws-iam-authenticator https://amazon-eks.s3-us-west-2.amazonaws.com/1.10.3/2018-07-26/bin/linux/amd64/aws-iam-authenticator
- curl -sS -o kubectl https://amazon-eks.s3.us-west-2.amazonaws.com/1.17.7/2020-07-08/bin/linux/amd64/kubectl
- chmod +x ./kubectl ./aws-iam-authenticator
Expand All @@ -22,10 +24,10 @@ phases:
- curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 > get_helm.sh && chmod 700 get_helm.sh && ./get_helm.sh --version v3.12.3
- pip install boto3
- npm i @aws-sdk/client-eventbridge
- ln -sf $CODEBUILD_SRC_DIR/$WEBHOOK_PATH /usr/local/bin/webhook #create webhook symlink and will execute webhook at every phase to update status in control plane
- ln -sf $WEBHOOK_PATH /usr/local/bin/webhook #create webhook symlink and will execute webhook at every phase to update status in control plane
finally:
- ls -la
- node $CODEBUILD_SRC_DIR/$WEBHOOK_PATH
- node $WEBHOOK_PATH
pre_build:
on-failure: ABORT
commands:
Expand All @@ -38,7 +40,7 @@ phases:
- export AWS_EXPIRATION=$(echo ${CREDENTIALS} | jq -r '.Credentials.Expiration')
- aws eks update-kubeconfig --name ${EKS_CLUSTER_NAME} --region ${AWS_REGION}
finally:
- node $CODEBUILD_SRC_DIR/$WEBHOOK_PATH
- node $WEBHOOK_PATH
build:
on-failure: ABORT
commands:
Expand Down Expand Up @@ -96,7 +98,7 @@ phases:
fi

# Run Bootstrap folder to create terraform state s3 bucket
- cd tenant-samples/silo/terraform/bootstrap
- cd terraform/bootstrap
- if [ "${is_bootstrap_creation}" = "1" ]; then terraform init; else echo "Skipping terraform init"; fi
- if [ "${is_bootstrap_creation}" = "1" ]; then terraform apply -auto-approve; else echo "Skipping terraform apply"; fi
- cd ..
Expand All @@ -121,14 +123,14 @@ phases:
# fetching cognito user sub as it will be created once terraform will be applied successfully
- export COGNITO_AUTH_ID=$(aws ssm get-parameter --name /${NAMESPACE}/${ENVIRONMENT}/${TIER}/${KEY}/${USERNAME}/user_sub --region ${AWS_REGION} --query "Parameter.Value" --output text --with-decryption)
finally:
- node $CODEBUILD_SRC_DIR/$WEBHOOK_PATH
- node $WEBHOOK_PATH


post_build:
commands:
- export CODEBUILD_BUILD_POSTBUILD=1
- export CREATE_USER=0
- node $CODEBUILD_SRC_DIR/$WEBHOOK_PATH
- node $WEBHOOK_PATH
- python push_to_dynamodb.py # pushing tenant config to dynamodb based on tenant_id mapping


Expand Down

0 comments on commit d9b5f60

Please sign in to comment.