-
Notifications
You must be signed in to change notification settings - Fork 31
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
feat: add new tool versions datasource #580
Conversation
28586d8
to
7e17c96
Compare
7e17c96
to
d22aaff
Compare
e2b7304
to
1720813
Compare
7cac4af
to
1e57602
Compare
Im not entirely sure why the test is failing, are these queries gated in some fashion that I cannot see? I cant imagine it, all these queries work even anonymously. I thought this might have been a difference in the way the provider is authenticated to spacelift in CI vs my local, but the tests pass locally no matter how I authenticate (generated token vs api key and id). Built the plugin and ran it with tofu: $ tofu apply
╷
│ Warning: Provider development overrides are in effect
│
│ The following provider development overrides are set in the CLI configuration:
│ - spacelift.io/spacelift-io/spacelift in /Users/apollorion/projects/src/github.com/spacelift-io/terraform-provider-spacelift/dist/terraform-provider-spacelift_darwin_arm64
│
│ The behavior may therefore not match any released version of the provider and applying changes may cause the state to become incompatible with published releases.
╵
data.spacelift_tool_versions.kubectl: Reading...
data.spacelift_tool_versions.terragrunt: Reading...
data.spacelift_tool_versions.terraform: Reading...
data.spacelift_tool_versions.opentofu: Reading...
data.spacelift_tool_versions.terragrunt: Read complete after 0s [id=spacelift-versions]
data.spacelift_tool_versions.opentofu: Read complete after 1s [id=spacelift-versions]
data.spacelift_tool_versions.kubectl: Read complete after 1s [id=spacelift-versions]
data.spacelift_tool_versions.terraform: Read complete after 1s [id=spacelift-versions]
Changes to Outputs:
+ kubectl = {
+ id = "spacelift-versions"
+ tool = "KUBECTL"
+ versions = [
+ "1.31.1",
+ "1.31.0",
+ "1.30.5",
...(edited for brevity)
]
}
+ terraform = {
+ id = "spacelift-versions"
+ tool = "TERRAFORM_FOSS"
+ versions = [
+ "1.5.7",
+ "1.5.6",
+ "1.5.5",
...(edited for brevity)
]
}
+ terragrunt = {
+ id = "spacelift-versions"
+ tool = "TERRAGRUNT"
+ versions = [
+ "0.67.2",
+ "0.67.1",
+ "0.67.0",
...(edited for brevity)
]
}
+ tofu = {
+ id = "spacelift-versions"
+ tool = "OPEN_TOFU"
+ versions = [
+ "1.8.4",
+ "1.8.3",
+ "1.8.2",
...(edited for brevity)
]
} I can also run the tests with no problem locally: $ go test ./... -run 'TestToolVersionsData'
? github.com/spacelift-io/terraform-provider-spacelift [no test files]
? github.com/spacelift-io/terraform-provider-spacelift/spacelift/internal [no test files]
? github.com/spacelift-io/terraform-provider-spacelift/spacelift/internal/structs [no test files]
? github.com/spacelift-io/terraform-provider-spacelift/spacelift/internal/structs/search [no test files]
? github.com/spacelift-io/terraform-provider-spacelift/spacelift/internal/structs/search/predicates [no test files]
? github.com/spacelift-io/terraform-provider-spacelift/spacelift/internal/structs/vcs [no test files]
? github.com/spacelift-io/terraform-provider-spacelift/spacelift/internal/testhelpers [no test files]
? github.com/spacelift-io/terraform-provider-spacelift/spacelift/internal/validations [no test files]
ok github.com/spacelift-io/terraform-provider-spacelift/spacelift 32.917s The error says $ tofu refresh
data.spacelift_tool_versions.kubectl: Reading...
data.spacelift_tool_versions.opentofu: Reading...
data.spacelift_tool_versions.terragrunt: Reading...
data.spacelift_tool_versions.terraform: Reading...
data.spacelift_tool_versions.kubectl: Read complete after 0s [id=spacelift-versions]
data.spacelift_tool_versions.terragrunt: Read complete after 0s [id=spacelift-versions]
data.spacelift_tool_versions.terraform: Read complete after 0s [id=spacelift-versions]
data.spacelift_tool_versions.opentofu: Read complete after 0s [id=spacelift-versions]
╷
│ Warning: Empty or non-existent state
│
│ There are currently no remote objects tracked in the state, so there is nothing to refresh.
╵ I dont see what the difference is between CI and my local. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left one question, but other than that LGTM!
@Apollorion the reason the tests are failing in CI is because of a bug in the Spacelift backend code. Here's the relevant error in the logs: The problem is that the API key you'll have generated for local testing isn't quite the same as a Spacelift run token, and the GitHub Actions tests use a token that simulates a Spacelift run. I'll fix the backend issue just now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, looks good, but let's not merge this until we get the backend fix released and the tests pass.
7f0b77b
1e57602
to
7f0b77b
Compare
Pushed up the ID change, once that backend fix is in place tests should pass 👍 @adamconnelly @peterdeme need reapproval :) |
7f0b77b
to
c0590e9
Compare
c0590e9
to
a898304
Compare
Description of the change
Introduce new tool versions datasource, will list out supported tool versions for KUBECTL, OPEN_TOFU, TERRAFORM_FOSS, and TERRAGRUNT.
Type of change
Checklists
Development
false
.)go generate
to make sure the docs are up to dateCode review