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

[Question]: How to print extra information about self-hosted agent in the pipeline output #4579

Closed
1 of 4 tasks
nosalan opened this issue Dec 15, 2023 · 4 comments
Closed
1 of 4 tasks

Comments

@nosalan
Copy link

nosalan commented Dec 15, 2023

Describe your question

I would like to display custom metadata about the self-hosted agent, so that it's visible in the pipeline output. For example the current agent version or image name or anything else.

A nice place to show it would be at the beginning of the job output, for example:
image

Is there any way to do this, for example by passing some env variables to the agent binary?

Versions

Azure DevOps / Ubuntu

Environment type (Please select at least one enviroment where you face this issue)

  • Self-Hosted
  • Microsoft Hosted
  • VMSS Pool
  • Container

Azure DevOps Server type

dev.azure.com (formerly visualstudio.com)

Operation system

Ubuntu

Version controll system

Git

Azure DevOps Server Version (if applicable)

No response

@ivanduplenskikh
Copy link
Contributor

@nosalan, there are logging and formatting commands that write to the pipeline log.

@nosalan
Copy link
Author

nosalan commented Dec 29, 2023

@ivanduplenskikh Do you mean to put in your pipeline tasks some custom code that would read the agent version via e.g. environment variable and display this to the output?
This has a big disadvantage in that you need to modify pipelines code itself to do so. The pipeline code must now have knowledge that it's running on a build agent that has some env variable defined. And you need to remember to update all the pipelines.
What I was look for is something that would print this information even before the actual pipeline tasks start execution. We run the self-hosted agent in container (like here https://learn.microsoft.com/en-us/azure/container-apps/tutorial-ci-cd-runners-jobs?tabs=bash&pivots=container-apps-jobs-self-hosted-ci-cd-azure-pipelines#build-the-azure-pipelines-agent-container-image) but anything being printed out in start.sh script do not show up in the pipeline output.

@ivanduplenskikh
Copy link
Contributor

@nosalan, the agent/pipeline doesn't have any built-in mechanism for printing any kind of additional metadata to the beginning of output.
Only with creating additional pipeline step which can parse information that you need and add it to output with commands described in link above.

@ivanduplenskikh
Copy link
Contributor

I'm closing this issue for now. If you have any additional questions related to this issue, feel free to open again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants