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

💸 cost: Adds infracost workflow, app hasn't been working well #12

Merged
merged 1 commit into from
Aug 23, 2024

Conversation

bendoerr
Copy link
Member

@bendoerr bendoerr commented Aug 22, 2024

Summary by CodeRabbit

  • New Features

    • Introduced an automated workflow to estimate cloud infrastructure costs for pull requests.
    • Provides immediate feedback on cost implications directly within pull requests.
    • Enhances cost awareness and decision-making for developers.
  • Chores

    • Added a GitHub Actions workflow file for the Infracost integration.

Copy link
Contributor

coderabbitai bot commented Aug 22, 2024

Walkthrough

A new GitHub Actions workflow file, .github/workflows/infracost.yml, has been introduced to automate cloud infrastructure cost estimation for pull requests using Infracost. The workflow is triggered by pull request events and includes steps for setting up Infracost, checking out branches, generating cost breakdowns, and posting comments with cost results.

Changes

File Change Summary
.github/workflows/infracost.yml Introduced a workflow to automate cloud infrastructure cost estimation for pull requests using Infracost, including setup and commenting on cost results.

Poem

In fields of code, we hop and play,
With Infracost, we save the day! 🌼
Pull requests bloom, costs we unveil,
A joyful journey, we shall not fail!
Through branches wide, we leap and bound,
In savings found, our hearts are crowned! 🐇✨


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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

deepsource-io bot commented Aug 22, 2024

Here's the code health analysis summary for commits 7f78a6a..2edafea. View details on DeepSource ↗.

Analysis Summary

AnalyzerStatusSummaryLink
DeepSource Secrets LogoSecrets✅ SuccessView Check ↗
DeepSource Terraform LogoTerraform✅ SuccessView Check ↗
DeepSource Go LogoGo✅ SuccessView Check ↗

💡 If you’re a repository administrator, you can configure the quality gates from the settings.

Copy link

github-actions bot commented Aug 22, 2024

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

OpenSSF Scorecard

PackageVersionScoreDetails
actions/actions/checkout 692973e3d937129bcbf40652eb9f2f61becf3332 🟢 6.9
Details
CheckScoreReason
Code-Review🟢 10all changesets reviewed
Maintained🟢 45 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 4
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
License🟢 10license file detected
Signed-Releases⚠️ -1no releases found
Branch-Protection⚠️ -1internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration
Binary-Artifacts🟢 10no binaries found in the repo
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Token-Permissions⚠️ 0detected GitHub workflow tokens with excessive permissions
Fuzzing⚠️ 0project is not fuzzed
Pinned-Dependencies🟢 4dependency not pinned by hash detected -- score normalized to 4
Security-Policy🟢 9security policy file detected
Packaging🟢 10packaging workflow detected
SAST🟢 10SAST tool is run on all commits
Vulnerabilities🟢 91 existing vulnerabilities detected
actions/infracost/actions/setup e9d6e6cd65e168e76b0de50ff9957d2fe8bb1832 UnknownUnknown

Scanned Manifest Files

.github/workflows/infracost.yml

@github-actions github-actions bot added the cicd Adjustments to the CI/CD/Action Workflows label Aug 22, 2024
Copy link
Contributor

@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

Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE

Commits

Files that changed from the base of the PR and between 7f78a6a and 9e66862.

Files selected for processing (1)
  • .github/workflows/infracost.yml (1 hunks)
Additional context used
actionlint
.github/workflows/infracost.yml

51-51: shellcheck reported issue in this script: SC2086:info:2:33: Double quote to prevent globbing and word splitting

(shellcheck)

Additional comments not posted (3)
.github/workflows/infracost.yml (3)

3-6: Trigger configuration is appropriate.

The workflow is correctly set to trigger on pull requests to the main branch for the events opened, synchronize, and reopened.


8-17: Permissions configuration is correct.

The workflow has appropriate permissions to read contents and write pull requests.


11-13: Job configuration is standard.

The job is configured to run on ubuntu-latest, which is suitable for this workflow.

.github/workflows/infracost.yml Outdated Show resolved Hide resolved
@bendoerr bendoerr force-pushed the ci/add-infracost-action branch from 9e66862 to 681672d Compare August 23, 2024 00:14
Copy link
Contributor

@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

Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE

Commits

Files that changed from the base of the PR and between 9e66862 and 681672d.

Files selected for processing (1)
  • .github/workflows/infracost.yml (1 hunks)
Additional comments not posted (5)
.github/workflows/infracost.yml (5)

3-6: LGTM! The trigger configuration is appropriate.

The workflow is correctly set to trigger on pull request events for the main branch.


8-17: LGTM! The permissions configuration is appropriate.

The permissions are correctly set for reading contents and writing to pull requests.


11-13: LGTM! The job configuration is appropriate.

The job is correctly set to run on ubuntu-latest.


19-28: Ensure proper quoting in shell commands.

There is an existing shellcheck warning regarding quoting variables to prevent globbing and word splitting.

Apply the existing suggestion to fix the issue.


51-57: Ensure proper quoting in shell commands.

There is an existing shellcheck warning regarding quoting variables to prevent globbing and word splitting.

Apply the existing suggestion to fix the issue.

@bendoerr bendoerr force-pushed the ci/add-infracost-action branch from 681672d to 2edafea Compare August 23, 2024 00:41
Copy link

💰 Infracost report

This pull request is aligned with your company's FinOps policies and the Well-Architected Framework.

There are also 2 pre-existing issues in the main branch. Fix some to climb your org’s leaderboard 🥇

This comment will be updated when code changes.

@bendoerr
Copy link
Member Author

@coderabbitai review

Copy link
Contributor

coderabbitai bot commented Aug 23, 2024

Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Contributor

coderabbitai bot commented Aug 23, 2024

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

Commits

Files that changed from the base of the PR and between 7f78a6a and 2edafea.

Files selected for processing (1)
  • .github/workflows/infracost.yml (1 hunks)
_______________________________
< Copilot: Off. CodeRabbit: On. >
-------------------------------
 \
  \   (\__/)
      (•ㅅ•)
      /   づ

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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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
Contributor

@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

Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE

Commits

Files that changed from the base of the PR and between 7f78a6a and 2edafea.

Files selected for processing (1)
  • .github/workflows/infracost.yml (1 hunks)
Additional comments not posted (5)
.github/workflows/infracost.yml (5)

3-10: Trigger and permissions setup looks good.

The workflow is appropriately triggered on pull requests to the main branch, and the permissions are correctly set for the intended actions.


11-22: Job setup and Infracost setup step look good.

The job runs on ubuntu-latest, and the Infracost setup uses a specific commit hash for stability. The API key is securely accessed via secrets.


24-32: Checkout and breakdown steps are correctly implemented.

The base branch is checked out using a specific commit hash, and the cost breakdown command is correctly configured.


34-42: Diff generation step is correctly implemented.

The PR branch is checked out, and the diff command is correctly configured to compare costs with the base branch.


44-57: Comment posting step is correctly implemented.

The comment is posted using the 'update' behavior, which is the most efficient option for this use case.

@bendoerr bendoerr merged commit 9988c21 into main Aug 23, 2024
17 checks passed
@bendoerr bendoerr deleted the ci/add-infracost-action branch August 23, 2024 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cicd Adjustments to the CI/CD/Action Workflows
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant