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

Set azure user agent env for azure provider #105

Merged
merged 3 commits into from
Jan 12, 2023

Conversation

VinozzZ
Copy link
Contributor

@VinozzZ VinozzZ commented Dec 22, 2022

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

@getporterbot getporterbot added this to In Progress in Porter and Mixins Dec 22, 2022
@VinozzZ VinozzZ force-pushed the user-agent branch 4 times, most recently from 5dd7dda to 1a370a5 Compare December 27, 2022 21:38
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
Copy link
Member

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.

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=\""},
Copy link
Member

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?

Copy link
Contributor Author

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>
Copy link
Member

@carolynvs carolynvs left a comment

Choose a reason for hiding this comment

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

LGTM

@carolynvs
Copy link
Member

Oops I spoke too soon, the test is failing. 😊

Signed-off-by: Yingrong Zhao <yingrong.zhao@gmail.com>
@VinozzZ
Copy link
Contributor Author

VinozzZ commented Jan 12, 2023

Oops I spoke too soon, the test is failing. blush

It's still the test data. It should be good now

@VinozzZ VinozzZ merged commit 17f2d52 into getporter:main Jan 12, 2023
Porter and Mixins automation moved this from In Progress to Done Jan 12, 2023
@VinozzZ VinozzZ deleted the user-agent branch January 12, 2023 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

None yet

2 participants