Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add deploy Re:Earth CMS Web to Cloud Run workflow #346

Merged
merged 1 commit into from
Oct 18, 2024

Conversation

KeisukeYamashita
Copy link
Contributor

@KeisukeYamashita KeisukeYamashita commented Oct 18, 2024

Why

Because now, the web is Dockerlized: reearth/reearth-cms#1253

Note that I didn't remove the existing deploy workflow to GCS.

Summary by CodeRabbit

  • New Features

    • Enhanced deployment process for the CMS development environment with new environment variables for web and worker images.
    • Introduced a new deploy_web job for streamlined deployment to Google Cloud Run.
  • Bug Fixes

    • Updated existing deployment job to utilize the new worker image variables, improving consistency and reliability.

@KeisukeYamashita KeisukeYamashita self-assigned this Oct 18, 2024
Copy link

coderabbitai bot commented Oct 18, 2024

Walkthrough

The pull request introduces significant changes to the .github/workflows/deploy-cms-dev.yml file, enhancing the deployment process for the CMS development environment. New environment variables for both the CMS web and worker images have been added, replacing the previously defined variables. A new job named deploy_web is introduced, which executes under specific conditions and includes steps for authentication, Google Cloud SDK setup, and Docker image management. The existing deploy_server_worker job has been updated to utilize the new worker image variables.

Changes

File Change Summary
.github/workflows/deploy-cms-dev.yml - Added new environment variables: CMS_WEB_IMAGE_NAME, CMS_WEB_IMAGE_NAME_GHCR, CMS_WEB_IMAGE_NAME_GCP, CMS_WORKER_IMAGE_NAME, CMS_WORKER_IMAGE_NAME_GHCR, CMS_WORKER_IMAGE_NAME_GCP.
- Introduced a new job deploy_web for deploying the CMS web application to Google Cloud Run.
- Updated deploy_server_worker job to use the new worker image variables.

Sequence Diagram(s)

sequenceDiagram
    participant Developer
    participant GitHubActions
    participant GoogleCloudRun

    Developer->>GitHubActions: Trigger deployment
    GitHubActions->>GitHubActions: Check repository conditions
    alt Repository matches
        GitHubActions->>GoogleCloudRun: Deploy CMS web application
        GitHubActions->>GoogleCloudRun: Deploy worker application
    else Repository does not match
        GitHubActions->>Developer: Deployment skipped
    end
Loading

🐇 "In the garden of code, we hop with glee,
New images bloom, as bright as can be!
With each little change, our workflow takes flight,
Deploying with ease, oh what a delight!
Hooray for the updates, let's dance and cheer,
For a smoother deployment, we're all gathered here!" 🐇


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 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 resolve resolve all the CodeRabbit review comments.
  • @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.

@github-actions github-actions bot added the ci label Oct 18, 2024
Copy link

@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

🧹 Outside diff range and nitpick comments (3)
.github/workflows/deploy-cms-dev.yml (3)

20-61: LGTM with minor suggestions: New deploy_web job

The new deploy_web job is well-structured and follows GitHub Actions best practices. It correctly handles authentication, Docker configuration, and deployment to Google Cloud Run.

However, there are some shell scripting practices that could be improved:

  1. Use double quotes around variables to prevent globbing and word splitting. For example:

    - docker pull $CMS_WEB_IMAGE_NAME
    + docker pull "$CMS_WEB_IMAGE_NAME"
  2. Apply this change to all shell commands in this job where variables are used.

These changes will make the script more robust against potential issues with special characters or spaces in variable values.

🧰 Tools
🪛 actionlint

44-44: shellcheck reported issue in this script: SC2086:info:1:13: Double quote to prevent globbing and word splitting

(shellcheck)


46-46: shellcheck reported issue in this script: SC2086:info:1:12: Double quote to prevent globbing and word splitting

(shellcheck)


46-46: shellcheck reported issue in this script: SC2086:info:1:32: Double quote to prevent globbing and word splitting

(shellcheck)


46-46: shellcheck reported issue in this script: SC2086:info:2:12: Double quote to prevent globbing and word splitting

(shellcheck)


46-46: shellcheck reported issue in this script: SC2086:info:2:32: Double quote to prevent globbing and word splitting

(shellcheck)


50-50: shellcheck reported issue in this script: SC2086:info:1:13: Double quote to prevent globbing and word splitting

(shellcheck)


50-50: shellcheck reported issue in this script: SC2086:info:2:13: Double quote to prevent globbing and word splitting

(shellcheck)


54-54: shellcheck reported issue in this script: SC2086:info:2:11: Double quote to prevent globbing and word splitting

(shellcheck)


54-54: shellcheck reported issue in this script: SC2086:info:3:12: Double quote to prevent globbing and word splitting

(shellcheck)


Line range hint 63-120: Consider tracking the removal of deploy_web_gcs job

The deploy_web_gcs job appears to be a legacy deployment method that's currently being maintained alongside the new Cloud Run deployment. While it's good to keep this as a fallback, it's important to track its eventual removal to avoid technical debt.

Consider creating a GitHub issue to track the migration progress and the eventual removal of this job. This will help ensure that it's not forgotten once the migration to Cloud Run is complete.

🧰 Tools
🪛 actionlint

44-44: shellcheck reported issue in this script: SC2086:info:1:13: Double quote to prevent globbing and word splitting

(shellcheck)


46-46: shellcheck reported issue in this script: SC2086:info:1:12: Double quote to prevent globbing and word splitting

(shellcheck)


46-46: shellcheck reported issue in this script: SC2086:info:1:32: Double quote to prevent globbing and word splitting

(shellcheck)


46-46: shellcheck reported issue in this script: SC2086:info:2:12: Double quote to prevent globbing and word splitting

(shellcheck)


46-46: shellcheck reported issue in this script: SC2086:info:2:32: Double quote to prevent globbing and word splitting

(shellcheck)


50-50: shellcheck reported issue in this script: SC2086:info:1:13: Double quote to prevent globbing and word splitting

(shellcheck)


50-50: shellcheck reported issue in this script: SC2086:info:2:13: Double quote to prevent globbing and word splitting

(shellcheck)


54-54: shellcheck reported issue in this script: SC2086:info:2:11: Double quote to prevent globbing and word splitting

(shellcheck)


54-54: shellcheck reported issue in this script: SC2086:info:3:12: Double quote to prevent globbing and word splitting

(shellcheck)


Line range hint 121-166: LGTM with minor suggestions: Updated deploy_server_worker job

The deploy_server_worker job has been successfully updated to use the new worker image variables, aligning with the changes made at the beginning of the file. The overall structure of the job is good and follows GitHub Actions best practices.

However, similar to the deploy_web job, there are some shell scripting practices that could be improved:

  1. Use double quotes around variables to prevent globbing and word splitting. For example:

    - docker pull $CMS_IMAGE_NAME && docker pull $CMS_WORKER_IMAGE_NAME
    + docker pull "$CMS_IMAGE_NAME" && docker pull "$CMS_WORKER_IMAGE_NAME"
  2. Apply this change to all shell commands in this job where variables are used.

These changes will make the script more robust against potential issues with special characters or spaces in variable values.

🧰 Tools
🪛 actionlint

141-141: shellcheck reported issue in this script: SC2086:info:1:13: Double quote to prevent globbing and word splitting

(shellcheck)


141-141: shellcheck reported issue in this script: SC2086:info:1:44: Double quote to prevent globbing and word splitting

(shellcheck)


143-143: shellcheck reported issue in this script: SC2086:info:1:12: Double quote to prevent globbing and word splitting

(shellcheck)


143-143: shellcheck reported issue in this script: SC2086:info:1:28: Double quote to prevent globbing and word splitting

(shellcheck)


143-143: shellcheck reported issue in this script: SC2086:info:2:12: Double quote to prevent globbing and word splitting

(shellcheck)


143-143: shellcheck reported issue in this script: SC2086:info:2:28: Double quote to prevent globbing and word splitting

(shellcheck)


143-143: shellcheck reported issue in this script: SC2086:info:3:12: Double quote to prevent globbing and word splitting

(shellcheck)


143-143: shellcheck reported issue in this script: SC2086:info:3:35: Double quote to prevent globbing and word splitting

(shellcheck)


143-143: shellcheck reported issue in this script: SC2086:info:4:12: Double quote to prevent globbing and word splitting

(shellcheck)


143-143: shellcheck reported issue in this script: SC2086:info:4:35: Double quote to prevent globbing and word splitting

(shellcheck)


149-149: shellcheck reported issue in this script: SC2086:info:1:13: Double quote to prevent globbing and word splitting

(shellcheck)


149-149: shellcheck reported issue in this script: SC2086:info:2:13: Double quote to prevent globbing and word splitting

(shellcheck)


149-149: shellcheck reported issue in this script: SC2086:info:3:13: Double quote to prevent globbing and word splitting

(shellcheck)


149-149: shellcheck reported issue in this script: SC2086:info:4:13: Double quote to prevent globbing and word splitting

(shellcheck)


155-155: shellcheck reported issue in this script: SC2086:info:2:11: Double quote to prevent globbing and word splitting

(shellcheck)


155-155: shellcheck reported issue in this script: SC2086:info:3:12: Double quote to prevent globbing and word splitting

(shellcheck)


155-155: shellcheck reported issue in this script: SC2086:info:7:11: Double quote to prevent globbing and word splitting

(shellcheck)


155-155: shellcheck reported issue in this script: SC2086:info:8:12: Double quote to prevent globbing and word splitting

(shellcheck)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between dcfef65 and f534779.

📒 Files selected for processing (1)
  • .github/workflows/deploy-cms-dev.yml (3 hunks)
🧰 Additional context used
🪛 actionlint
.github/workflows/deploy-cms-dev.yml

44-44: shellcheck reported issue in this script: SC2086:info:1:13: Double quote to prevent globbing and word splitting

(shellcheck)


46-46: shellcheck reported issue in this script: SC2086:info:1:12: Double quote to prevent globbing and word splitting

(shellcheck)


46-46: shellcheck reported issue in this script: SC2086:info:1:32: Double quote to prevent globbing and word splitting

(shellcheck)


46-46: shellcheck reported issue in this script: SC2086:info:2:12: Double quote to prevent globbing and word splitting

(shellcheck)


46-46: shellcheck reported issue in this script: SC2086:info:2:32: Double quote to prevent globbing and word splitting

(shellcheck)


50-50: shellcheck reported issue in this script: SC2086:info:1:13: Double quote to prevent globbing and word splitting

(shellcheck)


50-50: shellcheck reported issue in this script: SC2086:info:2:13: Double quote to prevent globbing and word splitting

(shellcheck)


54-54: shellcheck reported issue in this script: SC2086:info:2:11: Double quote to prevent globbing and word splitting

(shellcheck)


54-54: shellcheck reported issue in this script: SC2086:info:3:12: Double quote to prevent globbing and word splitting

(shellcheck)


141-141: shellcheck reported issue in this script: SC2086:info:1:13: Double quote to prevent globbing and word splitting

(shellcheck)


141-141: shellcheck reported issue in this script: SC2086:info:1:44: Double quote to prevent globbing and word splitting

(shellcheck)


143-143: shellcheck reported issue in this script: SC2086:info:1:12: Double quote to prevent globbing and word splitting

(shellcheck)


143-143: shellcheck reported issue in this script: SC2086:info:1:28: Double quote to prevent globbing and word splitting

(shellcheck)


143-143: shellcheck reported issue in this script: SC2086:info:2:12: Double quote to prevent globbing and word splitting

(shellcheck)


143-143: shellcheck reported issue in this script: SC2086:info:2:28: Double quote to prevent globbing and word splitting

(shellcheck)


143-143: shellcheck reported issue in this script: SC2086:info:3:12: Double quote to prevent globbing and word splitting

(shellcheck)


143-143: shellcheck reported issue in this script: SC2086:info:3:35: Double quote to prevent globbing and word splitting

(shellcheck)


143-143: shellcheck reported issue in this script: SC2086:info:4:12: Double quote to prevent globbing and word splitting

(shellcheck)


143-143: shellcheck reported issue in this script: SC2086:info:4:35: Double quote to prevent globbing and word splitting

(shellcheck)


149-149: shellcheck reported issue in this script: SC2086:info:1:13: Double quote to prevent globbing and word splitting

(shellcheck)


149-149: shellcheck reported issue in this script: SC2086:info:2:13: Double quote to prevent globbing and word splitting

(shellcheck)


149-149: shellcheck reported issue in this script: SC2086:info:3:13: Double quote to prevent globbing and word splitting

(shellcheck)


149-149: shellcheck reported issue in this script: SC2086:info:4:13: Double quote to prevent globbing and word splitting

(shellcheck)

🔇 Additional comments (2)
.github/workflows/deploy-cms-dev.yml (2)

10-16: LGTM: Well-structured environment variables for image management

The addition of these environment variables for CMS web and worker images is a good practice. It centralizes the management of image names and improves the maintainability of the workflow. The naming convention is clear and consistent across different registries.


Line range hint 1-166: Overall LGTM: Successful implementation of new deployment workflow

This PR successfully introduces the new deployment workflow for the Re:Earth CMS Web as intended. The changes align well with the PR objectives and maintain a good balance between introducing new functionality and preserving existing processes. Key points:

  1. New environment variables for CMS web and worker images have been added, improving maintainability.
  2. A new deploy_web job has been introduced to handle the deployment to Cloud Run.
  3. The existing GCS deployment (deploy_web_gcs) is maintained as a fallback, with a TODO for future removal.
  4. The deploy_server_worker job has been updated to use the new worker image variables.

The structure of the workflow is clear and follows GitHub Actions best practices. Minor improvements to shell scripting practices have been suggested in previous comments.

Consider creating a GitHub issue to track the eventual removal of the deploy_web_gcs job once the migration to Cloud Run is complete.

Great job on implementing these changes while maintaining backwards compatibility!

🧰 Tools
🪛 actionlint

44-44: shellcheck reported issue in this script: SC2086:info:1:13: Double quote to prevent globbing and word splitting

(shellcheck)


46-46: shellcheck reported issue in this script: SC2086:info:1:12: Double quote to prevent globbing and word splitting

(shellcheck)


46-46: shellcheck reported issue in this script: SC2086:info:1:32: Double quote to prevent globbing and word splitting

(shellcheck)


46-46: shellcheck reported issue in this script: SC2086:info:2:12: Double quote to prevent globbing and word splitting

(shellcheck)


46-46: shellcheck reported issue in this script: SC2086:info:2:32: Double quote to prevent globbing and word splitting

(shellcheck)


50-50: shellcheck reported issue in this script: SC2086:info:1:13: Double quote to prevent globbing and word splitting

(shellcheck)


50-50: shellcheck reported issue in this script: SC2086:info:2:13: Double quote to prevent globbing and word splitting

(shellcheck)


54-54: shellcheck reported issue in this script: SC2086:info:2:11: Double quote to prevent globbing and word splitting

(shellcheck)


54-54: shellcheck reported issue in this script: SC2086:info:3:12: Double quote to prevent globbing and word splitting

(shellcheck)

@KeisukeYamashita KeisukeYamashita merged commit 16ddcbe into main Oct 18, 2024
24 checks passed
@KeisukeYamashita KeisukeYamashita deleted the add-reearth-cms-web-dev branch October 18, 2024 21:42
@KeisukeYamashita KeisukeYamashita changed the title feat: add deploy Re:Earth CMS Web workflow ci: add deploy Re:Earth CMS Web workflow Oct 18, 2024
@KeisukeYamashita KeisukeYamashita changed the title ci: add deploy Re:Earth CMS Web workflow ci: add deploy Re:Earth CMS Web to Cloud Run workflow Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant