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

Make the user agent configurable for link checker scripts #1302

Merged
4 commits merged into from
Jan 7, 2021

Conversation

sima-zhu
Copy link
Contributor

@sima-zhu sima-zhu commented Jan 6, 2021

No description provided.

@sima-zhu sima-zhu changed the title Make the user agent configurable. Make the user agent configurable for link checker scripts Jan 6, 2021
@azure-sdk
Copy link
Collaborator

The following pipelines have been queued for testing:
java - template
java - template - tests
js - template
net - template
net - template - tests
python - template
python - template - tests
You can sign off on the approval gate to test the release stage of each pipeline.
See eng/common workflow

@azure-sdk
Copy link
Collaborator

The following pipelines have been queued for testing:
java - template
java - template - tests
js - template
net - template
net - template - tests
python - template
python - template - tests
You can sign off on the approval gate to test the release stage of each pipeline.
See eng/common workflow

@azure-sdk
Copy link
Collaborator

The following pipelines have been queued for testing:
java - template
java - template - tests
js - template
net - template
net - template - tests
python - template
python - template - tests
You can sign off on the approval gate to test the release stage of each pipeline.
See eng/common workflow

@azure-sdk
Copy link
Collaborator

The following pipelines have been queued for testing:
java - template
java - template - tests
js - template
net - template
net - template - tests
python - template
python - template - tests
You can sign off on the approval gate to test the release stage of each pipeline.
See eng/common workflow

@azure-sdk
Copy link
Collaborator

The following pipelines have been queued for testing:
java - template
java - template - tests
js - template
net - template
net - template - tests
python - template
python - template - tests
You can sign off on the approval gate to test the release stage of each pipeline.
See eng/common workflow

@azure-sdk
Copy link
Collaborator

The following pipelines have been queued for testing:
java - template
java - template - tests
js - template
net - template
net - template - tests
python - template
python - template - tests
You can sign off on the approval gate to test the release stage of each pipeline.
See eng/common workflow

@azure-sdk
Copy link
Collaborator

The following pipelines have been queued for testing:
java - template
java - template - tests
js - template
net - template
net - template - tests
python - template
python - template - tests
You can sign off on the approval gate to test the release stage of each pipeline.
See eng/common workflow

@sima-zhu sima-zhu marked this pull request as ready for review January 6, 2021 22:47
@sima-zhu sima-zhu requested a review from a team as a code owner January 6, 2021 22:47
@sima-zhu sima-zhu requested review from weshaggard and removed request for a team January 6, 2021 22:47
@azure-sdk
Copy link
Collaborator

The following pipelines have been queued for testing:
java - template
java - template - tests
js - template
net - template
net - template - tests
python - template
python - template - tests
You can sign off on the approval gate to test the release stage of each pipeline.
See eng/common workflow

@@ -8,7 +8,7 @@ parameters:
Urls: '(Get-ChildItem -Path ./ -Recurse -Include *.md)'
BranchReplaceRegex: "^(${env:SYSTEM_PULLREQUEST_SOURCEREPOSITORYURI}.*/(?:blob|tree)/)master(/.*)$"
BranchReplacementName: "${env:SYSTEM_PULLREQUEST_SOURCECOMMITID}"

UserAgent: ${env:USERAGENT}
Copy link
Member

Choose a reason for hiding this comment

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

Should we just default this to empty? Or do you expect that we would set this as a pipeline variable?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I plan to set it through pipeline variable as it does not affect all pipelines. Just want to limit use the custom userAgent setting.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Some links prefer specific userAgent. We currently do not have the full picture of all scenarios, so I prefer to use pipeline UI variable which is easy to test and modify.

Copy link
Member

Choose a reason for hiding this comment

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

If we can get the default of Chrome to work in our usages (I'd test it in the azure-sdk link checking pipeline), then lets just remove this in the yml. If we decide to keep this we should make the variable name more specific something like VERIFY_LINK_USERAGENT, so that we don't accidently clash with others.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Chrome PSUserAgent does not work for the twitter link, I have to switch to "Chrome/87.0.4280.88" to invoke twitter link

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Working one:
Invoke-WebRequest -Method GET -URI "https://www.twitter.com/AzureSDK" -UserAgent "Chrome/87.0.4280.88"

Default one not working:
Invoke-WebRequest -Method GET -URI "https://twitter.com/AzureSDK" -UserAgent "[Microsoft.PowerShell.Commands.PSUserAgent]::Chrome"

Copy link
Member

Choose a reason for hiding this comment

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

Maybe just default to the newer Chrome version in the script as well.

[bool] $checkLinkGuidance = $false
[bool] $checkLinkGuidance = $false,
# UserAgent to be configured for web request. Default to PSUserAgent.
[string] $userAgent = "Microsoft.PowerShell.Commands.PSUserAgent"
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if we should default it to the most common browser useragent string so we can seem like a browser when checking.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can choose either IE or Chrome here. I can set to Chrome if no other preference.

Copy link
Member

Choose a reason for hiding this comment

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

The chrome user agent string would be fine.

@azure-sdk
Copy link
Collaborator

The following pipelines have been queued for testing:
java - template
java - template - tests
js - template
net - template
net - template - tests
python - template
python - template - tests
You can sign off on the approval gate to test the release stage of each pipeline.
See eng/common workflow

@sima-zhu sima-zhu requested a review from weshaggard January 7, 2021 01:02
@azure-sdk
Copy link
Collaborator

The following pipelines have been queued for testing:
java - template
java - template - tests
js - template
net - template
net - template - tests
python - template
python - template - tests
You can sign off on the approval gate to test the release stage of each pipeline.
See eng/common workflow

@ghost
Copy link

ghost commented Jan 7, 2021

Hello @azure-sdk!

Because this pull request has the auto-merge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@ghost ghost merged commit c7a4acc into Azure:master Jan 7, 2021
@sima-zhu sima-zhu deleted the request_headers branch January 7, 2021 16:31
@sima-zhu sima-zhu restored the request_headers branch January 8, 2021 18:12
@sima-zhu sima-zhu deleted the request_headers branch December 13, 2022 00:34
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants