-
Notifications
You must be signed in to change notification settings - Fork 55
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 user agent for Azure/CLI action #122
Conversation
dist/index.js
Outdated
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.
Is it necessary to update this file when committing to master
branch? BTW, how is it generated?
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.
dist/index.js
is the executable file of the action which is generated by running ncc build -C -m src/entrypoint.ts
If we don't update it in this pr, it will be auto generated by bot running in this workflow with a new commit when we push the changes to the master branch.
src/main.ts
Outdated
|
||
export async function main() { | ||
let usrAgentRepo = `${process.env.GITHUB_REPOSITORY}`; |
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.
Is GITHUB_REPOSITORY
sensitive? Can we log this in the telemetry?
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.
@Jacekey23 @dcaro Could you help us to confirm this?
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.
@Jacekey23 @dcaro I have encoded the user repo with hash. Is it appropriate to store the information of user repo with hash?
Could you give an example of what the final |
If there is no
If
And when running azure cli commands, azure cli core appends Finally, we will see the user agent record in ARM like
And if
The plus sign in |
@@ -10,7 +10,7 @@ const cpExec = util.promisify(require('child_process').exec); | |||
import { createScriptFile, TEMP_DIRECTORY, NullOutstreamStringWritable, deleteFile, getCurrentTime, checkIfEnvironmentVariableIsOmitted } from './utils'; | |||
|
|||
const START_SCRIPT_EXECUTION_MARKER: string = "Starting script execution via docker image mcr.microsoft.com/azure-cli:"; | |||
const AZ_CLI_VERSION_DEFAULT_VALUE = 'agentazcliversion'; | |||
const AZ_CLI_VERSION_DEFAULT_VALUE = 'agentazcliversion' |
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.
Why is the semicolon removed?
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.
Since this line is not related this pr, I don't want to include this line in comparison to lead confusion.
@@ -83,6 +90,8 @@ export async function main() { | |||
await deleteFile(scriptFilePath); | |||
console.log("cleaning up container..."); | |||
await executeDockerCommand(["rm", "--force", CONTAINER_NAME], true); | |||
// Reset AZURE_HTTP_USER_AGENT | |||
core.exportVariable('AZURE_HTTP_USER_AGENT', prefix); |
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.
According to L14, if AZURE_HTTP_USER_AGENT
is not set, prefix
will be set to an empty string ""
. This line will make this action modify AZURE_HTTP_USER_AGENT
from unset to an empty 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.
Good point. Will also consider this for login and powershell action.
This pr will configure the user agent for Azure/CLI action, allowing us to label the user agent as
GITHUBACTIONS/AzureCLIAction
for ARM. This will help us identify the CLI commands being executed within the Azure/CLI action.