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: Use hashicorp/go-version to resolve ~> 1.0 to 1.x instead of 1.0.x #3153

Merged
merged 3 commits into from
Feb 24, 2023

Conversation

zhuoyang
Copy link
Contributor

@zhuoyang zhuoyang commented Feb 23, 2023

what

  • Use go-version from hashicorp for version checking instead of semver
  • add more test cases (I am just duplicating the existing code, feel free to refactor it/ give suggestion)

why

Currently there is a bug by setting "required_version = "~> 1.0" " in version.tf, atlantis will choose 1.0.13 instead of 1.3.9
In terraform "~>" allows only the rightmost version component to increment. (see reference below)

tests

  • I have tested my changes by duplicating the current unit test to include more test cases.
  • Tested in a test environment to confirm everything is working as expected

references

@zhuoyang zhuoyang requested a review from a team as a code owner February 23, 2023 09:29
@github-actions github-actions bot added dependencies PRs that update a dependency file go Pull requests that update Go code labels Feb 23, 2023
@zhuoyang zhuoyang changed the title Use go-version from hashicorp instead of semver bugfix: Use go-version from hashicorp instead of semver Feb 23, 2023
@nitrocode nitrocode changed the title bugfix: Use go-version from hashicorp instead of semver fix: Use hashicorp/go-version to resolve ~> 1.0 to 1.x instead of 1.0.x Feb 23, 2023
Copy link
Member

@nitrocode nitrocode left a comment

Choose a reason for hiding this comment

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

Thank you for the contribution!

@nitrocode nitrocode added this to the v0.23.0 milestone Feb 24, 2023
@nitrocode nitrocode merged commit 629d87f into runatlantis:main Feb 24, 2023
ijames-gc pushed a commit to gocardless/atlantis that referenced this pull request Feb 13, 2024
…of `1.0.x` (runatlantis#3153)

* Use go-version from hashicorp instead of semver

* refactor version test

* restructure test cases
ijames-gc pushed a commit to gocardless/atlantis that referenced this pull request Feb 13, 2024
…of `1.0.x` (runatlantis#3153)

* Use go-version from hashicorp instead of semver

* refactor version test

* restructure test cases
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies PRs that update a dependency file go Pull requests that update Go code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

v0.21+: Pessimistic operator ~> for Terraform version detection not working as expected
2 participants