web-sdk: adding semaphore pipeline for staging#389
Conversation
WalkthroughThe pull request updates the Semaphore deployment configuration by renaming the production deployment job from "Deploy" to "Production-Deploy". It also introduces two new promotions in the Semaphore configuration: "Production" and "Staging", replacing the previous "Deploy" promotion. Additionally, a new file, Changes
Sequence Diagram(s)sequenceDiagram
participant Dev as Developer
participant Sem as Semaphore Config
participant Prod as Production Deploy
participant Stage as Staging Deploy
Dev->>Sem: Trigger deployment promotion request
Sem->>Sem: Determine promotion type
alt Production Promotion Selected
Sem->>Prod: Run production pipeline (production-deploy.yml)
Prod->>Sem: Return deployment status
else Staging Promotion Selected
Sem->>Stage: Run staging pipeline (staging-deploy.yml)
Stage->>Sem: Return deployment status
end
Poem
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
.semaphore/staging-deploy.yml (1)
30-30: Missing Newline at End of File
The file is missing a newline at the end, as flagged by YAML lint. Adding a newline will help conform to standard YAML formatting practices.🧰 Tools
🪛 YAMLlint (1.35.1)
[error] 30-30: no new line character at the end of file
(new-line-at-end-of-file)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
.semaphore/production-deploy.yml(1 hunks).semaphore/semaphore.yml(1 hunks).semaphore/staging-deploy.yml(1 hunks)
🧰 Additional context used
🪛 YAMLlint (1.35.1)
.semaphore/staging-deploy.yml
[error] 30-30: no new line character at the end of file
(new-line-at-end-of-file)
🔇 Additional comments (5)
.semaphore/production-deploy.yml (1)
2-2: Config Name Update Verification
The deployment configuration name has been updated from "Deploy" to Production-Deploy, which aligns with the new promotion structure. Please ensure that this renaming is consistently reflected in all pipeline references and documentation..semaphore/semaphore.yml (1)
16-19: Updated Deployment Promotions
The promotions section now defines separate entries for Production and Staging with their dedicated pipeline files. This clear separation supports targeted deployments. Verify that the removal of the old "Deploy" promotion does not impact any external hooks or integrations that might expect the legacy naming..semaphore/staging-deploy.yml (3)
1-6: Staging Deployment Configuration Header
The file header correctly establishes the staging deployment configuration with version, name ("Staging-Deploy"), and machine settings. The configuration appears consistent with its production counterpart while targeting the staging environment.
25-29: Review Secrets and Agent Configurations
The job configuration references the secret ProductionAccountAwsCredentials and specifies an agent with a different machine type. Double-check that using production credentials for staging is intentional and that the agent's resource allocation meets the demands of staging deployments.
13-24:Details
❓ Verification inconclusive
Command Block – Environment Variable Placeholder Usage
The command block carries out essential tasks such as pulling artifacts, generating AWS credentials, and performing S3 uploads with subsequent CloudFront cache invalidation. However, notice the use of GitHub variable syntax (${{ github.head_ref || github.ref_name }}) in the S3 paths. Since this file is for Semaphore deployments, please verify that these placeholders are supported or consider replacing them with Semaphore-specific variables if necessary.
Attention: Verify Environment Variable Placeholders in Semaphore Deployment File
The command block in.semaphore/staging-deploy.yml(lines 13–24) uses GitHub action syntax (${{ github.head_ref || github.ref_name }}) within S3 path definitions. Since this file is dedicated to Semaphore deployments, please ensure that these placeholders are supported in your Semaphore environment. If they aren’t being interpolated correctly, consider replacing them with Semaphore-specific variables (for example,$SEMAPHORE_GIT_BRANCHor any equivalent provided by Semaphore).
- Action Required:
- Confirm that Semaphore resolves GitHub placeholder syntax as expected.
- If not, update these variables to Semaphore-specific ones to guarantee that S3 uploads and subsequent CloudFront invalidations use the correct branch/path.
🏁 Script executed:
#!/bin/bash # Search for GitHub-specific environment variable placeholders across the repository rg "github.head_ref" -n . rg "github.ref_name" -n .Length of output: 51
Attention: Verify GitHub Placeholders in Semaphore Deployment
The deployment script in
.semaphore/staging-deploy.yml(lines 13–24) uses GitHub syntax (${{ github.head_ref || github.ref_name }}) in the S3 paths. Since this file is meant for Semaphore deployments, please manually verify that the Semaphore environment actually interpolates these GitHub-specific variables as intended.
- Action Required:
- Confirm that when the deployment runs, the GitHub placeholders are correctly resolved.
- If they are not supported by Semaphore, update the script to use Semaphore-specific variables (e.g.,
$SEMAPHORE_GIT_BRANCHor the appropriate equivalent).
…tap-web-sdk into setup-semaphore
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
.semaphore/staging-deploy.yml (1)
13-14: Remove Trailing SpacesStatic analysis tools have flagged trailing whitespace on these lines. Removing the extra spaces will improve file cleanliness and prevent potential YAML lint issues.
- - artifact pull workflow clevertap.min.js + - artifact pull workflow clevertap.min.js - - artifact pull workflow clevertap.js + - artifact pull workflow clevertap.js🧰 Tools
🪛 YAMLlint (1.35.1)
[error] 13-13: trailing spaces
(trailing-spaces)
[error] 14-14: trailing spaces
(trailing-spaces)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.semaphore/staging-deploy.yml(1 hunks)
🧰 Additional context used
🪛 YAMLlint (1.35.1)
.semaphore/staging-deploy.yml
[error] 13-13: trailing spaces
(trailing-spaces)
[error] 14-14: trailing spaces
(trailing-spaces)
🔇 Additional comments (7)
.semaphore/staging-deploy.yml (7)
1-6: Header Configuration Looks GoodThe YAML header accurately defines the version, deployment name, and agent machine settings. This provides a clear starting point for the deployment configuration.
7-12: Blocks and Task Structure is ClearThe organization using blocks and tasks effectively outlines the deployment steps. The structure is straightforward and easy to follow.
15-16: Artifact Pull CommandsThe artifact pull commands for
clevertap.js.map(and the other artifacts) are consistent with the deployment needs. Ensure that the artifact naming and availability in the workflow remain unchanged as expected.
16-26: AWS Deployment CommandsThe multi-line script block handles several key operations: creating a
utilsdirectory, retrieving and executing a Python script to generate AWS credentials, verifying the environment, performing S3 uploads with public-read permissions, cleaning up local artifacts, and invalidating the CloudFront cache.
- Verify that the use of
eval $(python3 ...)securely handles AWS credentials.- Ensure that file removals post-upload are intentional for cleanup.
Overall, the commands align with the deployment objectives.
27-28: Secrets Configuration is AppropriateThe inclusion of the secret (
ProductionAccountAwsCredentials) is correctly placed to ensure secure access to AWS production resources. Double-check that the secret is well-configured in Semaphore.
1-33: Overall Configuration AssessmentThe staging deployment configuration effectively fulfills the PR objective of integrating a Semaphore pipeline for staging. It details asset deployment to S3 and CloudFront cache invalidation while leveraging secrets for secure AWS access. Just ensure that:
- Trailing whitespace is removed.
- The agent override settings (especially the empty
os_image) are reviewed.- All environment variables (e.g.,
PRODUCTION_ACCOUNT_IAM_ROLE_ARN,SEMAPHORE_GIT_BRANCH) are correctly managed.🧰 Tools
🪛 YAMLlint (1.35.1)
[error] 13-13: trailing spaces
(trailing-spaces)
[error] 14-14: trailing spaces
(trailing-spaces)
29-32:Details
❓ Verification inconclusive
Review Agent Override Configuration
There's a secondary agent configuration defined for the job using a machine type of
s1-t2-microwith an emptyos_image. Please verify whether leavingos_imageas an empty string is intentional. If not, specify the correct OS image to avoid potential runtime issues.
Review Agent Override Configuration – Verify
os_imageSetting
- In
.semaphore/staging-deploy.yml(lines 29–32), the secondary agent is configured withmachine.typeset tos1-t2-microandos_imageleft as an empty string.- Please verify if leaving
os_imageempty is intentional. If a specific OS image is required, update the configuration accordingly to avoid potential runtime issues.
SNE-48188
Changes
Describe the key changes in this PR with the Jira Issue reference
Changes to Public Facing API if any
Please list the impact on the public facing API if any
How Has This Been Tested?
Describe the testing approach and any relevant configurations (e.g., environment, platform)
Checklist
Summary by CodeRabbit