Skip to content

Conversation

@rmgpinto
Copy link
Collaborator

@rmgpinto rmgpinto commented May 9, 2025

ref no-issue

  • Fixed a bug where multiple labels would not work on the ephemeral staging routing. It needs to add a route per label (site).

@coderabbitai
Copy link

coderabbitai bot commented May 9, 2025

Warning

Rate limit exceeded

@rmgpinto has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 16 minutes and 42 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between f931db7 and 2d5ac6d.

📒 Files selected for processing (2)
  • .github/workflows/cicd.yml (1 hunks)
  • .github/workflows/ephemeral-staging-teardown.yml (1 hunks)

Walkthrough

This change updates the GitHub Actions CI/CD workflow by disabling the "Run Tests" step in the build-test-push job through commenting it out. In the deploy-pr job, the method of updating the GCP Load Balancer URL map is revised to use in-place editing with yq instead of temporary file redirection. The addition of route rules for the PR service is altered from a single rule with multiple header matches to multiple individual rules, each corresponding to a matching label with incremented priority. The final command to import the updated URL map into GCP remains unchanged.

Possibly related PRs

  • Added ephemeral staging environments #432: The main PR modifies the deploy-pr job's logic for updating GCP Load Balancer URL map route rules by changing from appending a single rule with multiple header matches to adding separate rules per label, directly building upon the deploy-pr job and load balancer configuration updates introduced in the retrieved PR.

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.
    • 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.

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

@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 (2)
.github/workflows/cicd.yml (2)

105-107: Verify intentional disabling of the test step

Commenting out the "Run Tests" step will completely skip unit/integration tests in CI. Ensure this is intentional (e.g., tests have been moved or replaced) or re-enable it to maintain coverage.


267-285: Iterate per-label to add separate route rules

This loop correctly implements the PR objective by creating an individual route rule for each .ghost.is label and incrementally updating priority.
Optional improvement: use yq --arg priority "$NEXT_PRIORITY" --arg label "$LABEL" to inject shell variables safely and simplify the quoting in your inline script.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 2437d79 and c6dc0bb.

📒 Files selected for processing (1)
  • .github/workflows/cicd.yml (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: (ephemeral staging) Deploy

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: 2

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

278-278: Restore the URL map import command
The final gcloud compute url-maps import is still commented out, so the updated config.yml will never be applied. Please uncomment this line.

-          #gcloud compute url-maps import stg-activitypub --source=config.yml --global --project ${GCP_PROJECT} --quiet
+          gcloud compute url-maps import stg-activitypub --source=config.yml --global --project ${GCP_PROJECT} --quiet
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between c6dc0bb and d66d17e.

📒 Files selected for processing (1)
  • .github/workflows/cicd.yml (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: (ephemeral staging) Deploy

Comment on lines 105 to 106
#- name: "Run Tests"
# run: yarn test
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Re-enable test execution
The “Run Tests” step is commented out, effectively disabling automated tests on PRs. This undermines the CI pipeline’s purpose and risks shipping unvalidated code. Please restore this step.

Apply this diff to re-enable tests:

-      #- name: "Run Tests"
-      #  run: yarn test
+      - name: "Run Tests"
+        run: yarn test
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
#- name: "Run Tests"
# run: yarn test
- name: "Run Tests"
run: yarn test

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: 2

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

105-106: Re-enable test execution
The “Run Tests” step is commented out, disabling automated tests for PRs and undermining CI validation. Please uncomment these lines to restore test execution.


276-276: Restore URL map import step
The final gcloud compute url-maps import is still commented out, so changes to config.yml will never be applied. Please uncomment it to deploy the updated routing rules:

-          #gcloud compute url-maps import stg-activitypub --source=config.yml --global --project ${GCP_PROJECT} --quiet
+          gcloud compute url-maps import stg-activitypub --source=config.yml --global --project ${GCP_PROJECT} --quiet
🧹 Nitpick comments (1)
.github/workflows/cicd.yml (1)

268-273: Use name-based pathMatcher selection
Indexing into .pathMatchers[0] assumes it’s always the first element. To make this resilient against reordering or future changes, target the matcher by name:

- yq -i '.pathMatchers[0].routeRules += ...' config.yml
+ yq -i '.pathMatchers[] |= (select(.name=="staging-environments") .routeRules += ...)' config.yml

This ensures you’re always appending to the correct matcher.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between d66d17e and c8c9f77.

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

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: 1

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

105-106: Re-enable the test execution step
The “Run Tests” step is still commented out, which means your CI won’t validate code changes on PRs. Please restore this step to ensure tests run on every build.

-      #- name: "Run Tests"
-      #  run: yarn test
+      - name: "Run Tests"
+        run: yarn test
🧹 Nitpick comments (1)
.github/workflows/cicd.yml (1)

265-270: Optional: Simplify variable interpolation in yq invocations
Embedding Bash variables inside single-quoted yq expressions is brittle and hard to maintain. Consider using env() within yq to inject NEXT_PRIORITY and HEADER_MATCHES, for example:

- yq -i '.pathMatchers[0].routeRules += [{"priority": '$NEXT_PRIORITY', … "exactMatch": "'$LABEL'" }]' config.yml
+ yq -i '
    .pathMatchers[0].routeRules += [{
      priority: (env(NEXT_PRIORITY) | tonumber),
      matchRules: [{
        prefixMatch: "/",
        headerMatches: (env(HEADER_MATCHES) | fromjson)
      }],
      routeAction: {weightedBackendServices: [{backendService: env(PR_SERVICE), weight: 100}]}
    }]
  ' config.yml

This keeps the YAML manipulation self-contained and improves readability.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between dc2e843 and f931db7.

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

Comment on lines +253 to 262
yq -i 'del(.fingerprint)' config.yml
yq -i 'del(.creationTimestamp)' config.yml
export DEFAULT_SERVICE="https://www.googleapis.com/compute/v1/projects/ghost-activitypub/global/backendServices/stg-netherlands-activitypub-api"
export PR_SERVICE="https://www.googleapis.com/compute/v1/projects/ghost-activitypub/global/backendServices/stg-pr-${{ github.event.pull_request.number }}-api"
# Add host rules and path matchers if they don't exist
yq '.hostRules = (.hostRules // [{"hosts": ["activitypub.ghostinfra.net"], "pathMatcher": "staging-environments"}])' config.yml > config.yml.tmp
mv config.yml.tmp config.yml
yq '.pathMatchers = (.pathMatchers // [{"name": "staging-environments", "defaultService": "'"$DEFAULT_SERVICE"'", "routeRules": []}])' config.yml > config.yml.tmp
mv config.yml.tmp config.yml
yq -i '.hostRules = (.hostRules // [{"hosts": ["activitypub.ghostinfra.net"], "pathMatcher": "staging-environments"}])' config.yml
yq -i '.pathMatchers = (.pathMatchers // [{"name": "staging-environments", "defaultService": "'"$DEFAULT_SERVICE"'", "routeRules": []}])' config.yml
# Remove existing route rules for the PR service
yq '.pathMatchers[] |= (.routeRules |= map(select((.routeAction.weightedBackendServices // []) | length == 0 or .routeAction.weightedBackendServices[0].backendService != env(PR_SERVICE))))' config.yml > config.yml.tmp
mv config.yml.tmp config.yml
yq -i '.pathMatchers[] |= (.routeRules |= map(select((.routeAction.weightedBackendServices // []) | length == 0 or .routeAction.weightedBackendServices[0].backendService != env(PR_SERVICE))))' config.yml
# Add new route rules for the PR service
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Ensure yq is installed before use
You’re invoking yq -i on multiple lines, but GitHub’s Ubuntu runners don’t include yq by default. Add an installation step prior to any yq command to avoid failures:

- name: Install yq
  run: |
    sudo apt-get update
    sudo apt-get install -y yq

Place this immediately before your “Add route to GCP Load Balancer” step.

@rmgpinto rmgpinto force-pushed the fix-ephemeral-staging-multiple-labels branch from f931db7 to 2164e2f Compare May 10, 2025 13:46
ref no-issue

- Fixed a bug where multiple labels would not work on the ephemeral
staging routing. It needs to add a route per label (site).
@rmgpinto rmgpinto force-pushed the fix-ephemeral-staging-multiple-labels branch from 2164e2f to 2d5ac6d Compare May 10, 2025 13:48
@rmgpinto rmgpinto merged commit 7be76a0 into main May 12, 2025
19 checks passed
@rmgpinto rmgpinto deleted the fix-ephemeral-staging-multiple-labels branch May 12, 2025 09:21
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.

2 participants