Skip to content

Changed ci/cd to support second pub/sub topic#796

Merged
rmgpinto merged 1 commit intomainfrom
cicd-pubsub-2
Jun 6, 2025
Merged

Changed ci/cd to support second pub/sub topic#796
rmgpinto merged 1 commit intomainfrom
cicd-pubsub-2

Conversation

@rmgpinto
Copy link
Copy Markdown
Collaborator

@rmgpinto rmgpinto commented Jun 6, 2025

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

  • Changed ci/cd to support the second pub/sub topic. Includes deployments to two new services: ghost-queue and fedify-queue.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 6, 2025

Walkthrough

The GitHub Actions CI/CD workflow was updated to replace the single queue image environment variable with two separate variables for "fedify" and "ghost" queues. Both staging and production deployment jobs were modified to deploy these two queues as separate Cloud Run services, each named with appropriate suffixes and using the same Docker image tag. These deployments include skipping default labels and adding a commit SHA label. The original single "ActivityPub Queue" deployment remains unchanged. No changes were made to exported or public code entities.

Possibly related PRs

Suggested labels

ricardo.ghost.is

Suggested reviewers

  • vershwal

📜 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 f1b6cbf and 850bf95.

📒 Files selected for processing (1)
  • .github/workflows/cicd.yml (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/cicd.yml
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Build, Test and Push

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.

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

♻️ Duplicate comments (2)
.github/workflows/cicd.yml (2)

453-458: Duplicate staging queue deployment step.

Same pattern as the Fedify queue deployment. Apply the matrix refactor suggested above to this Ghost queue step.


527-532: Duplicate production queue deployment step.

Same pattern as the Fedify queue in production. Please apply the matrix refactor above here as well to reduce duplication.

🧹 Nitpick comments (2)
.github/workflows/cicd.yml (2)

443-452: Consider abstracting duplicate staging queue deployments with a matrix.

The new Fedify queue deployment step mirrors the Ghost queue step. You can DRY this by using a matrix for queue names, reducing maintenance overhead. For example:

 jobs:
   deploy-staging:
-    strategy:
-      matrix:
-        region: [europe-west4, europe-west3]
-    steps:
-      - name: "Deploy ActivityPub Fedify Queue to Cloud Run"
-        uses: google-github-actions/deploy-cloudrun@v2
-        with:
-          image: europe-docker.pkg.dev/ghost-activitypub/activitypub/activitypub:${{ needs.build-test-push.outputs.activitypub_docker_version }}
-          region: ${{ matrix.region }}
-          service: stg-${{ matrix.region_name }}-activitypub-fedify-queue
-          skip_default_labels: true
-          labels: |-
-            commit-sha=${{ github.sha }}
+    strategy:
+      matrix:
+        region: [europe-west4, europe-west3]
+        queue: [fedify, ghost]
+    steps:
+      - name: "Deploy ActivityPub Queue (${{ matrix.queue }}) to Cloud Run"
+        uses: google-github-actions/deploy-cloudrun@v2
+        with:
+          image: europe-docker.pkg.dev/ghost-activitypub/activitypub/activitypub:${{ needs.build-test-push.outputs.activitypub_docker_version }}
+          region: ${{ matrix.region }}
+          service: stg-${{ matrix.region_name }}-activitypub-${{ matrix.queue }}-queue
+          skip_default_labels: true
+          labels: |-
+            commit-sha=${{ github.sha }}

517-526: Consider abstracting duplicate production queue deployments with a matrix.

The production Fedify queue deployment mirrors the Ghost queue step. Apply a similar matrix strategy as suggested for staging to reduce duplication:

 jobs:
   deploy-production:
-    strategy:
-      matrix:
-        region: [europe-west4, europe-west3]
-    steps:
-      - name: "Deploy ActivityPub Fedify Queue to Cloud Run"
-        uses: google-github-actions/deploy-cloudrun@v2
-        with:
-          image: europe-docker.pkg.dev/ghost-activitypub/activitypub/activitypub:${{ needs.build-test-push.outputs.activitypub_docker_version }}
-          region: ${{ matrix.region }}
-          service: prd-${{ matrix.region_name }}-activitypub-fedify-queue
-          skip_default_labels: true
-          labels: |-
-            commit-sha=${{ github.sha }}
+    strategy:
+      matrix:
+        region: [europe-west4, europe-west3]
+        queue: [fedify, ghost]
+    steps:
+      - name: "Deploy ActivityPub Queue (${{ matrix.queue }}) to Cloud Run"
+        uses: google-github-actions/deploy-cloudrun@v2
+        with:
+          image: europe-docker.pkg.dev/ghost-activitypub/activitypub/activitypub:${{ needs.build-test-push.outputs.activitypub_docker_version }}
+          region: ${{ matrix.region }}
+          service: prd-${{ matrix.region_name }}-activitypub-${{ matrix.queue }}-queue
+          skip_default_labels: true
+          labels: |-
+            commit-sha=${{ github.sha }}
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between d01149d and f1b6cbf.

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

309-311:

Details

❓ Verification inconclusive

Verify Terraform variable declarations for new queue images.

Ensure that fedify_queue_image and ghost_queue_image are declared in your Terraform modules so that the TF_VAR_* environment variables take effect. Otherwise, Terraform will ignore these values.

Run the following to confirm the variables exist:


🏁 Script executed:

#!/bin/bash
# Verify Terraform variable declarations
rg -n 'variable "fedify_queue_image"' -n
rg -n 'variable "ghost_queue_image"' -n

Length of output: 84


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Verify Terraform variable declarations for queue images in all .tf files
rg --glob '*.tf' -n 'variable "fedify_queue_image"'
rg --glob '*.tf' -n 'variable "ghost_queue_image"'

# Also check for any occurrences to catch usage without explicit declaration
rg --glob '*.tf' -n 'fedify_queue_image'
rg --glob '*.tf' -n 'ghost_queue_image'

Length of output: 222


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "🔍 Listing all .tf files in the repository:"
find . -type f -name '*.tf' -print

echo "🔍 Searching for any Terraform variable declarations in those files:"
rg -n 'variable ' --glob '*.tf' || echo "No variable declarations found."

echo "🔍 Searching specifically for our queue image variables:"
rg -n 'fedify_queue_image' --glob '*.tf' || echo "No occurrences of 'fedify_queue_image' found."
rg -n 'ghost_queue_image' --glob '*.tf' || echo "No occurrences of 'ghost_queue_image' found."

Length of output: 1270


Manual verification needed: Confirm Terraform variable declarations for queue images

It appears no .tf files are present in this repository, so Terraform may be applying against remote modules or code checked out elsewhere. Please ensure that the following variables are declared in your Terraform configurations (local or remote) so that the TF_VAR_* environment variables set in .github/workflows/cicd.yml take effect:

  • fedify_queue_image
  • ghost_queue_image

You can verify by running, for example:

grep -R 'variable "fedify_queue_image"' path/to/terraform
grep -R 'variable "ghost_queue_image"' path/to/terraform

Without these declarations, Terraform will ignore the queue image overrides.

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

- Changed ci/cd to support the second pub/sub topic. Includes
deployments to two new services: ghost-queue and fedify-queue.
@rmgpinto rmgpinto merged commit 4d43925 into main Jun 6, 2025
9 checks passed
@rmgpinto rmgpinto deleted the cicd-pubsub-2 branch June 6, 2025 21:09
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