-
Notifications
You must be signed in to change notification settings - Fork 21
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
Set azure user agent env for azure provider #105
Conversation
5dd7dda
to
1a370a5
Compare
Signed-off-by: Yingrong Zhao <yingrong.zhao@gmail.com>
@@ -51,6 +51,28 @@ Then use `initFile` to specify the relative path to this file within workingDir. | |||
This will dramatically improve Docker image layer caching and performance when building, publishing and installing the bundle. | |||
> Note: this approach isn't suitable when using terraform modules as those need to be "initilized" as well but aren't specified in the `initFile`. You shouldn't specifiy an `initFile` in this situation. | |||
|
|||
### User Agent Opt Out | |||
|
|||
When you declare the mixin, you can disable the mixin from customizing the azure user agent string |
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.
We should add in a follow-up PR more language that encourages people to identify how to support user agents for other providers, like aws. The aws mixin uses a user agent string too, and there may be more providers as well that would find this useful.
pkg/terraform/build_test.go
Outdated
expectedUserAgent string | ||
}{ | ||
{name: "build with custom config", inputFile: "testdata/build-input-with-config.yaml", expectedVersion: "https://releases.hashicorp.com/terraform/0.13.0-rc1/terraform_0.13.0-rc1_linux_amd64.zip", expectedUserAgent: "ENV PORTER_TERRAFORM_MIXIN_USER_AGENT_OPT_OUT=\"true\"\nENV AZURE_HTTP_USER_AGENT=\"\""}, | ||
{name: "build with the default Terraform config", expectedVersion: "https://releases.hashicorp.com/terraform/1.2.9/terraform_1.2.9_linux_amd64.zip", expectedUserAgent: "ENV PORTER_TERRAFORM_MIXIN_USER_AGENT_OPT_OUT=\"false\"\nENV AZURE_HTTP_USER_AGENT=\""}, |
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.
Shouldn't the AZURE_HTTP_USER_AGENT
environment variable be set in the dockerfile for this test case?
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.
Oops, just fixed it
Signed-off-by: Yingrong Zhao <yingrong.zhao@gmail.com>
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.
LGTM
Oops I spoke too soon, the test is failing. 😊 |
Signed-off-by: Yingrong Zhao <yingrong.zhao@gmail.com>
It's still the test data. It should be good now |
This PR sets Azure User Agent environment variable so that the azure terraform provider will be able to pick it up.
Users have options to opt out of it by setting the corresponding config.
related issue: #103