"No agent found in pool Default which satisfies the specified demands: - azure-devops

I am getting the below message while I am doing build in my Azure DevOps pipeline. Here I am using Azure DevOps pipelines, VS2017 and Windows 2016.
"No agent found in pool Default which satisfies the specified demands:
msbuild
visualstudio
vstest
Agent.Version -gtVersion 2.161.0 "
This is failing when I'm using three agent jobs in single pipeline. If I run the same tasks in new pipeline it works fine. Could you please suggest the solution?

In my case, we were getting the error and this is what solved it:
I logged on to our build server and restarted these three services:
In our case, it was just a problem with a single pipeline, as the other pipeline we use was running ok. I don't know why one pipeline worked and the other didn't since they both use the same agent, but restarting the services resolved it.

This issue is caused by "Download Pipeline Artifacts#2" task.
It has been reported to the product group not long ago, and our engineers have released fixes that resolve compatibility issues. This issue has now been fixed. I apologize for the inconvenience here.
For details,please refer to this case on our Developer Community forum.

Same here.
We have the same issue and MS is tracking it.
https://twitter.com/AzureDevOps/status/1207288336206815232

I got this error when I created a new agent.
This new agent didn't receive existing User-defined capabilities that were on older agents.
After comparing agent capabilities, I added the missing user-defined capabilitiesies and it started to compile.

In your pipeline definition YML file you have to specify 'windows-2016' before specifying agentpool, see below:
stages:
- stage: Build
displayName: 'IaC Build'
variables:
- name: var
value: val
jobs:
- job: Build
pool:
vmImage: 'windows-2016'
steps:
- task: ...
# Deploy Dev
- stage: DeployDevInfra
displayName: 'Deploy: DEV'
dependsOn: build
variables:
- group: your-var-group
- name: var
value: val
jobs:
- template: another-pipeline.yml
parameters:
agentpool: 'here-come-name-of-your-agent-pool'
environment: 'your-dev-environment'

In my case, I had to delete and recreate the Release Pipeline and it started working. None of the other answers worked/applied for me.

I had a similar problem - downloaded a self-hosting agent and ran it. I downloaded it after opening my custom AgentPool, so I expected that the agent will be found there. The issue was, the agent was still created in the Default pool (me being a newbie in this). End result was I was trying to use the wrong Agent pool, that would cause the same issue.

Related

Azure DevOps The code coverage value (0%, 0 lines) is lower than the minimum value

Azure Devops pipeline started failing on self hosted agent on Check build quality task
steps:
- task: mspremier.BuildQualityChecks.QualityChecks-task.BuildQualityChecks#6
displayName: 'Check build quality'
inputs:
checkCoverage: true
coverageFailOption: fixed
coverageType: lines
coverageThreshold: 50
buildPlatform: '$(BuildPlatform)'
enabled: false
timeoutInMinutes: 24
Tried with all the task versions
Tried all the coverage types and added timeout minutes too but It's not working
I tried on Microsoft hosted agent win 2019 and It worked
, Till last week it was working on self hosted 2019 agent
Happy to provide more information if needed
Also I would like to understand if we are already doing sonar code scan does this task adds any value ?
If you're running this check on a PR without any code changes, ie. only adding this build check. By default the code coverage check will fail as theres no additional coverage added.
Have a look atthe treat0of0as100 option listed here https://github.com/MicrosoftPremier/VstsExtensions/blob/master/BuildQualityChecks/en-US/overview.md.

Azure DevOps pipelines resource trigger not working

I have an Azure DevOps pipeline (Pipeline1) that should be triggered when another (Pipeline2) completes. To that end I have implemented a pipelines resource as described in the documentation -
Trigger one pipeline after another
YAML schema reference
However, it's simply not working. In reality Pipeline2 will be triggered when a new PR is created or manually. I've tested creating a new PR, updating a PR several times, and several manual runs, but no matter what I do Pipeline1 will not trigger.
I've tried two of the examples as defined in the YAML schema reference, and reading further into the Trigger one pipeline after another document, I've tried to prefix the all branches wildcard with refs/heads/.
What must I do to get this working?
What I've tried
Without any branchs explicitly defined -
resources:
pipelines:
- pipeline: pipeline2
source: Pipeline2
trigger: true
With all branches explicitly defined -
resources:
pipelines:
- pipeline: pipeline2
source: Pipeline2
trigger:
branches:
- "*"
Prefixed the all branches wildcard with refs/heads/ -
resources:
pipelines:
- pipeline: pipeline2
source: Pipeline2
trigger:
branches:
- refs/heads/*
Update
It seems that sadly the pipelines resource does not work on PR's. Why That's the case, I couldn't tell you.
After some further investigation I stumbled across the Incoming Webhook Service Connection in a sprint update. This update is from six months ago and at the time of writing nothing has been added to the YAML schema reference.
However, it turns out that this feature just doesn't work full stop, and even if it did it looks like it will only trigger the default branch of a pipeline, which is no good for us (and probably no good for most use cases).
I did eventually find some documentation on GitHub from a year ago, but unfortunately this only seems to confirm that the Incoming Webhook Service Connection is of no use to us in this case.
This answer solved it for me.
I had a main and dev branch, and the target pipeline yaml file was not yet pushed up to main. The "Default branch for manual and scheduled builds" in the target pipeline must contain the source file in order for the pipeline to be triggered automatically. (The version of the pipeline that will actually be triggered will be the branch that triggered the original pipeline, as long as they are in the same project.) I changed the value to dev and that solved it.
You can change this setting by going to Edit/Triggers/Yaml/Get sources:
For me works this
resources:
pipelines:
- pipeline: build_pipeline
source: kmadof.devops-manual (14)
branch: master
trigger:
branches:
- '*'
steps:
- bash: env | sort
- task: Bash#3
inputs:
targetType: 'inline'
script: |
echo 'Hello world'
So in your case I would try this:
resources:
pipelines:
- pipeline: pipeline2
source: Pipeline2
branch: master
trigger:
branches:
- '*'
The Pipeline2 is triggered by PR, so the source branch (Build.SourceBranch) that triggers the pipeline run is the PR merge branch (refs/pull/{PR_ID}/merge).
I also have tested with the 3 ways you posted above, and only the first way can work as expected.
According to my further investigation, it seems that the branch filters on the pipeline resource trigger are only available to the repository branches that you can see on the 'Repos/Branches' page. These branches have the same prefix 'refs/heads/'. The PR merge branch (refs/pull/{PR_ID}/merge) seems is not included.
In your case, the first way should can work. You need to check with the following things:
Make sure you have specified the correct pipeline name of Pipeline2 to the 'source' key.
Check whether Pipeline1 and Pipeline2 are in the same project. If not, make sure you have used the 'project' key to specify the correct project where Pipeline2 is in, and make sure the projects are in the same organization.

How to find out Azure DevOps Services pipeline demand / capability requirements to select some specific agent? (implicit and explicit demands)

I have a simple yaml pipeline file as follows:
stages:
- stage: build_xm2simu
displayName: This is the build stage of the XM Simu project
# dependsOn: string | [ string ]
# condition: string
jobs:
- job: linux_dotnet_build
pool:
name: my-desktop
# demands:
# - netcore -equals 3.1
steps:
- powershell: dotnet restore source\backend\XM2Simu\XM2Simu.csproj
and I also have configured three different agents:
my-desktop / windows host agent → capabilities: {plenty but netcore}
my-desktop / linux docker agent with dotnet → capabilities: netcore 3.1, PowerShell 6.x, {some more}
my-desktop / linux docker agent with azure cli
In case I remove the explicit demand with netcore then it runs on my windows host agent and fails as expected since there is no source\backend\XM2Simu\XM2Simu.csproj file currently there.
In case the netcore demand is added, it doesn't finds any agent suitable, and I only get the following message:
Waiting for an available agent. All eligible agents are disabled or offline
I also get the above message in case the netcore demand is removed but the windows host agent is offline.
Question: How to find out Azure DevOps Services pipeline demand / capability requirements to select some specific agent? (implicit and explicit demands)
Note: I'm currently investigating this issue and maybe related to this post.
How to find out Azure DevOps Services pipeline demand / capability requirements to select some specific agent? (implicit and explicit demands)
What you did should be correct.
According to your troubleshooting steps and the error messages you get:
Waiting for an available agent. All eligible agents are disabled or offline
Besides, I also test your yaml file with my private agent, it works fine.
It seems the error comes from the agent linux docker agent with dotne itself, it should not a eligible agents.
So, first, we could check if that agent keep Online. If yes, we could try to update the agent.
Second, if above not help, please download the latest agent from VSTS web page, and config again.
Hope this helps.

New Azure DevOps pipeline using ASP.NET yaml template failing

I have a GitHub repository with a .NET Core 3.0 website solution in it. In Azure DevOps, I went through the wizard to create a new pipeline linked to that repository using the ASP.NET Core template on the Configure step of the wizard. This is what my YAML looks like:
# ASP.NET Core
# Build and test ASP.NET Core projects targeting .NET Core.
# Add steps that run tests, create a NuGet package, deploy, and more:
# https://learn.microsoft.com/azure/devops/pipelines/languages/dotnet-core
trigger:
- develop
pool:
vmImage: 'ubuntu-latest'
variables:
buildConfiguration: 'Release'
steps:
- script: dotnet build --configuration $(buildConfiguration)
displayName: 'dotnet build $(buildConfiguration)'
When I try to manually run the pipeline to test it, this is the output I get everytime:
##[warning]There was a failure in sending the provision message: Unexpected response code from remote provider NotFound
,##[warning]There was a failure in sending the provision message: Unexpected response code from remote provider NotFound
,##[warning]There was a failure in sending the provision message: Unexpected response code from remote provider NotFound
,##[warning]There was a failure in sending the provision message: Unexpected response code from remote provider NotFound
,##[warning]There was a failure in sending the provision message: Unexpected response code from remote provider NotFound
,##[error]Provisioning request delayed or failed to send 5 time(s). This is over the limit of 3 time(s).
Pool: Azure Pipelines
Image: ubuntu-latest
Started: Yesterday at 10:04 PM
Duration: 10h 54m 5s
Job preparation parameters
ContinueOnError: False
TimeoutInMinutes: 60
CancelTimeoutInMinutes: 5
Expand:
MaxConcurrency: 0
########## System Pipeline Decorator(s) ##########
Begin evaluating template 'system-pre-steps.yml'
Evaluating: eq('true', variables['system.debugContext'])
Expanded: eq('true', Null)
Result: False
Evaluating: resources['repositories']['self']
Expanded: Object
Result: True
Evaluating: not(containsValue(job['steps']['*']['task']['id'], '6d15af64-176c-496d-b583-fd2ae21d4df4'))
Expanded: not(containsValue(Object, '6d15af64-176c-496d-b583-fd2ae21d4df4'))
Result: True
Evaluating: resources['repositories']['self']['checkoutOptions']
Result: Object
Finished evaluating template 'system-pre-steps.yml'
********************************************************************************
Template and static variable resolution complete. Final runtime YAML document:
steps:
- task: 6d15af64-176c-496d-b583-fd2ae21d4df4#1
inputs:
repository: self
I thought maybe ubuntu-latest was maybe no longer a valid vmImage, so I tried changing it to ubuntu-18.04 and got the same result. The Micosoft-hosted agents documentation says either should be valid.
Do I have something wrong with my yaml file? I have setup pipelines before with the old no-yaml interface with no issues, so I am a little confused.
i think nowadays it should looks like this:
trigger:
- develop
jobs:
- job: buildjob
variables:
buildConfiguration: 'Release'
pool:
vmImage: 'ubuntu-latest'
steps:
- script: dotnet build --configuration $(buildConfiguration)
displayName: 'dotnet build $(buildConfiguration)'
although this says you can omit jobs if you only have a single job, but I dont see anything wrong with your yaml other than the fact you use steps directly (which, again, should be fine)
Looks like nothing wrong with your yaml file and format.
Since you are using a GitHub repository with a .NET Core 3.0 website. Please pay attention when you create pipeline, make sure you have selected GitHub not Azure Repos Git.
Also as you have mentioned I have setup pipelines before with the old no-yaml interface with no issues, you could setup your pipelines with classic editor first.
There is also a view yaml option.
You could follow that format and content to create a yaml template, which may do the trick.
I was looking through my account and noticed my Agent Pool settings looked a little suspect on the project. It showed I had 11 available agents that were online even though I was using the free plan on a private repository so it should only have one.
I ended up deleting my Azure DevOps organization and creating a new one. Now the YAML configuration I initially posted works fine.

Azure Pipepline with task Sonarqube https

I added a Sonarqube task into my azure build pipeline, in order to login to my sonarqube server I need to run a command, which uses trunst store ssl.
my pipeline looks just like this:
- task: SonarSource.sonarqube.15B84CA1-B62F-4A2A-A403-89B77A063157.SonarQubePrepare#4
displayName: 'Prepare analysis on SonarQube'
inputs:
SonarQube: abc-sonarqube
scannerMode: CLI
configMode: manual
cliProjectKey: 'abc'
cliProjectName: 'abc'
cliSources: src
extraProperties: |
sonar.host.url=https://sonarqube.build.abcdef.com
sonar.ce.javaAdditionalOpts=-Djavax.net.ssl.trustStore=mvn/sonar.truststore -Djavax.net.ssl.trustStorePassword=changeit
I am not sure, if this command "sonar.ce.javaAdditionalOpts=-Djavax.net.ssl.trustStore=mvn/sonar.truststore -Djavax.net.ssl.trustStorePassword=changeit" correct is.
I got the error "API GET '/api/server/version' failed, error was: {"code":"UNABLE_TO_VERIFY_LEAF_SIGNATURE"}
"
PS: my project is angular project.
any solutions?
Azure Pipepline with task Sonarqube https
This issue should be related in how the configure task works. So, even if we add the certificate to the java trustore, the task that sets the configuration uses a different runtime (not java at least) to communicate with the server, that’s why you still get that certificate error.
To resolve this issue, you could try to:
set a global variable, NODE_EXTRA_CA_CERTS, and set it to a copy of
the root cert we had stored locally in a directory. See this article.
Check the related ticket for some more details.
Hope this helps.