Azure-devops-docs: Missing System.JobAttempt

Created on 11 May 2019  Â·  2Comments  Â·  Source: MicrosoftDocs/azure-devops-docs

I was looking for any documentation anywhere that said how to get the attempt number of a job in a build pipeline. You can re-run jobs using the GitHub UI for PRs and hitting 'Re-run' on a failed job, for example. I only discovered System.JobAttempt after displaying all the environment variables in a build pipeline using PowerShell. Please add documentation for this predefined environment variable.

Note: There is Release.AttemptNumber, but that value only exists for release pipelines.


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Pri1 devops-cictech devopprod doc-bug

Most helpful comment

Also, there is many other variables currently not listed on the page, such as Job.JobId. I only noticed this because an agentless "Invoke REST" task has it in its headers by default, and was wondering if there was an equivalent for the whole phase as well (so I can ignore certain tasks when poking _apis/build/builds/{buildId}/timeline to get results of previous phases).
While it's nice to have a script to dump environment variables for this, it isn't always possible and/or practical to use one of these; and a complete documentation (or at least reference somewhere in source) would help a lot.

All 2 comments

Also, there is many other variables currently not listed on the page, such as Job.JobId. I only noticed this because an agentless "Invoke REST" task has it in its headers by default, and was wondering if there was an equivalent for the whole phase as well (so I can ignore certain tasks when poking _apis/build/builds/{buildId}/timeline to get results of previous phases).
While it's nice to have a script to dump environment variables for this, it isn't always possible and/or practical to use one of these; and a complete documentation (or at least reference somewhere in source) would help a lot.

Other examples that stand out include:

  • system.CollectionUri
  • system.PlanId
  • system.TimelineId
  • system.TaskInstaneId

It surprises me these aren't in the documentation here, considering you can find references to them in other pages of the documentation.

Was this page helpful?
0 / 5 - 0 ratings