Skip to content

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
fullstackinfo pushed a commit to fullstackinfo/azure-pipelines-task-lib that referenced this pull request Aug 17, 2024
…ted agent, or not. (microsoft#869)

* Added function getAgentMode

* Function getAgentMode added to documentation

* Fix of documentation
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.

5 participants