Skip to content

Changed cicd to deploy the external service#747

Merged
rmgpinto merged 1 commit intomainfrom
split-api-deployment
May 28, 2025
Merged

Changed cicd to deploy the external service#747
rmgpinto merged 1 commit intomainfrom
split-api-deployment

Conversation

@rmgpinto
Copy link
Copy Markdown
Collaborator

ref https://linear.app/ghost/issue/PROD-1908

  • Changed CI/CD to deploy the external CloudRun service.

ref https://linear.app/ghost/issue/PROD-1908

- Changed CI/CD to deploy the external CloudRun service.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 28, 2025

Walkthrough

This change updates the GitHub Actions CI/CD workflow by altering the GCP Load Balancer URL map configuration for ephemeral staging deployments, specifically renaming host rule and path matcher references from "staging-environments" to "all-paths." The workflow also introduces new deployment steps for an "ActivityPub External" service in both staging and production jobs, deploying this service to Cloud Run in the same regions as existing ActivityPub services and using the same Docker image version. Service naming conventions are updated to reflect the environment and region. No changes are made to authentication, environment variables, or control flow.

Possibly related PRs

  • Changed staging CD #462: Modifies GitHub Actions workflows for staging deployments, updating naming conventions for deployment jobs and services, similar to the changes in this PR.
  • Added staging tests to CI/CD #687: Adds testing and cleanup steps for staging environments in the CI/CD workflow; both PRs modify deployment jobs within the workflow.
  • Added ephemeral staging environments #432: Establishes ephemeral staging environment infrastructure and load balancer routing logic, which this PR builds upon by further modifying the load balancer configuration and adding new service deployments.

Suggested labels

ricardo.ghost.is


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate sequence diagram to generate a sequence diagram of the changes in 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.

@rmgpinto rmgpinto enabled auto-merge (squash) May 28, 2025 13:16
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 (3)
.github/workflows/cicd.yml (3)

285-286: Validate priority fallback logic for new route rules.
The use of max // 0 ensures MAX_PRIORITY is 0 if no existing routeRules are found, yielding NEXT_PRIORITY=1. Confirm this aligns with your intended priority scheme. Adding a brief inline comment explaining the fallback could improve future maintainability.


371-379: Review new staging deploy step for ActivityPub External service.
The added Deploy ActivityPub External to Cloud Run step correctly follows the pattern of the existing API deployment, using ${{ needs.build-test-push.outputs.activitypub_docker_version }} and the service parameter.

  • Verify that activitypub_docker_version is the correct image tag for this external service.
  • Ensure the service name stg-${{ matrix.region_name }}-activitypub-external matches your Terraform or infra naming conventions.
  • Optional: extract common parameters into a reusable step or composite action to reduce duplication across services.

435-443: Review new production deploy step for ActivityPub External service.
Similarly, the Deploy ActivityPub External to Cloud Run step in production matches the staging pattern.

  • Confirm you have the appropriate IAM permissions and service account configuration (prd-activitypub-cicd@ghost-activitypub.iam.gserviceaccount.com) to deploy this additional service.
  • Validate the service name prd-${{ matrix.region_name }}-activitypub-external is declared in your infra code (Terraform/GCP config).
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 8952847 and c7df264.

📒 Files selected for processing (1)
  • .github/workflows/cicd.yml (3 hunks)

Comment on lines +280 to 282
yq -i '.hostRules = (.hostRules // [{"hosts": ["activitypub.ghostinfra.net"], "pathMatcher": "all-paths"}])' config.yml
yq -i '.pathMatchers = (.pathMatchers // [{"name": "all-paths", "defaultService": "'"$DEFAULT_SERVICE"'", "routeRules": []}])' config.yml
# Remove existing route rules for the PR service
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

⚠️ Potential issue

Potential logic issue merging URL map defaults with // operator.
The expressions use (.hostRules // [...]) and (.pathMatchers // [...]), which only set defaults when these fields are missing or null, leaving existing arrays untouched instead of appending or updating entries. This may prevent the all-paths matcher from being applied for ephemeral staging if the fields already exist.
Consider using appends (+=) or transforming existing entries (e.g., map) to update or add the new matcher.

🤖 Prompt for AI Agents
In .github/workflows/cicd.yml around lines 280 to 282, the current use of the
`//` operator only sets default values if `.hostRules` or `.pathMatchers` are
missing or null, but does not append or update existing arrays. To fix this,
modify the yq commands to append the new host rule and path matcher to the
existing arrays using the `+=` operator or use a map transformation to update or
add the `all-paths` matcher, ensuring the ephemeral staging configuration is
correctly applied even when these fields already exist.

@rmgpinto rmgpinto merged commit a071932 into main May 28, 2025
9 checks passed
@rmgpinto rmgpinto deleted the split-api-deployment branch May 28, 2025 13:20
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.

1 participant