Skip to content

staging: adding semaphore changes for staging#395

Merged
chaudharynidhi merged 6 commits intomasterfrom
task/SNE-48188-setup-semaphore-staging
Apr 9, 2025
Merged

staging: adding semaphore changes for staging#395
chaudharynidhi merged 6 commits intomasterfrom
task/SNE-48188-setup-semaphore-staging

Conversation

@chaudharynidhi
Copy link
Copy Markdown
Contributor

@chaudharynidhi chaudharynidhi commented Apr 9, 2025

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

  • Code compiles without errors
  • Version Bump added to package.json & CHANGELOG.md
  • All tests pass
  • Build process is successful
  • Documentation has been updated (if needed)

Summary by CodeRabbit

  • New Features

    • Enabled automatic promotion for staging releases when validations pass.
  • Chores

    • Upgraded deployment environments to higher-performance resources for improved stability.
    • Streamlined dependency installation, artifact handling, and cache invalidation to ensure smoother, more reliable updates.
    • Added new asset commands for improved deployment processes, including support for new artifacts.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 9, 2025

Walkthrough

The pull request updates deployment configurations in several Semaphore CI files. The machine type in both production and staging deployments has been upgraded from s1-t2-micro to s1-ultron-c5-large. Additionally, the primary semaphore configuration now installs Node.js dependencies and corrects artifact push syntax while introducing an auto-promotion condition for the staging environment. The staging deployment file also adds new artifact pull commands for service worker files and updates the S3 upload branch reference alongside an extended cleanup and cache invalidation process.

Changes

File(s) Change Summary
.semaphore/production-deploy.yml, .semaphore/staging-deploy.yml Updated machine type from s1-t2-micro to s1-ultron-c5-large for deployment configurations.
.semaphore/semaphore.yml Added an npm install command in the "Checkout and Create Artifact" job, corrected artifact push command syntax by removing extra quotes, and introduced an auto_promote condition for the "Staging" promotion.
.semaphore/staging-deploy.yml Added artifact pull commands for sw_webpush.js and sw_webpush.min.js; modified S3 upload commands to use ${SEMAPHORE_GIT_WORKING_BRANCH} instead of ${SEMAPHORE_GIT_BRANCH}; extended cleanup and CloudFront invalidation commands to include the new service worker files.

Sequence Diagram(s)

sequenceDiagram
    participant Dev as Developer
    participant CI as Semaphore CI
    participant AS as Artifact Store
    participant Dep as Deployer/Cloud
    
    Dev->>CI: Push commit
    CI->>CI: Run "Checkout and Create Artifact" job
    CI->>CI: Execute npm install & build process
    CI->>AS: Push sw_webpush.min.js artifact
    CI-->>CI: Job completes (result = passed)
    CI->>CI: Auto-promote to Staging (if passed)
    CI->>Dep: Trigger staging deployment
    Dep->>AS: Pull sw_webpush.js and sw_webpush.min.js artifacts
    Dep->>Dep: Upload assets to S3 (using updated branch variable)
    Dep->>Dep: Cleanup old clevertap and sw_webpush files
    Dep->>Dep: Invalidate CloudFront cache for updated assets
Loading

Suggested reviewers

  • Yashprime1

Poem

Hoppin' through the code fields so wide,
I found upgrades on every side.
From micro to ultra I cheer with delight,
Npm installs and promotions take flight.
With artifacts dancing in their new light,
I, a merry rabbit, celebrate the change tonight! 🐰
Hop, hop, hooray!


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@singhkunal2050 singhkunal2050 self-requested a review April 9, 2025 10:59
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (4)
.semaphore/staging-deploy.yml (4)

13-13: Remove trailing spaces on the artifact pull command for clevertap.min.js.
Trailing spaces have been detected at the end of this line. Removing them will help maintain consistent formatting throughout the YAML file.

-            - artifact pull workflow clevertap.min.js 
+            - artifact pull workflow clevertap.min.js
🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 13-13: trailing spaces

(trailing-spaces)


14-14: Remove trailing spaces on the artifact pull command for clevertap.js.
This line contains extraneous trailing whitespace. Please remove it to keep the YAML clean.

-            - artifact pull workflow clevertap.js 
+            - artifact pull workflow clevertap.js
🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 14-14: trailing spaces

(trailing-spaces)


32-32: Remove trailing spaces on the secret declaration.
Trailing spaces are present at the end of this line; please remove them to ensure consistency in formatting.

-        - name: ProductionAccountAwsCredentials 
+        - name: ProductionAccountAwsCredentials
🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 32-32: trailing spaces

(trailing-spaces)


36-36: Review the empty os_image value and missing newline.
The os_image field is set to an empty string here. Please confirm if this is intentional (perhaps to allow default configuration on the upgraded machine) or if it should be omitted altogether. Additionally, YAML lint reported a missing newline at the end of the file; adding one ensures standards compliance.

-          os_image: ''
\ No newline at end of file
+          os_image: ''
🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 36-36: 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

📥 Commits

Reviewing files that changed from the base of the PR and between 2c0a5b1 and 7e3ddb3.

📒 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)


[error] 32-32: trailing spaces

(trailing-spaces)


[error] 36-36: no new line character at the end of file

(new-line-at-end-of-file)

🔇 Additional comments (3)
.semaphore/staging-deploy.yml (3)

16-17: Add artifact pull commands for service worker files.
New commands have been introduced to pull both sw_webpush.js and sw_webpush.min.js, which align with the PR requirement to include service worker assets in the staging deployment.


24-28: Update S3 upload commands with branch variable revision.
These commands now use ${SEMAPHORE_GIT_WORKING_BRANCH} to reference the staging branch, ensuring that the deployed assets are correctly versioned. This change is consistent with the intended staging deployment improvements.


35-35: Upgrade machine type for the deployment agent.
The machine type has been updated to s1-ultron-c5-large, which should provide improved resources during deployment. This change aligns with the upgrade objectives mentioned in the PR objectives.

singhkunal2050
singhkunal2050 previously approved these changes Apr 9, 2025
@singhkunal2050 singhkunal2050 self-requested a review April 9, 2025 11:09
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (3)
.semaphore/staging-deploy.yml (3)

13-14: Remove Trailing Whitespaces in Artifact Pull Commands

The artifact pull commands for clevertap.min.js and clevertap.js contain trailing spaces. Please remove the extra whitespace to ensure proper YAML formatting and avoid potential linting issues.

🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 13-13: trailing spaces

(trailing-spaces)


[error] 14-14: trailing spaces

(trailing-spaces)


32-32: Remove Trailing Whitespace in Secret Declaration

The secret declaration on this line contains trailing spaces. Please remove them to conform with YAML styling guidelines.

🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 32-32: trailing spaces

(trailing-spaces)


36-36: Add Trailing Newline at End of File

The file is missing a trailing newline at the end. Please add a newline character at the end to adhere to common formatting conventions.

🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 36-36: 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

📥 Commits

Reviewing files that changed from the base of the PR and between 7e3ddb3 and 083d6a6.

📒 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)


[error] 32-32: trailing spaces

(trailing-spaces)


[error] 36-36: no new line character at the end of file

(new-line-at-end-of-file)

🔇 Additional comments (5)
.semaphore/staging-deploy.yml (5)

16-17: New Service Worker Artifact Pull Commands Added

The new artifact pull commands for sw_webpush.js and sw_webpush.min.js have been introduced. Confirm that these artifacts are reliably produced in upstream workflow steps.


24-28: Consistent Use of Branch Variable in S3 Upload Commands

The S3 upload commands have been updated to use the ${SEMAPHORE_GIT_WORKING_BRANCH} variable consistently across all assets, including the new service worker files. This ensures alignment with the deployment strategy.


29-29: Cleanup Command Extended to New Assets

The cleanup command now removes sw_webpush.min.js and sw_webpush.js along with the Clevertap assets. This update helps maintain a clean workspace after deployment.


30-30: CloudFront Invalidation Now Includes New Service Worker Paths

The CloudFront invalidation command has been modified to reference ${SEMAPHORE_GIT_WORKING_BRANCH} and includes paths for the new service worker files. This should ensure proper cache invalidation for all deployed assets.


35-36: Agent Machine Type Updated Appropriately

The agent machine type has been changed to s1-ultron-c5-large on line 35, which aligns with the staging deployment upgrade. The use of an empty string for os_image on line 36 appears intentional; please verify that this meets your deployment environment’s requirements.

🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 36-36: no new line character at the end of file

(new-line-at-end-of-file)

@chaudharynidhi chaudharynidhi merged commit 083d6a6 into master Apr 9, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants