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

lang/funcs: Add sortsemver function #22689

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

vsimon
Copy link
Contributor

@vsimon vsimon commented Sep 4, 2019

Reference: #22688
To support re-ordering the elements of a given list of strings so that
the elements matching a given version constraint are returned in
precedence order.

@hashicorp-cla
Copy link

hashicorp-cla commented Sep 4, 2019

CLA assistant check
All committers have signed the CLA.

@ghost ghost added the sdkv1 [PRs only] Marks changes that may potentially need to be ported to the plugi nSDK label Sep 9, 2019
@codecov
Copy link

codecov bot commented Aug 8, 2020

Codecov Report

Merging #22689 (66423da) into master (4e345b6) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted Files Coverage Δ
backend/remote/backend.go 62.42% <ø> (ø)
lang/funcs/string.go 100.00% <100.00%> (ø)
lang/functions.go 96.29% <100.00%> (+0.02%) ⬆️
internal/providercache/dir.go 67.34% <0.00%> (-6.13%) ⬇️

@vsimon vsimon force-pushed the sortsemver branch 3 times, most recently from 78fe23b to 0cbb213 Compare August 9, 2020 00:29
@vsimon
Copy link
Contributor Author

vsimon commented Aug 10, 2020

Hello, it's been awhile but I've updated this aged PR to address:

  1. Using hashicorp/go-version and its NewSemver function for parsing.
  2. Adding a version constraint. Constraints are defined and supported by https://godoc.org/github.com/hashicorp/go-version#Constraint
  3. Using sort.Stable (and by extension go-version's LessThan function)
  4. Updating tests and documentation

@vsimon
Copy link
Contributor Author

vsimon commented Oct 26, 2020

ping @teamterraform

@vsimon
Copy link
Contributor Author

vsimon commented Nov 29, 2020

ping @teamterraform

@vsimon
Copy link
Contributor Author

vsimon commented Dec 2, 2020

Sorry for pings @apparentlymart @mildwonkey but would you know if anybody would be able to look at this?

@vsimon
Copy link
Contributor Author

vsimon commented Dec 28, 2020

ping

@vsimon
Copy link
Contributor Author

vsimon commented Jan 5, 2021

ping @alisdair 🙏

@vsimon vsimon force-pushed the sortsemver branch 7 times, most recently from aaab3a1 to 66423da Compare February 21, 2021 19:30
Base automatically changed from master to main February 24, 2021 18:01
Reference: hashicorp#22688
To support re-ordering the elements of a given list of strings so that
the elements matching a given version constraint are returned in
precedence order.
@vsimon
Copy link
Contributor Author

vsimon commented Jun 30, 2021

ping @teamterraform @alisdair for a re-look 🙏

@superbobdthm
Copy link

This would be a big help to my projects @teamterraform @alisdair

@superbobdthm
Copy link

ping @teamterraform @alisdair for a re-look

@vsimon Thank you for your continual effort to get this merged.

@arvsr1988
Copy link

ping @teamterraform @alisdair for a re-look

@crw
Copy link
Collaborator

crw commented Jun 11, 2022

Thanks for this submission! As to why this PR has not been reviewed, please see this comment: #28855 (comment), specifically:

We're being pretty cautious about adding new functions that overlap with existing use-cases because Terraform has grown quite an unwieldy collection of builtins over the years, and so we've been considering various ways to allow for externally-defined functions (e.g. #2771) to avoid continuing to grow that set. However, that's not something we'll be working on in the very near future, due to our current focus being elsewhere, so we'll revisit this at a later time and post any updates in those other issues.

In this case, at this time, the team believes a sortSemVer function would be better suited as a plugin than as a built-in function. I will certainly update this PR when this "function plugin" functionality is available. Thanks again for your submission and for the interest in this function.

@boxrick
Copy link

boxrick commented Mar 31, 2023

Would love to see this integrated even if the plan for built-ins changes over time

@crw
Copy link
Collaborator

crw commented Aug 30, 2024

Just a heads-up that Provider-defined Functions were released in Terraform 1.8. Please see the documentation here: https://developer.hashicorp.com/terraform/plugin/framework/functions

I will leave this PR open as I believe the champions of this issue believe this should be a built-in function, but if you find a way to contribute this via the provider functions, please let us know. Thanks!

@crw crw added the functions label Aug 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
config enhancement functions sdkv1 [PRs only] Marks changes that may potentially need to be ported to the plugi nSDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants