From 2c0a5b1e112dd0db4a8c91a1a67eff940ee61b1d Mon Sep 17 00:00:00 2001 From: Nidhi Chaudhary Date: Wed, 9 Apr 2025 16:11:53 +0530 Subject: [PATCH 1/5] staging: adding semaphore changes for staging SNE-48188 --- .semaphore/production-deploy.yml | 2 +- .semaphore/semaphore.yml | 5 ++++- .semaphore/staging-deploy.yml | 17 ++++++++++------- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/.semaphore/production-deploy.yml b/.semaphore/production-deploy.yml index 272e310b..191e7f56 100644 --- a/.semaphore/production-deploy.yml +++ b/.semaphore/production-deploy.yml @@ -24,5 +24,5 @@ blocks: - name: ProductionAccountAwsCredentials agent: machine: - type: s1-t2-micro + type: s1-ultron-c5-large os_image: '' diff --git a/.semaphore/semaphore.yml b/.semaphore/semaphore.yml index 3d9a1a11..6ee10d05 100644 --- a/.semaphore/semaphore.yml +++ b/.semaphore/semaphore.yml @@ -14,11 +14,14 @@ blocks: - artifact push workflow clevertap.min.js - artifact push workflow clevertap.js - artifact push workflow clevertap.js.map + - npm install - npm run build_sw - - 'artifact push workflow sw_webpush.min.js ' + - artifact push workflow sw_webpush.min.js - artifact push workflow sw_webpush.js promotions: - name: Production pipeline_file: production-deploy.yml - name: Staging pipeline_file: staging-deploy.yml + auto_promote: + when: result = 'passed' diff --git a/.semaphore/staging-deploy.yml b/.semaphore/staging-deploy.yml index 6f9ffa3f..1b48dc00 100644 --- a/.semaphore/staging-deploy.yml +++ b/.semaphore/staging-deploy.yml @@ -13,20 +13,23 @@ blocks: - artifact pull workflow clevertap.min.js - artifact pull workflow clevertap.js - artifact pull workflow clevertap.js.map + - artifact pull workflow sw_webpush.js + - artifact pull workflow sw_webpush.min.js - | mkdir utils aws s3 cp s3://cfstack-init-sources3bucket-b5bxfzywj4ae/utils/generate_assumed_role_creds.py utils/generate_assumed_role_creds.py eval $(python3 utils/generate_assumed_role_creds.py --role-arn ${PRODUCTION_ACCOUNT_IAM_ROLE_ARN} --session-name SemaphoreAgent) env | grep AWS aws sts get-caller-identity - aws s3 cp ./clevertap.min.js s3://static.wizrocket.com/staging/${SEMAPHORE_GIT_BRANCH}/js/ --acl public-read - aws s3 cp ./clevertap.js s3://static.wizrocket.com/staging/${SEMAPHORE_GIT_BRANCH}/js/ --acl public-read - aws s3 cp ./clevertap.js.map s3://static.wizrocket.com/staging/${SEMAPHORE_GIT_BRANCH}/js/ --acl public-read - rm -r clevertap.min.js clevertap.js clevertap.js.map - aws cloudfront create-invalidation --distribution-id E1OCAMMKX0F1A1 --paths /staging/${SEMAPHORE_GIT_BRANCH}/js/clevertap.min.js /staging/${SEMAPHORE_GIT_BRANCH}/js/clevertap.js /staging/${SEMAPHORE_GIT_BRANCH}/js/clevertap.js.map - secrets: + aws s3 cp ./clevertap.min.js s3://static.wizrocket.com/staging/${SEMAPHORE_GIT_WORKING_BRANCH}/js/ --acl public-read + aws s3 cp ./clevertap.js s3://static.wizrocket.com/staging/${SEMAPHORE_GIT_WORKING_BRANCH}/js/ --acl public-read + aws s3 cp ./clevertap.js.map s3://static.wizrocket.com/staging/${SEMAPHORE_GIT_WORKING_BRANCH}/js/ --acl public-read + aws s3 cp ./sw_webpush.min.js s3://static.wizrocket.com/staging/${SEMAPHORE_GIT_WORKING_BRANCH}/js/ --acl public-read + aws s3 cp ./sw_webpush.js s3://static.wizrocket.com/staging/${SEMAPHORE_GIT_WORKING_BRANCH}/js/ --acl public-read + rm -r clevertap.min.js clevertap.js clevertap.js.map sw_webpush.min.js sw_webpush.js + aws cloudfront create-invalidation --distribution-id E1OCAMMKX0F1A1 --paths /staging/${SEMAPHORE_GIT_BRANCH}/js/clevertap.min.js /staging/${SEMAPHORE_GIT_BRANCH}/js/clevertap.js /staging/${SEMAPHORE_GIT_BRANCH}/js/clevertap.js.map /staging/${SEMAPHORE_GIT_BRANCH}/js/sw_webpush.min.js /staging/${SEMAPHORE_GIT_BRANCH}/js/sw_webpush.js - name: ProductionAccountAwsCredentials agent: machine: - type: s1-t2-micro + type: s1-ultron-c5-large os_image: '' From 7c335c8b88d2afa8a9f12b3f00e26ece20f51a05 Mon Sep 17 00:00:00 2001 From: Nidhi Chaudhary Date: Wed, 9 Apr 2025 12:19:52 +0530 Subject: [PATCH 2/5] sdk: adding aws s3 command for sw_webpush.js and sw_webpush.min.js file SNE-48188 --- .semaphore/staging-deploy.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.semaphore/staging-deploy.yml b/.semaphore/staging-deploy.yml index 6f9ffa3f..8418efa8 100644 --- a/.semaphore/staging-deploy.yml +++ b/.semaphore/staging-deploy.yml @@ -22,6 +22,9 @@ blocks: aws s3 cp ./clevertap.min.js s3://static.wizrocket.com/staging/${SEMAPHORE_GIT_BRANCH}/js/ --acl public-read aws s3 cp ./clevertap.js s3://static.wizrocket.com/staging/${SEMAPHORE_GIT_BRANCH}/js/ --acl public-read aws s3 cp ./clevertap.js.map s3://static.wizrocket.com/staging/${SEMAPHORE_GIT_BRANCH}/js/ --acl public-read + aws s3 cp ./sw_webpush.js s3://static.wizrocket.com/staging/${SEMAPHORE_GIT_BRANCH}/js/ --acl public-read + aws s3 cp ./sw_webpush.min.js s3://static.wizrocket.com/staging/${SEMAPHORE_GIT_BRANCH}/js/ --acl public-read + aws s3 cp ./clevertap.js.map s3://static.wizrocket.com/staging/${SEMAPHORE_GIT_BRANCH}/js/ --acl public-read rm -r clevertap.min.js clevertap.js clevertap.js.map aws cloudfront create-invalidation --distribution-id E1OCAMMKX0F1A1 --paths /staging/${SEMAPHORE_GIT_BRANCH}/js/clevertap.min.js /staging/${SEMAPHORE_GIT_BRANCH}/js/clevertap.js /staging/${SEMAPHORE_GIT_BRANCH}/js/clevertap.js.map secrets: From 0fc92ed3cbf79ab3ebb208bf839abdf8e1b0ddb3 Mon Sep 17 00:00:00 2001 From: Nidhi Chaudhary Date: Wed, 9 Apr 2025 16:22:39 +0530 Subject: [PATCH 3/5] staging: adding semaphore changes for staging SNE-48188 --- .semaphore/production-deploy.yml | 2 +- .semaphore/semaphore.yml | 5 ++++- .semaphore/staging-deploy.yml | 26 ++++++++++++++------------ 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/.semaphore/production-deploy.yml b/.semaphore/production-deploy.yml index 272e310b..191e7f56 100644 --- a/.semaphore/production-deploy.yml +++ b/.semaphore/production-deploy.yml @@ -24,5 +24,5 @@ blocks: - name: ProductionAccountAwsCredentials agent: machine: - type: s1-t2-micro + type: s1-ultron-c5-large os_image: '' diff --git a/.semaphore/semaphore.yml b/.semaphore/semaphore.yml index 3d9a1a11..6f088a41 100644 --- a/.semaphore/semaphore.yml +++ b/.semaphore/semaphore.yml @@ -14,11 +14,14 @@ blocks: - artifact push workflow clevertap.min.js - artifact push workflow clevertap.js - artifact push workflow clevertap.js.map + - npm install - npm run build_sw - - 'artifact push workflow sw_webpush.min.js ' + - artifact push workflow sw_webpush.min.js - artifact push workflow sw_webpush.js promotions: - name: Production pipeline_file: production-deploy.yml - name: Staging pipeline_file: staging-deploy.yml + auto_promote: + when: result = 'passed' diff --git a/.semaphore/staging-deploy.yml b/.semaphore/staging-deploy.yml index 8418efa8..8ee8192a 100644 --- a/.semaphore/staging-deploy.yml +++ b/.semaphore/staging-deploy.yml @@ -10,26 +10,28 @@ blocks: jobs: - name: Deploy Assets to S3 and Invalidate CloudFront Cache commands: - - artifact pull workflow clevertap.min.js - - artifact pull workflow clevertap.js + - artifact pull workflow clevertap.min.js + - artifact pull workflow clevertap.js - artifact pull workflow clevertap.js.map + - artifact pull workflow sw_webpush.min.js + - artifact pull workflow sw_webpush.js - | mkdir utils aws s3 cp s3://cfstack-init-sources3bucket-b5bxfzywj4ae/utils/generate_assumed_role_creds.py utils/generate_assumed_role_creds.py eval $(python3 utils/generate_assumed_role_creds.py --role-arn ${PRODUCTION_ACCOUNT_IAM_ROLE_ARN} --session-name SemaphoreAgent) env | grep AWS aws sts get-caller-identity - aws s3 cp ./clevertap.min.js s3://static.wizrocket.com/staging/${SEMAPHORE_GIT_BRANCH}/js/ --acl public-read - aws s3 cp ./clevertap.js s3://static.wizrocket.com/staging/${SEMAPHORE_GIT_BRANCH}/js/ --acl public-read - aws s3 cp ./clevertap.js.map s3://static.wizrocket.com/staging/${SEMAPHORE_GIT_BRANCH}/js/ --acl public-read - aws s3 cp ./sw_webpush.js s3://static.wizrocket.com/staging/${SEMAPHORE_GIT_BRANCH}/js/ --acl public-read - aws s3 cp ./sw_webpush.min.js s3://static.wizrocket.com/staging/${SEMAPHORE_GIT_BRANCH}/js/ --acl public-read - aws s3 cp ./clevertap.js.map s3://static.wizrocket.com/staging/${SEMAPHORE_GIT_BRANCH}/js/ --acl public-read - rm -r clevertap.min.js clevertap.js clevertap.js.map - aws cloudfront create-invalidation --distribution-id E1OCAMMKX0F1A1 --paths /staging/${SEMAPHORE_GIT_BRANCH}/js/clevertap.min.js /staging/${SEMAPHORE_GIT_BRANCH}/js/clevertap.js /staging/${SEMAPHORE_GIT_BRANCH}/js/clevertap.js.map + aws s3 cp ./clevertap.min.js s3://static.wizrocket.com/staging/${SEMAPHORE_GIT_WORKING_BRANCH}/js/ --acl public-read + aws s3 cp ./clevertap.js s3://static.wizrocket.com/staging/${SEMAPHORE_GIT_WORKING_BRANCH}/js/ --acl public-read + aws s3 cp ./clevertap.js.map s3://static.wizrocket.com/staging/${SEMAPHORE_GIT_WORKING_BRANCH}/js/ --acl public-read + aws s3 cp ./sw_webpush.js s3://static.wizrocket.com/staging/${SEMAPHORE_GIT_WORKING_BRANCH}/js/ --acl public-read + aws s3 cp ./sw_webpush.min.js s3://static.wizrocket.com/staging/${SEMAPHORE_GIT_WORKING_BRANCH}/js/ --acl public-read + aws s3 cp ./clevertap.js.map s3://static.wizrocket.com/staging/${SEMAPHORE_GIT_WORKING_BRANCH}/js/ --acl public-read + rm -r clevertap.min.js clevertap.js clevertap.js.map sw_webpush.js sw_webpush.min.js + aws cloudfront create-invalidation --distribution-id E1OCAMMKX0F1A1 --paths /staging/${SEMAPHORE_GIT_WORKING_BRANCH}/js/clevertap.min.js /staging/${SEMAPHORE_GIT_WORKING_BRANCH}/js/clevertap.js /staging/${SEMAPHORE_GIT_WORKING_BRANCH}/js/clevertap.js.map /sw_webpush.js /staging/${SEMAPHORE_GIT_WORKING_BRANCH}/js/sw_webpush.min.js secrets: - name: ProductionAccountAwsCredentials agent: machine: - type: s1-t2-micro - os_image: '' + type: s1-ultron-c5-large + os_image: '' \ No newline at end of file From 7e3ddb3bf06fd1af57c866016b8a0eca1b850bfe Mon Sep 17 00:00:00 2001 From: Nidhi Chaudhary Date: Wed, 9 Apr 2025 16:25:52 +0530 Subject: [PATCH 4/5] staging: adding semaphore changes for staging SNE-48188 --- .semaphore/staging-deploy.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.semaphore/staging-deploy.yml b/.semaphore/staging-deploy.yml index 5c9a48ca..c2b713f4 100644 --- a/.semaphore/staging-deploy.yml +++ b/.semaphore/staging-deploy.yml @@ -28,7 +28,8 @@ blocks: aws s3 cp ./sw_webpush.js s3://static.wizrocket.com/staging/${SEMAPHORE_GIT_WORKING_BRANCH}/js/ --acl public-read rm -r clevertap.min.js clevertap.js clevertap.js.map sw_webpush.min.js sw_webpush.js aws cloudfront create-invalidation --distribution-id E1OCAMMKX0F1A1 --paths /staging/${SEMAPHORE_GIT_BRANCH}/js/clevertap.min.js /staging/${SEMAPHORE_GIT_BRANCH}/js/clevertap.js /staging/${SEMAPHORE_GIT_BRANCH}/js/clevertap.js.map /staging/${SEMAPHORE_GIT_BRANCH}/js/sw_webpush.min.js /staging/${SEMAPHORE_GIT_BRANCH}/js/sw_webpush.js - - name: ProductionAccountAwsCredentials + secrets: + - name: ProductionAccountAwsCredentials agent: machine: type: s1-ultron-c5-large From 083d6a692da2b0c9bef4e0bb027f4cf4ecd1a5fd Mon Sep 17 00:00:00 2001 From: Nidhi Chaudhary Date: Wed, 9 Apr 2025 18:36:57 +0530 Subject: [PATCH 5/5] staging: adding semaphore changes for staging SNE-48188 --- .semaphore/staging-deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.semaphore/staging-deploy.yml b/.semaphore/staging-deploy.yml index c2b713f4..4972ea64 100644 --- a/.semaphore/staging-deploy.yml +++ b/.semaphore/staging-deploy.yml @@ -27,7 +27,7 @@ blocks: aws s3 cp ./sw_webpush.min.js s3://static.wizrocket.com/staging/${SEMAPHORE_GIT_WORKING_BRANCH}/js/ --acl public-read aws s3 cp ./sw_webpush.js s3://static.wizrocket.com/staging/${SEMAPHORE_GIT_WORKING_BRANCH}/js/ --acl public-read rm -r clevertap.min.js clevertap.js clevertap.js.map sw_webpush.min.js sw_webpush.js - aws cloudfront create-invalidation --distribution-id E1OCAMMKX0F1A1 --paths /staging/${SEMAPHORE_GIT_BRANCH}/js/clevertap.min.js /staging/${SEMAPHORE_GIT_BRANCH}/js/clevertap.js /staging/${SEMAPHORE_GIT_BRANCH}/js/clevertap.js.map /staging/${SEMAPHORE_GIT_BRANCH}/js/sw_webpush.min.js /staging/${SEMAPHORE_GIT_BRANCH}/js/sw_webpush.js + aws cloudfront create-invalidation --distribution-id E1OCAMMKX0F1A1 --paths /staging/${SEMAPHORE_GIT_WORKING_BRANCH}/js/clevertap.min.js /staging/${SEMAPHORE_GIT_WORKING_BRANCH}/js/clevertap.js /staging/${SEMAPHORE_GIT_WORKING_BRANCH}/js/clevertap.js.map /staging/${SEMAPHORE_GIT_WORKING_BRANCH}/js/sw_webpush.min.js /staging/${SEMAPHORE_GIT_WORKING_BRANCH}/js/sw_webpush.js secrets: - name: ProductionAccountAwsCredentials agent: