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

terraform: add the version component to terraform provider paths #34497

Merged
merged 1 commit into from Feb 6, 2018

Conversation

siers
Copy link
Member

@siers siers commented Feb 1, 2018

Terraform checks the provider versions, but this breaks if the versions
are not provided, as they can be, if the plugins are provided by nix.

Motivation for this change

Fixes #34423.

I'm not sure whether a quick-fix(see first commit) would be more appropriate here or not.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip" — no, just a couple
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@copumpkin
Copy link
Member

I think this looks good, thanks! @zimbatm any thoughts?

@zimbatm
Copy link
Member

zimbatm commented Feb 1, 2018

I don't get it. Couldn't the plugins be built with the right output format directly?

@copumpkin
Copy link
Member

Oh yeah, that's probably better

@siers
Copy link
Member Author

siers commented Feb 2, 2018

As mentioned in the initial description of the PR, this might work then: siers@4ce469e.

  1. I don't know any other way to change the output binary name, since buildFlags also get passed to non-go build commands, so I just mved it. 2. I also was a little prematurely worried that something else might try to look for the binary of the expected name and not find it, but one should probably wait for that to happen before getting worried.

@zimbatm
Copy link
Member

zimbatm commented Feb 2, 2018

yeah let's do siers@4ce469e with a comment explaining the reason for the rename

@siers
Copy link
Member Author

siers commented Feb 2, 2018

I've added a comment in both source and the commit message, here's the commit siers@5ed1b73 [EDIT: rebased onto the latest master]. Should I create a new PR or…?

Terraform checks the provider versions, but this breaks if the versions
are not provided, as they can be, if the plugins are provided by nix.
@zimbatm
Copy link
Member

zimbatm commented Feb 4, 2018

it's fine to force-push and replace the content of this branch if you want. or create a new PR and @mention me

@siers siers force-pushed the terraform-provider-symlink-versioning branch from 31d0de5 to 5ed1b73 Compare February 5, 2018 10:34
@siers
Copy link
Member Author

siers commented Feb 5, 2018

@zimbatm Hey, I've forced the branch.

@zimbatm
Copy link
Member

zimbatm commented Feb 6, 2018

@GrahamcOfBorg build terraform-full

@GrahamcOfBorg
Copy link

Failure on aarch64-linux (full log)

Partial log (click to expand)

/nix/store/xf987pqr85b49mgwdz3bd7z49szzhk96-terraform-provider-azurerm-1.0.0/share/go/src/github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/golang/protobuf/ptypes/regen.sh: interpreter directive changed from "/bin/bash -e" to "/nix/store/7fxbh1yhagvwbdrmdyyy5ghcjhwjndhs-bash-4.4-p12/bin/bash -e"
/nix/store/xf987pqr85b49mgwdz3bd7z49szzhk96-terraform-provider-azurerm-1.0.0/share/go/src/github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/posener/complete/test.sh: interpreter directive changed from "/usr/bin/env bash" to "/nix/store/7fxbh1yhagvwbdrmdyyy5ghcjhwjndhs-bash-4.4-p12/bin/bash"
/nix/store/xf987pqr85b49mgwdz3bd7z49szzhk96-terraform-provider-azurerm-1.0.0/share/go/src/github.com/terraform-providers/terraform-provider-azurerm/vendor/golang.org/x/sys/unix/mkall.sh: interpreter directive changed from "/usr/bin/env bash" to "/nix/store/7fxbh1yhagvwbdrmdyyy5ghcjhwjndhs-bash-4.4-p12/bin/bash"
/nix/store/xf987pqr85b49mgwdz3bd7z49szzhk96-terraform-provider-azurerm-1.0.0/share/go/src/github.com/terraform-providers/terraform-provider-azurerm/vendor/golang.org/x/sys/unix/mkerrors.sh: interpreter directive changed from "/usr/bin/env bash" to "/nix/store/7fxbh1yhagvwbdrmdyyy5ghcjhwjndhs-bash-4.4-p12/bin/bash"
/nix/store/xf987pqr85b49mgwdz3bd7z49szzhk96-terraform-provider-azurerm-1.0.0/share/go/src/github.com/terraform-providers/terraform-provider-azurerm/vendor/google.golang.org/grpc/codegen.sh: interpreter directive changed from "/usr/bin/env bash" to "/nix/store/7fxbh1yhagvwbdrmdyyy5ghcjhwjndhs-bash-4.4-p12/bin/bash"
/nix/store/xf987pqr85b49mgwdz3bd7z49szzhk96-terraform-provider-azurerm-1.0.0/share/go/src/github.com/terraform-providers/terraform-provider-azurerm/vendor/google.golang.org/grpc/coverage.sh: interpreter directive changed from "/usr/bin/env bash" to "/nix/store/7fxbh1yhagvwbdrmdyyy5ghcjhwjndhs-bash-4.4-p12/bin/bash"
checking for references to /build in /nix/store/xf987pqr85b49mgwdz3bd7z49szzhk96-terraform-provider-azurerm-1.0.0...
cannot build derivation '/nix/store/hd1yj1l7pa82v53ryf2ahp2km5iqpps0-tf-plugin-env.drv': 30 dependencies couldn't be built
cannot build derivation '/nix/store/w1xqbckws4bwn2cilwyp0b71445idcl1-terraform-0.11.3-with-plugins.drv': 1 dependencies couldn't be built
error: build of '/nix/store/w1xqbckws4bwn2cilwyp0b71445idcl1-terraform-0.11.3-with-plugins.drv' failed

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Partial log (click to expand)

/nix/store/6h6va7h33q9hvcg9b4w6z75b4dcrv3hj-terraform-provider-vsphere-1.1.1/share/go/src/github.com/terraform-providers/terraform-provider-vsphere/vendor/google.golang.org/grpc/codegen.sh: interpreter directive changed from "/usr/bin/env bash" to "/nix/store/yq03c2ny43mc24j7dq5riznzb09ddhpq-bash-4.4-p12/bin/bash"
/nix/store/6h6va7h33q9hvcg9b4w6z75b4dcrv3hj-terraform-provider-vsphere-1.1.1/share/go/src/github.com/terraform-providers/terraform-provider-vsphere/vendor/google.golang.org/grpc/install-protobuf.sh: interpreter directive changed from "/usr/bin/env bash" to "/nix/store/yq03c2ny43mc24j7dq5riznzb09ddhpq-bash-4.4-p12/bin/bash"
/nix/store/6h6va7h33q9hvcg9b4w6z75b4dcrv3hj-terraform-provider-vsphere-1.1.1/share/go/src/github.com/terraform-providers/terraform-provider-vsphere/vendor/golang.org/x/sys/unix/mkall.sh: interpreter directive changed from "/usr/bin/env bash" to "/nix/store/yq03c2ny43mc24j7dq5riznzb09ddhpq-bash-4.4-p12/bin/bash"
/nix/store/6h6va7h33q9hvcg9b4w6z75b4dcrv3hj-terraform-provider-vsphere-1.1.1/share/go/src/github.com/terraform-providers/terraform-provider-vsphere/vendor/golang.org/x/sys/unix/mkerrors.sh: interpreter directive changed from "/usr/bin/env bash" to "/nix/store/yq03c2ny43mc24j7dq5riznzb09ddhpq-bash-4.4-p12/bin/bash"
checking for references to /tmp/nix-build-terraform-provider-vsphere-1.1.1.drv-0 in /nix/store/6h6va7h33q9hvcg9b4w6z75b4dcrv3hj-terraform-provider-vsphere-1.1.1...
building path(s) ‘/nix/store/cwdmzz96xgdjrgc5j95pxv1zq1a84hlr-tf-plugin-env’
Use of uninitialized value $path in -e at /nix/store/9g4wc31j7a2xp22xpgwr0qssfxahxdzl-builder.pl line 172.
created 73 symlinks in user environment
building path(s) ‘/nix/store/ixmz361hklgzsnb36dksn15v8rwaijhz-terraform-0.11.3-with-plugins’
/nix/store/ixmz361hklgzsnb36dksn15v8rwaijhz-terraform-0.11.3-with-plugins

@GrahamcOfBorg
Copy link

Success on x86_64-darwin (full log)

Partial log (click to expand)

/nix/store/353ml9fm6nlxbi83vpdwmwv9h4rzf2xx-terraform-provider-triton-0.4.1/share/go/src/github.com/terraform-providers/terraform-provider-triton/vendor/golang.org/x/sys/unix/mkall.sh: interpreter directive changed from "/usr/bin/env bash" to "/nix/store/s8mff1kmnc63b21ybdid2ni0fw7mzy7r-bash-4.4-p12/bin/bash"
/nix/store/353ml9fm6nlxbi83vpdwmwv9h4rzf2xx-terraform-provider-triton-0.4.1/share/go/src/github.com/terraform-providers/terraform-provider-triton/vendor/golang.org/x/sys/unix/mkerrors.sh: interpreter directive changed from "/usr/bin/env bash" to "/nix/store/s8mff1kmnc63b21ybdid2ni0fw7mzy7r-bash-4.4-p12/bin/bash"
/nix/store/353ml9fm6nlxbi83vpdwmwv9h4rzf2xx-terraform-provider-triton-0.4.1/share/go/src/github.com/terraform-providers/terraform-provider-triton/vendor/google.golang.org/genproto/regen.sh: interpreter directive changed from "/bin/bash" to "/nix/store/s8mff1kmnc63b21ybdid2ni0fw7mzy7r-bash-4.4-p12/bin/bash"
/nix/store/353ml9fm6nlxbi83vpdwmwv9h4rzf2xx-terraform-provider-triton-0.4.1/share/go/src/github.com/terraform-providers/terraform-provider-triton/vendor/google.golang.org/grpc/codegen.sh: interpreter directive changed from "/usr/bin/env bash" to "/nix/store/s8mff1kmnc63b21ybdid2ni0fw7mzy7r-bash-4.4-p12/bin/bash"
/nix/store/353ml9fm6nlxbi83vpdwmwv9h4rzf2xx-terraform-provider-triton-0.4.1/share/go/src/github.com/terraform-providers/terraform-provider-triton/vendor/google.golang.org/grpc/vet.sh: interpreter directive changed from "/bin/bash" to "/nix/store/s8mff1kmnc63b21ybdid2ni0fw7mzy7r-bash-4.4-p12/bin/bash"
building '/nix/store/876n5qn03xq9qrj1bcnhjmj9pbqdjyly-tf-plugin-env.drv'...
Use of uninitialized value $path in -e at /nix/store/9g4wc31j7a2xp22xpgwr0qssfxahxdzl-builder.pl line 172.
created 73 symlinks in user environment
building '/nix/store/m3y4vqiw3c2fzhb0xm27v1ylqdklal8z-terraform-0.11.3-with-plugins.drv'...
/nix/store/1cjwk79x5b0q8n9sa6bhgkji66ah6xl2-terraform-0.11.3-with-plugins

@zimbatm zimbatm merged commit 4e63119 into NixOS:master Feb 6, 2018
@siers
Copy link
Member Author

siers commented Feb 15, 2018

Hi @zimbatm, maybe you want to merge this onto the 17.09? It also has the -full packages, so it would surely benefit from this.

@siers siers deleted the terraform-provider-symlink-versioning branch February 15, 2018 11:11
zimbatm pushed a commit that referenced this pull request Feb 15, 2018
)

Terraform checks the provider versions, but this breaks if the versions
are not provided, as they can be, if the plugins are provided by nix.
@zimbatm
Copy link
Member

zimbatm commented Feb 15, 2018

pushed as b2e7bb5

zimbatm pushed a commit that referenced this pull request Sep 27, 2020
Add version to binaries produced via patchGoModVendor to allow run-time provider
version validation by terraform.

This was initially introduced in 4e63119 (terraform: add the version component to terraform provider paths (#34497), 2018-02-06)
but broken in 3e5149a (terraform-providers: fix the google and google-beta providers, 2020-03-24)
for terraform-providers.google and terraform-providers.google-beta, and in 20f55a9 (terraform-providers.ibm: move to update-all script, 2020-04-26)
for terraform-providers.ibm.
anandsuresh pushed a commit to anandsuresh/nixpkgs that referenced this pull request Jan 27, 2021
…#97590)

Add version to binaries produced via patchGoModVendor to allow run-time provider
version validation by terraform.

This was initially introduced in 4e63119 (terraform: add the version component to terraform provider paths (NixOS#34497), 2018-02-06)
but broken in 3e5149a (terraform-providers: fix the google and google-beta providers, 2020-03-24)
for terraform-providers.google and terraform-providers.google-beta, and in 20f55a9 (terraform-providers.ibm: move to update-all script, 2020-04-26)
for terraform-providers.ibm.

(cherry picked from commit 94d2aeb)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

terraform_0_11-full@unstable: can't init providers if version = "> 0"
5 participants