Azure

Azure DevOps Self-hosted Linux Agent on Azure Container Instance

投稿日:

By default, Azure DevOps pipeline runs on Microsoft-hosted agent.
Every time the pipeline runs, it takes long time to install middleware (usually 5minutes+)

Microsoft provides the other way to avoid these wasted time, “Self-hosted” agent.
“Self-hosted” agent is provided with configurable Dockerfile and .sh.
So, configured “self-hosted” image run on VM or ACI provides “Job runner” environment.

I tried to set up “Self-hosted” Linux agent and configured ACI/ACR to run the agent.

ref. Use Running Azure Container Instance in Azure Pipeline

Prerequisite

x86 mac and Docker desktop.

Build Self-hosted Linux agent

see Create and build the Dockerfile

Make workdir on mac and Dockerfile, entry script.

Dockerfile is as follows.

Entry script (start.sh) is as follows.

Build image.
AZP_URL is Azure DevOps organization url. ( https://dev.azure.com/{organization} ) .
AZP_TOKEN is Personal Access Token for DevOps. ( full access for simplicity ) .
AZP_AGENT_NAME is ID on DevOps ( ex. mydockeragent ).

“Running Azure Pipelines agent” on Mac connects to Azure DevOps Pipeline.
then waits for running job.


to be continued…

-Azure
-

Copyright© ikuty.com , 2023 AllRights Reserved Powered by AFFINGER4.