{"id":17649730,"url":"https://github.com/arnaud-tincelin/selfhosted-az-devops-agent","last_synced_at":"2025-04-26T08:29:04.274Z","repository":{"id":50331502,"uuid":"488599586","full_name":"arnaud-tincelin/selfhosted-az-devops-agent","owner":"arnaud-tincelin","description":"Deploy AzureDevOps Selfhosted runners with a KEDA scaler","archived":false,"fork":false,"pushed_at":"2022-07-28T09:46:26.000Z","size":16,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-25T08:18:43.886Z","etag":null,"topics":["aks","azure-devops","container-apps","keda-azure-pipelines-scaler","selfhosted-runner"],"latest_commit_sha":null,"homepage":"","language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/arnaud-tincelin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-05-04T13:27:51.000Z","updated_at":"2024-11-28T12:15:24.000Z","dependencies_parsed_at":"2022-07-29T18:39:44.505Z","dependency_job_id":null,"html_url":"https://github.com/arnaud-tincelin/selfhosted-az-devops-agent","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arnaud-tincelin%2Fselfhosted-az-devops-agent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arnaud-tincelin%2Fselfhosted-az-devops-agent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arnaud-tincelin%2Fselfhosted-az-devops-agent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arnaud-tincelin%2Fselfhosted-az-devops-agent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arnaud-tincelin","download_url":"https://codeload.github.com/arnaud-tincelin/selfhosted-az-devops-agent/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250779505,"owners_count":21485908,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aks","azure-devops","container-apps","keda-azure-pipelines-scaler","selfhosted-runner"],"created_at":"2024-10-23T11:29:29.928Z","updated_at":"2025-04-25T08:18:48.324Z","avatar_url":"https://github.com/arnaud-tincelin.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Complete example to deploy SelfHosted AzureDevops Agents on Container Apps or Kubernetes\n\nThis example deploys a full environment to support azure devops agents. For each new pipeline, one agent container will be instanciated, and then removed once the pipeline ends.\n\nNote: If there is no agent in the pool, the pipeline will fail. To workaround this limitation, a \"placeholder\" agent must be configured in order to always have 1 agent in the pool. This agent will be a \"fake\" agent as it will always be marked as offline.\n\n## Pre-requisites\n\n1. Create an agent pool and save its **name** and **id**.  \n    Note: the pool ID corresponds to the `queueId` from the url when a pool is selected in the browser.  \n    Example: `https://dev.azure.com/myOrg/myProject/_settings/agentqueues?queueId=11\u0026view=jobs`, the pool ID is 11\n1. Create a **PAT** (Personal Access Token) with the following permissions:\n    - `Agent Pools`: `Read \u0026 manage` to be able to register / unregister agents\n    - `Build`: `Read` for Keda to be able to get the queue of pending builds\n1. Configure the **max number of parallel jobs** in Azure Devops so that your ACA does scale accordingly\n\n## Deploy the solution\n\nThis repositories has 3 implementations to create self-hosted runners:\n\n- based on Azure Container Apps:\n  - arm\n  - terraform\n- based on Azure Kubernetes Services with Keda\n\n## Create a \"placeholder\" agent\n\nThere are 2 possibilities to deploy a placeholder agent:\n\n- using the provided terraform code, the following commands will, create a VM, register it as a devops agent and finally remove it (leaving the agent in the azure devops pool):\n\n    ```bash\n    cd placeholder-agent\n    az login\n    terraform init\n    terraform apply -auto-approve\n    # Wait for the agent to appear in the pool before running destroy\n    terraform destroy -auto-approve\n    cd -\n    ```\n\n- From an azure devops agent pool, click on \"New Agent\" and follow the instructions. You will need a temporary VM to install the agent. The VM might be deleted once the agent has been registered in the pool.\n\n## References\n\n- [Container Apps ARM Template](https://docs.microsoft.com/en-us/azure/templates/microsoft.app/containerapps?tabs=json)\n- [Docker Agents for Azure Devops](https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/docker?view=azure-devops#linux)\n- [Keda for Azure Pipelines](https://keda.sh/docs/2.5/scalers/azure-pipelines/)\n- [Keda](https://keda.sh/docs/2.6/deploy/#yaml)\n- [Terraform](https://learn.hashicorp.com/tutorials/terraform/install-cli)\n- [Container Apps](https://docs.microsoft.com/en-gb/azure/container-apps/containers)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farnaud-tincelin%2Fselfhosted-az-devops-agent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farnaud-tincelin%2Fselfhosted-az-devops-agent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farnaud-tincelin%2Fselfhosted-az-devops-agent/lists"}