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

Fix a reference to an undefined output in GitHub Actions #718

Merged
merged 1 commit into from
Oct 14, 2024

Conversation

suzuki-shunsuke
Copy link
Contributor

@suzuki-shunsuke suzuki-shunsuke commented Oct 13, 2024

what

  1. Fix a reference to an undefined output in GitHub Actions.

terraform_version: ${{ steps.config.outputs.terraform-version }}

The step config is not found.
This bug was added in #612 .

  1. Use a version variable for easier updates.
env:
  TERRAFORM_VERSION: "1.9.7"

steps:
  - uses: hashicorp/setup-terraform@v3
    with:
      terraform_version: ${{ env.TERRAFORM_VERSION }}

#717 (comment)

  1. Stop installing terraform wrapper

By default hashicorp/setup-terraform installs a wrapper of Terraform to output Terraform stdout and stderr as step's outputs.
But we don't need them, so we shouldn't install the wrapper.

https://github.com/hashicorp/setup-terraform

- uses: hashicorp/setup-terraform@v3
  with:
    terraform_wrapper: false

why

references

Summary by CodeRabbit

  • Chores
    • Updated workflow configurations for improved maintainability.
    • Introduced a new environment variable TERRAFORM_VERSION for version management.

Copy link
Contributor

coderabbitai bot commented Oct 13, 2024

📝 Walkthrough
📝 Walkthrough

Walkthrough

The pull request modifies the .github/workflows/test.yml file by introducing a new environment variable TERRAFORM_VERSION set to "1.9.7". It reformats the push event paths-ignore section for consistency. The docker, mock, and lint jobs have been updated to reference this new variable instead of a hardcoded version. Minor formatting adjustments were made for clarity, but no new jobs were added or removed.

Changes

File Change Summary
.github/workflows/test.yml - Added environment variable TERRAFORM_VERSION: "1.9.7"
- Reformatted push event paths-ignore section to use double quotes
- Updated docker, mock, and lint jobs to use ${{ env.TERRAFORM_VERSION }}
- Set terraform_wrapper option to false in docker, mock, and lint jobs

Possibly related PRs

Suggested reviewers

  • gberenice
  • kevcube

🐰 In the garden where bunnies play,
A version change has come our way.
With Terraform set to one point nine,
Our workflows now are looking fine!
So hop along, let's celebrate,
For clearer code is truly great! 🌼


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

Comment on lines 13 to 16
- '.github/**'
- 'docs/**'
- 'examples/**'
- 'test/**'
- ".github/**"
- "docs/**"
- "examples/**"
- "test/**"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, sorry. VSCode edited this. I'll revert the change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed. bb4a99d

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

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE

📥 Commits

Files that changed from the base of the PR and between 6439a64 and 671e3d8.

📒 Files selected for processing (1)
  • .github/workflows/test.yml (5 hunks)
🧰 Additional context used
🔇 Additional comments (4)
.github/workflows/test.yml (4)

13-16: Formatting improvement in paths-ignore

The changes to the paths-ignore section improve consistency by using double quotes for all paths. This is a good practice for maintaining uniform YAML formatting.


275-276: Consistent Terraform setup in mock job

The changes to the Terraform setup in the mock job are consistent with those in the localstack job. This maintains uniformity across the workflow, which is a good practice.


Line range hint 1-332: Overall assessment of changes

The changes in this file align well with the PR objectives and improve the workflow's maintainability:

  1. Introduction of TERRAFORM_VERSION as an environment variable centralizes version management.
  2. Consistent use of this variable across different jobs enhances maintainability.
  3. Explicit setting of terraform_wrapper: false in most jobs aligns with the objective to stop installing the Terraform wrapper.
  4. Formatting improvements and enhanced Docker linting configuration contribute to better code quality.

These changes should make future updates easier and improve the overall reliability of the workflow.


165-166: Updated Terraform setup in localstack job

The changes to the Terraform setup step are good:

  1. Using ${{ env.TERRAFORM_VERSION }} centralizes version management.
  2. Setting terraform_wrapper: false aligns with the PR objective to stop installing the Terraform wrapper.

To ensure these changes don't introduce any issues, let's verify the Terraform setup in other jobs:

✅ Verification successful

Terraform setup verified across all jobs

All Terraform configuration steps correctly utilize the ${{ env.TERRAFORM_VERSION }} and have terraform_wrapper set to false as intended.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if all Terraform setup steps use the environment variable and disable the wrapper
grep -n "terraform_version:" .github/workflows/test.yml
grep -n "terraform_wrapper:" .github/workflows/test.yml

Length of output: 414

.github/workflows/test.yml Outdated Show resolved Hide resolved
Comment on lines +317 to 318
terraform_version: ${{ env.TERRAFORM_VERSION }}
terraform_wrapper: false
Copy link
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Updated Terraform version in lint job

The change to use ${{ env.TERRAFORM_VERSION }} in the lint job is good, maintaining consistency with other jobs.

Consider explicitly setting terraform_wrapper: false here as well, to maintain full consistency with the other jobs and the PR objectives.

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 671e3d8 and bb4a99d.

📒 Files selected for processing (1)
  • .github/workflows/test.yml (4 hunks)
🧰 Additional context used
🔇 Additional comments (4)
.github/workflows/test.yml (4)

165-166: Approve changes in the docker job configuration

The updates to use ${{ env.TERRAFORM_VERSION }} for the Terraform version and explicitly setting terraform_wrapper: false are good improvements. These changes align with the PR objectives and enhance consistency across the workflow.


275-276: Approve changes in the mock job configuration

The updates to use ${{ env.TERRAFORM_VERSION }} for the Terraform version and explicitly setting terraform_wrapper: false in the mock job are good improvements. These changes maintain consistency with other jobs and align with the PR objectives.


317-318: Approve changes in the lint job configuration

The updates to use ${{ env.TERRAFORM_VERSION }} for the Terraform version and explicitly setting terraform_wrapper: false in the lint job are good improvements. These changes maintain consistency with other jobs and align with the PR objectives. The suggestion from a previous review to set terraform_wrapper: false has been addressed.


Line range hint 1-338: Summary of changes to the workflow file

The modifications to .github/workflows/test.yml consistently implement the following improvements:

  1. Introduction of a centralized TERRAFORM_VERSION environment variable.
  2. Usage of this variable across different jobs (docker, mock, and lint).
  3. Explicit setting of terraform_wrapper: false in relevant jobs.

These changes align well with the PR objectives, enhancing maintainability and consistency across the workflow. The updates should make it easier to manage Terraform versions and configurations in the future.

Comment on lines +20 to +22
env:
TERRAFORM_VERSION: "1.9.7"

Copy link
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Approve the addition of TERRAFORM_VERSION environment variable

The introduction of the TERRAFORM_VERSION environment variable is a good improvement. It centralizes the Terraform version definition, making it easier to update across the workflow.

Consider adding a comment explaining why version 1.9.7 was chosen, to provide context for future updates.

@osterman osterman added the no-release Do not create a new release (wait for additional code changes) label Oct 14, 2024
@aknysh aknysh merged commit fecba15 into cloudposse:main Oct 14, 2024
22 of 23 checks passed
@suzuki-shunsuke suzuki-shunsuke deleted the ci-fix-undefined-output branch October 14, 2024 03:04
Copy link

These changes were released in v1.90.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-release Do not create a new release (wait for additional code changes)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants