Skip to content

Added ephemeral staging environments tear down job#536

Merged
rmgpinto merged 1 commit intomainfrom
teardown-staging-environments
Apr 16, 2025
Merged

Added ephemeral staging environments tear down job#536
rmgpinto merged 1 commit intomainfrom
teardown-staging-environments

Conversation

@rmgpinto
Copy link
Copy Markdown
Collaborator

ref https://linear.app/ghost/issue/AP-976

  • Added tear down job to destroy deployed PRs that are merged

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 16, 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 3 minutes and 16 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 82ca035 and 495b83c.

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

Walkthrough

A new GitHub Actions workflow named "Ephemeral Staging Tear Down" has been introduced. This workflow can be triggered manually, runs on a schedule every four hours, and also triggers on pull request events (marked for deletion). It runs on an Ubuntu environment with permissions to write id-token, read repository contents, and read pull requests. The main job, destroy-pr, checks out the repository, authenticates with Google Cloud Platform (GCP) using workload identity federation and a specific service account, and identifies ephemeral staging Cloud Run services associated with merged pull requests. If such environments exist, it checks out two additional repositories (activitypub-infra and terraform), determines and sets up the required Terraform version, modifies Terraform module source URLs and configuration placeholders for local use, and re-authenticates with GCP. The workflow then exports and updates GCP Load Balancer URL map configurations to remove routes for merged PRs and runs Terraform destroy commands to tear down the corresponding ephemeral staging environments.

Possibly related PRs

Suggested labels

ricardo.ghost.is


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

@rmgpinto rmgpinto force-pushed the teardown-staging-environments branch from 71cd3ca to 0b956d1 Compare April 16, 2025 13:32
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 (1)
.github/workflows/ephemeral-staging-teardown.yml (1)

96-105: Terraform destroy step is commented out

The actual destruction of ephemeral environments is currently commented out. This is fine for initial testing, but remember to enable this step when you are ready to perform actual teardowns.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between efaad87 and 0b956d1.

📒 Files selected for processing (1)
  • .github/workflows/ephemeral-staging-teardown.yml (1 hunks)
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/ephemeral-staging-teardown.yml

21-21: property "check-labels" is not defined in object type {}

(expression)


47-47: property "check-labels" is not defined in object type {check-closed-prs: {conclusion: string; outcome: string; outputs: {string => string}}}

(expression)


55-55: property "check-labels" is not defined in object type {check-closed-prs: {conclusion: string; outcome: string; outputs: {string => string}}}

(expression)


63-63: property "check-labels" is not defined in object type {check-closed-prs: {conclusion: string; outcome: string; outputs: {string => string}}}

(expression)


69-69: property "check-labels" is not defined in object type {check-closed-prs: {conclusion: string; outcome: string; outputs: {string => string}}; terraform-version: {conclusion: string; outcome: string; outputs: {string => string}}}

(expression)


75-75: property "check-labels" is not defined in object type {check-closed-prs: {conclusion: string; outcome: string; outputs: {string => string}}; terraform-version: {conclusion: string; outcome: string; outputs: {string => string}}}

(expression)


83-83: property "check-labels" is not defined in object type {check-closed-prs: {conclusion: string; outcome: string; outputs: {string => string}}; terraform-version: {conclusion: string; outcome: string; outputs: {string => string}}}

(expression)


91-91: property "check-labels" is not defined in object type {check-closed-prs: {conclusion: string; outcome: string; outputs: {string => string}}; terraform-version: {conclusion: string; outcome: string; outputs: {string => string}}}

(expression)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Build, Test and Push
🔇 Additional comments (1)
.github/workflows/ephemeral-staging-teardown.yml (1)

1-106: Overall: Workflow structure and logic are sound

Aside from the gating issue above, the workflow is well-structured, follows best practices for secrets and environment setup, and is logically correct for the intended purpose.

🧰 Tools
🪛 actionlint (1.7.4)

21-21: property "check-labels" is not defined in object type {}

(expression)


47-47: property "check-labels" is not defined in object type {check-closed-prs: {conclusion: string; outcome: string; outputs: {string => string}}}

(expression)


55-55: property "check-labels" is not defined in object type {check-closed-prs: {conclusion: string; outcome: string; outputs: {string => string}}}

(expression)


63-63: property "check-labels" is not defined in object type {check-closed-prs: {conclusion: string; outcome: string; outputs: {string => string}}}

(expression)


69-69: property "check-labels" is not defined in object type {check-closed-prs: {conclusion: string; outcome: string; outputs: {string => string}}; terraform-version: {conclusion: string; outcome: string; outputs: {string => string}}}

(expression)


75-75: property "check-labels" is not defined in object type {check-closed-prs: {conclusion: string; outcome: string; outputs: {string => string}}; terraform-version: {conclusion: string; outcome: string; outputs: {string => string}}}

(expression)


83-83: property "check-labels" is not defined in object type {check-closed-prs: {conclusion: string; outcome: string; outputs: {string => string}}; terraform-version: {conclusion: string; outcome: string; outputs: {string => string}}}

(expression)


91-91: property "check-labels" is not defined in object type {check-closed-prs: {conclusion: string; outcome: string; outputs: {string => string}}; terraform-version: {conclusion: string; outcome: string; outputs: {string => string}}}

(expression)

Comment thread .github/workflows/ephemeral-staging-teardown.yml Outdated
@rmgpinto rmgpinto force-pushed the teardown-staging-environments branch from 6825260 to 8cf54e5 Compare April 16, 2025 13:41
@rmgpinto rmgpinto force-pushed the teardown-staging-environments branch from 8cf54e5 to 34a5118 Compare April 16, 2025 13:45
ref https://linear.app/ghost/issue/AP-976

- Added tear down job to destroy deployed PRs that are merged
@rmgpinto rmgpinto force-pushed the teardown-staging-environments branch from 82ca035 to 495b83c Compare April 16, 2025 14:30
@rmgpinto rmgpinto merged commit 18c7191 into main Apr 16, 2025
7 checks passed
@rmgpinto rmgpinto deleted the teardown-staging-environments branch April 16, 2025 14:44
vershwal pushed a commit that referenced this pull request Apr 16, 2025
ref https://linear.app/ghost/issue/AP-976

- Added tear down job to destroy deployed PRs that are merged
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