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

Enable task authors to determine whether the task is running on a hosted agent, or not. #869

Merged

Conversation

Roman-Shchukin
Copy link
Contributor

Description:
Added export function getAgentMode for getting the agent hosted type.
It works throw Agent.CloudId property.

Changelog:
Function getAgentMode added to task
Function getAgentMode added to mock

Documentation changes required: Yes

Added unit tests: No

Attached related issue: Link to PR in the issue

export function getAgentMode(): AgentHostedMode {
let agentCloudId = getVariable('Agent.CloudId');

if (agentCloudId === undefined)
Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest to check MsHosted and SelfHosted and for any other case just return unknown

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It would be a good idea, but here is a little bit of another logic. "undefined" value means that the current agent version doesn't support Agent.CloudId, it's for backward compatibility. Any other empty values mean it's SelfHosted and real value means MsHosted

@Roman-Shchukin Roman-Shchukin merged commit 5adadae into master Oct 12, 2022
@max-zaytsev max-zaytsev deleted the users/roman-shchukin/expose_agent_hosting_model branch February 26, 2023 12:44
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.

None yet

4 participants