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

Add Support for Azure DevOps in isCI #109

Closed
egg-r opened this issue Feb 27, 2023 · 5 comments
Closed

Add Support for Azure DevOps in isCI #109

egg-r opened this issue Feb 27, 2023 · 5 comments

Comments

@egg-r
Copy link

egg-r commented Feb 27, 2023

Details:

Environment variables

Environment variables example
// Add a list of actual environment variables available to the build here
// Please keep the blank line above and below the code block
// WARNING: Be careful not to include any private or otherwise sensitive information

BUILD_BUILDID=123456
BUILD_ARTIFACTSTAGINGDIRECTORY=/agent/_work/1/a

Additional context
Add any other context about the problem here.

The mentioned Azure DevOps predefined variables get reformatted to the mentioned syntax for available pipeline environment variables.

@egg-r
Copy link
Author

egg-r commented Feb 27, 2023

For more context, this request was sparked by pnpm's use of the CI check for frozen-lock feature.

Documentation: https://pnpm.io/cli/install#--frozen-lockfile

It doesn't look like Azure DevOps is supported within the "isCI" check and looking for CI environment vars.

https://github.com/watson/ci-info/blob/master/index.js

@sagiegurari
Copy link
Contributor

I don't know azure devops, but i think azure pipelines is supported and if i'm not wrong (probably wrong), its part of azure devops

"name": "Azure Pipelines",

@jrdodds
Copy link

jrdodds commented Oct 3, 2023

The major components of Azure DevOps are Azure Artifacts, Azure Boards, Azure Pipelines, Azure Repos, and Azure Test Plans. Azure Pipelines is specifically the build/release pipeline support. Often Azure Pipelines will just be referred to as Azure DevOps and the context informs that it is Azure Pipelines that is being discussed.

All of the following are current or prior names for Azure DevOps:

  • Azure DevOps Server/Services1 (ADO or AzDO)
  • Team Foundation Server/Services1 (TFS)
  • Visual Studio Team Services (VSTS)

The vendors.json entry for Azure Pipelines covers all of these.

The correct way to detect Azure Pipelines is to check if the TF_BUILD environment variable is defined. If defined it should have a value of true.

In #23 SYSTEM_TEAMFOUNDATIONCOLLECTIONURI was used because TF_BUILD was used for Team Foundation Server but the Team Foundation Server entry has since been removed.

SYSTEM_PULLREQUEST_PULLREQUESTID provides the actual PR ID. To just know that the build is for a PR, check that BUILD_REASON has the value PullRequest.

See PR #116.

Footnotes

  1. On-premise versions are named Server and cloud versions are named Services. 2

@sibiraj-s
Copy link
Collaborator

Thanks @jrdodds for the update

@sibiraj-s
Copy link
Collaborator

Merged #116 and published in v3.9.0. Should be fixed now.

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

No branches or pull requests

4 participants