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

chore: Update accounts workflow to use docker hub [FLOW-BE-46] #429

Merged
merged 1 commit into from
Feb 28, 2025

Conversation

akiyatomohiro
Copy link
Contributor

@akiyatomohiro akiyatomohiro commented Feb 28, 2025

The naming of environment variables has been aligned with other workflows.

Summary by CodeRabbit

  • Chores
    • Streamlined deployment workflows for both development and production environments to reduce configuration complexity.
    • For development, deployments now fetch the latest nightly release from a public container registry with refined image management.
    • For production, redundant configuration settings have been removed for a simplified deployment process.
    • These updates enhance the consistency and efficiency of service updates for end-users.

Copy link

Copy link
Contributor

coderabbitai bot commented Feb 28, 2025

Walkthrough

This pull request updates the deployment workflows for Re:Earth Accounts in both development and production environments. The changes focus on renaming and consolidating environment variables used for Docker image management, modifying commands to pull, tag, and push images, and updating deployment commands. In the dev workflow, the image is now pulled from Docker Hub using a nightly build tag, while the production workflow removes legacy variables and streamlines the push and deploy steps to Google Cloud Run.

Changes

File(s) Change Summary
.github/workflows/deploy-reearth-accounts-dev.yml Renamed environment variables: replaced IMAGE_NAME_GHCR_REEARTH with IMAGE_NAME (set to reearth/reearth-accounts-api:nightly), replaced IMAGE_NAME_GHCR_PLATEAU with IMAGE_NAME_GHCR, and retained IMAGE_NAME_GCP. Updated step names and commands for pulling from Docker Hub, tagging with new variables, and pushing images accordingly.
.github/workflows/deploy-reearth-accounts-prod.yml Removed legacy variables (IMAGE_NAME_GHCR_REEARTH, IMAGE_NAME_GHCR_PLATEAU, and IMAGE_NAME_GCP_PLATEAU) and introduced IMAGE_NAME_GHCR and IMAGE_NAME_GCP. Adjusted Docker pull, tag, and push commands to only target Google Cloud Run during deployment.

Sequence Diagram(s)

sequenceDiagram
    participant GH as GitHub Actions (Dev)
    participant DockerHub as Docker Hub
    participant GHCR as GitHub Container Registry
    participant GCP as Google Cloud Platform

    GH->>DockerHub: Pull image (IMAGE_NAME: reearth/reearth-accounts-api:nightly)
    DockerHub-->>GH: Return image
    GH->>GH: Tag image with IMAGE_NAME_GHCR & IMAGE_NAME_GCP
    GH->>GHCR: Push image (IMAGE_NAME_GHCR)
    GH->>GCP: Push image (IMAGE_NAME_GCP)
    GH->>GCP: Deploy to Cloud Run
    GCP-->>GH: Deployment status
Loading
sequenceDiagram
    participant GH as GitHub Actions (Prod)
    participant DockerHub as Docker Hub
    participant GCP as Google Cloud Platform

    GH->>DockerHub: Pull image (using IMAGE_NAME_GHCR)
    DockerHub-->>GH: Return image
    GH->>GH: Tag image (using IMAGE_NAME_GCP)
    GH->>GCP: Push image and deploy to Cloud Run
    GCP-->>GH: Deployment status
Loading

Possibly related PRs

Suggested labels

ci

Suggested reviewers

  • KeisukeYamashita
  • pyshx

Poem

I'm a bunny with a code-filled cheer,
Hopping through workflows far and near.
New variables bloom like springtime art,
Each step refined to play its part.
With whiskers twitching in pure delight,
I celebrate these changes day and night.
🐇🥕


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b9e6c54 and b045f7d.

📒 Files selected for processing (2)
  • .github/workflows/deploy-reearth-accounts-dev.yml (2 hunks)
  • .github/workflows/deploy-reearth-accounts-prod.yml (2 hunks)
🔇 Additional comments (10)
.github/workflows/deploy-reearth-accounts-prod.yml (5)

5-6: Environment Variables Consolidation

The updated environment variables now use IMAGE_NAME_GHCR and IMAGE_NAME_GCP to replace the previous plateau-specific names. This simplifies the configuration and seems consistent with the updated deployment process.


35-35: Pull Docker Image Update

The pull command now correctly uses the new IMAGE_NAME_GHCR variable. Verify that this image reference matches the intended production image hosted on GitHub Container Registry.


37-38: Tagging Command Consolidation

The tagging step now retags the pulled GitHub image to the Google Cloud destination using the new variables. This change streamlines the flow. Ensure that the image version and tag integrity are maintained post-tagging.


40-41: Push Docker Image Update

The push command has been simplified to target only the Google Cloud repository using IMAGE_NAME_GCP. Double-check that this meets deployment best practices and that no legacy push to GitHub Container Registry is required in production.


46-46: Deployment Command Update

The Cloud Run deployment now references the IMAGE_NAME_GCP variable correctly. Confirm that the referenced image in Google Cloud is the expected one for production deployment.

.github/workflows/deploy-reearth-accounts-dev.yml (5)

5-7: Updated Environment Variables for Dev

The development workflow now sets a dedicated nightly image using IMAGE_NAME, along with the consolidated variables IMAGE_NAME_GHCR and IMAGE_NAME_GCP. Ensure that the nightly build tag is available on docker hub and that the cloud image path (for IMAGE_NAME_GCP) correctly targets the dev environment.


35-36: Docker Hub Pull Command

The pull step now uses the new IMAGE_NAME environment variable to fetch the nightly build from Docker Hub. This aligns with the PR objective to update the accounts workflow to use Docker Hub.


38-39: Tagging for Multiple Registries

The tagging command now makes use of docker tag $IMAGE_NAME $IMAGE_NAME_GHCR && docker tag $IMAGE_NAME $IMAGE_NAME_GCP to update the image for both GitHub Container Registry and Google Cloud. This dual tagging is consistent and efficient.


41-42: Push Command for Both Registries

The push step correctly pushes the tagged images to both GHCR and Google Cloud. Confirm that both registries are intended recipients for the dev deployments and that the credentials allow these operations.


46-47: Cloud Run Deploy Variable Update

The deployment command now uses --image $IMAGE_NAME_GCP, ensuring Cloud Run pulls the correct image. This change is in line with the consolidation of image variables—verify that the region and platform settings remain correct.


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 generate docstrings to generate docstrings for this 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 Feb 28, 2025
@akiyatomohiro akiyatomohiro changed the title fix: accounts workflow to use docker hub [FLOW-BE-46] chore: Update accounts workflow to use docker hub [FLOW-BE-46] Feb 28, 2025
@akiyatomohiro akiyatomohiro self-assigned this Feb 28, 2025
Copy link
Contributor

@KeisukeYamashita KeisukeYamashita left a comment

Choose a reason for hiding this comment

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

LGTM!

@akiyatomohiro akiyatomohiro merged commit 542383f into main Feb 28, 2025
30 checks passed
@akiyatomohiro akiyatomohiro deleted the fix/accounts-workflow-to-use-docker-hub branch February 28, 2025 02:56
Copy link

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.

3 participants