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 production GitHub Actions workflow #347

Merged
merged 1 commit into from
Oct 21, 2024

Conversation

KeisukeYamashita
Copy link
Contributor

@KeisukeYamashita KeisukeYamashita commented Oct 20, 2024

Why

To deploy the dockerized Re:Earth CMS frontend to Cloud Run and manage Docker images.

Ref

Summary by CodeRabbit

  • New Features

    • Introduced a dedicated deployment job for the CMS web component, improving the deployment process.
    • New environment variables for managing the CMS web image have been defined.
  • Improvements

    • Enhanced the existing deployment workflow to include the CMS web image alongside other components.

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

coderabbitai bot commented Oct 20, 2024

Walkthrough

The changes in the .github/workflows/deploy-cms-prod.yml file introduce a new deployment job named deploy_web for the CMS web component, which runs conditionally based on the repository name. This job includes steps for authentication, Google Cloud SDK setup, Docker configuration, and deployment of the CMS web image to Google Cloud Run. Additionally, new environment variables for managing the CMS web image are defined, and modifications to the existing push_hub job ensure the CMS web image is also pulled and pushed to Docker Hub.

Changes

File Change Summary
.github/workflows/deploy-cms-prod.yml Added new job deploy_web for CMS web component deployment, defined new environment variables, and modified push_hub job to include CMS web image handling.

Possibly related PRs

Suggested labels

ci

Poem

🐇 In the meadow, changes bloom,
A new web job finds its room.
With Docker and clouds, we play,
Deploying images, hip-hip-hooray!
Environment variables dance in line,
For the CMS, all will be fine! 🌼


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 20, 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 (5)
.github/workflows/deploy-cms-prod.yml (5)

43-54: Approve with minor suggestions: Docker image management steps.

The steps for pulling and pushing the Docker image are logically structured. However, consider quoting the environment variables to prevent potential issues with word splitting or globbing:

- docker pull $CMS_WEB_IMAGE_NAME_GHCR
+ docker pull "$CMS_WEB_IMAGE_NAME_GHCR"

- docker tag $CMS_WEB_IMAGE_NAME_GHCR $CMS_WEB_IMAGE_NAME_GCP \
- && docker push $CMS_WEB_IMAGE_NAME_GCP
+ docker tag "$CMS_WEB_IMAGE_NAME_GHCR" "$CMS_WEB_IMAGE_NAME_GCP" \
+ && docker push "$CMS_WEB_IMAGE_NAME_GCP"

This change will make the script more robust against potential errors.

🧰 Tools
🪛 actionlint

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

(shellcheck)


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

(shellcheck)


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

(shellcheck)


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

(shellcheck)


55-63: Approve with minor suggestions: Deployment step.

The deployment step correctly uses gcloud run deploy to deploy the CMS web image to Google Cloud Run. However, consider quoting the environment variables to prevent potential issues:

  gcloud run deploy reearth-cms-web \
-   --image $CMS_WEB_IMAGE_NAME_GCP \
-   --region $GCP_REGION \
+   --image "$CMS_WEB_IMAGE_NAME_GCP" \
+   --region "$GCP_REGION" \
    --platform managed \
    --quiet

This change will make the script more robust against potential errors.

🧰 Tools
🪛 actionlint

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

(shellcheck)


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

(shellcheck)


160-160: Approve with minor suggestions: Updates to push_hub job.

The changes to include the CMS web image in the push_hub job are appropriate and consistent with the addition of the new component. However, consider quoting the environment variables to prevent potential issues:

- run: docker pull $CMS_IMAGE_NAME_GHCR && docker pull $CMS_WEB_IMAGE_NAME_GHCR && docker pull $WORKER_IMAGE_NAME_GHCR
+ run: docker pull "$CMS_IMAGE_NAME_GHCR" && docker pull "$CMS_WEB_IMAGE_NAME_GHCR" && docker pull "$WORKER_IMAGE_NAME_GHCR"

- run: docker tag $CMS_WEB_IMAGE_NAME_GHCR $CMS_WEB_IMAGE_NAME_HUB && docker push $CMS_WEB_IMAGE_NAME_HUB
+ run: docker tag "$CMS_WEB_IMAGE_NAME_GHCR" "$CMS_WEB_IMAGE_NAME_HUB" && docker push "$CMS_WEB_IMAGE_NAME_HUB"

These changes will make the script more robust against potential errors.

Also applies to: 168-169

🧰 Tools
🪛 actionlint

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

(shellcheck)


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

(shellcheck)


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

(shellcheck)


65-66: Create a follow-up task for removing deploy_web_gcs job.

The TODO comment indicates that this job should be removed after migrating to Cloud Run. To ensure this doesn't get overlooked:

  1. Create a follow-up task or issue to remove this job after the migration is complete.
  2. Include a target date or milestone for the removal to keep it on the team's radar.

This will help maintain a clean and efficient workflow file in the future.

Would you like me to create a GitHub issue to track the removal of the deploy_web_gcs job?


11-11: Remove trailing spaces.

There are trailing spaces on this line. While they don't affect functionality, it's good practice to remove them to maintain clean and consistent code.

- CMS_IMAGE_NAME_GHCR: ghcr.io/eukarya-inc/plateau-view-3.0/reearth-cms:latest
-  
+ CMS_IMAGE_NAME_GHCR: ghcr.io/eukarya-inc/plateau-view-3.0/reearth-cms:latest
+

This change will resolve the yamllint warning and improve code cleanliness.

🧰 Tools
🪛 yamllint

[error] 11-11: trailing spaces

(trailing-spaces)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 16ddcbe and e838670.

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

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

(shellcheck)


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

(shellcheck)


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

(shellcheck)


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

(shellcheck)


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

(shellcheck)


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

(shellcheck)


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

(shellcheck)


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

(shellcheck)


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

(shellcheck)


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

(shellcheck)


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

(shellcheck)


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

(shellcheck)


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

(shellcheck)


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

(shellcheck)


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

(shellcheck)

🪛 yamllint
.github/workflows/deploy-cms-prod.yml

[error] 11-11: trailing spaces

(trailing-spaces)

🔇 Additional comments (3)
.github/workflows/deploy-cms-prod.yml (3)

16-18: LGTM: New environment variables for CMS web image.

The addition of these environment variables for the CMS web image is consistent with the existing pattern for other components. This approach provides flexibility in managing images across different registries.


26-33: LGTM: New deploy_web job added.

The new deploy_web job is well-structured and follows best practices for GitHub Actions. It correctly uses environment secrets and variables, and is properly conditioned to run only for the intended repository.


Line range hint 1-171: Overall approval: CMS production deployment workflow updates.

The changes to this workflow file effectively introduce the deployment process for the CMS web component while maintaining consistency with existing practices. The new deploy_web job and associated environment variables are well-structured and logically integrated into the workflow.

Key points:

  1. New environment variables for the CMS web image are appropriately defined.
  2. The deploy_web job is correctly configured for deploying to Google Cloud Run.
  3. The push_hub job has been updated to include the CMS web image.

Minor improvements have been suggested throughout the review, mainly focused on:

  • Quoting environment variables to prevent potential issues with word splitting or globbing.
  • Removing trailing spaces for better code cleanliness.
  • Creating a follow-up task for the eventual removal of the deploy_web_gcs job.

These suggested changes will further enhance the robustness and maintainability of the workflow. Overall, the modifications align well with the PR objectives and contribute to improving the CI/CD capabilities of the project.

🧰 Tools
🪛 actionlint

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

(shellcheck)


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

(shellcheck)


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

(shellcheck)


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

(shellcheck)


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

(shellcheck)


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

(shellcheck)

🪛 yamllint

[error] 11-11: trailing spaces

(trailing-spaces)

@KeisukeYamashita KeisukeYamashita merged commit a8a510a into main Oct 21, 2024
24 checks passed
@KeisukeYamashita KeisukeYamashita deleted the add-deploy-cms-web-workflow branch October 21, 2024 20:15
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