6

I've got a single self-hosted agent. Its used as a kind of deployment agent. All release versions of our software gets build by this agent and then copied to a network location.

Question: Is there a way I can utilize both the agent from the 'azure-pipelines' Microsoft hosted pool and my own self-hosted pool in my pipelines?

EDIT

Unfortunately this is not possible at the moment. This is why you should upvote the feature request: https://developercommunity.visualstudio.com/t/allow-agent-pools-to-contain-microsoft-hosted-and/396893

sommmen
  • 6,570
  • 2
  • 30
  • 51

4 Answers4

3

This is not possible. There is a ticket on developer community asking for similar functionality but it is already closed.

There is another ticket Allow agent pools to contain Microsoft hosted and self-hosted agents which refer to similar case, it is open but MS is silent there.

Krzysztof Madej
  • 32,704
  • 10
  • 78
  • 107
2

Which benefits do you want to achieve?

Basically, you can use several agent pools in one build/release definition. You just split your definition into several jobs and assign the needed agent pool to the corresponding job.

If you want to dynamically assign different pools from one pipeline to do the same build steps, we can not do that (as Krzysztof mentioned).

Shamrai Aleksander
  • 13,096
  • 3
  • 24
  • 31
  • 1
    I Gues i want something like 'composite pools' because i cannot add the microsoft hosted agents to my self-hosted pool. Therefore i can only configure 1 agent (contained in 1 pool) to run all the pipelines, and i'd like to use both to build (and then only the one for 'deployment') – sommmen Nov 11 '20 at 15:07
2

You can do hacky thing and use multiple jobs/stages. Jobs/stages will use different pools. You just need to skip depending if it is release version. Note that pipeline skeleton is not tested.

variables:
  ${{ eq(variables['Build.SourceBranch'], 'release/*') }}:
    release_build: True

stages:
- stage: normal
  condition: eq(variables['release_build'], False)
  pool:
    vmImage: 'windows-latest'
  jobs:
    - job: Builds
      steps:
        - template: build.yaml

- stage: release
  condition: eq(variables['release_build'], True)
  pool: My-agent
  jobs:
    - job: Builds
      steps:
        - template: build.yaml
teksturi
  • 69
  • 2
2

Looks like it is possible now, see the docs

strategy:
  matrix:
    microsofthosted:
      poolName: Azure Pipelines
      vmImage: ubuntu-latest

    selfhosted:
      poolName: FabrikamPool
      vmImage:

pool:
  name: $(poolName)
  vmImage: $(vmImage)

steps:
- checkout: none
- script: echo test
JvR
  • 1,022
  • 1
  • 11
  • 29