microsoft / azure-pipelines-agent

Azure Pipelines Agent 🚀
MIT License
1.73k stars 869 forks source link

[Question]: self hosted agents #4933

Open rrichardsisat opened 3 months ago

rrichardsisat commented 3 months ago

Describe your question

I am working on a project that uses Devops Server (version 2020). I keep having an issue where a self-hosted agent doesnt appear to be configured or fails to pull the code from an azure repo. Are there are detailed documents that explain the configuration or any setup steps? Also what is the difference between agents for the pipeline and the environments?

Versions

Azure devops server 2020

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

Azure DevOps Server type

Azure DevOps Server (Please specify exact version in the textbox below)

Operation system

Linux

Version controll system

Azure Repos

Azure DevOps Server Version (if applicable)

2020

vmapetr commented 3 months ago

Hi @rrichardsisat thank you for your question! Please check the following documentation to learn about the Linux self hosted agent configuration - https://learn.microsoft.com/en-us/azure/devops/pipelines/agents/linux-agent?view=azure-devops

what is the difference between agents for the pipeline and the environments?

Environments represent a collection of resources such as namespaces within Kubernetes clusters, Azure Web Apps, virtual machines, databases, which represent some type of physical environment - "Dev", "Stage", "Prod", etc.. Default Pipelines and Environments both use the same agent software to provide communication between the host machine and the Azure DevOps server, but the Environments are logically separated group of agents that may be used for more complex deployments. Basically, the Pipeline with agent pools is used when you need to run a build/deployment on the single machine, and the Environments is used when you need to execute the complex deployment job on the several resources at the same time.

Please check this documentation for more information about the environments - https://learn.microsoft.com/en-us/azure/devops/pipelines/process/environments?view=azure-devops

rrichardsisat commented 3 months ago

@vmapetr thank you for the information: however there seems to be an issue with the agent. Allow me to explain:

I noticed this issue when i deployed to an environment i created separately then deployed to this environment. I received an error "No such file" in azagent/_work/1/s. I manually placed code in this folder as a test and it worked fine. Why is the agent not cloning the codebase here automatically?

thanks for any help. I wanted to make sure its not because we are using an older version (2020) of devops server.

In the folder azagent/_work/1/s which was created from the environments page

rrichardsisat commented 3 months ago

And i forgot to mention at first i was using version 2 of the agent but from my latest test i am using version 3 for the environment.

rrichardsisat commented 3 months ago

Here is a post that is very close to my issue but i did not see any errors in the logs: https://stackoverflow.com/questions/76718579/azure-devops-pipeline-with-self-hosted-agent-fails-at-git-checkout-step-while-sa

I fixed this by cloning the repo elsewhere and copying the path over to the _work/1/s folder but i dont think this will hold.

rrichardsisat commented 3 months ago

Also i manually setup a pipeline agent AND an environment agent. Doesnt seem like this is how it should be. However the pipeline works as expected. I want to correct this.