2

We have a working classic build job in azure Devops with an self hosted agent pool. But when we tried to convert this build job to yaml method, while executing no agents are getting assigned and its hanging. Could you please correct me here if i am doing something task.

Error

"All eligible agents are disabled or offline"

below is the converted yaml file from classic build - agent job

pool:
  name: MYpool
  demands: maven

#Your build pipeline references an undefined variable named ‘Parameters.mavenPOMFile’. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab. See https://go.microsoft.com/fwlink/?linkid=865972

steps:
- task: Maven@3
  displayName: 'Maven pom.xml'
  inputs:
    mavenPomFile: '$(Parameters.mavenPOMFile)'

- task: CopyFiles@2
  displayName: 'Copy Files to: $(build.artifactstagingdirectory)'
  inputs:
    SourceFolder: '$(system.defaultworkingdirectory)'
    Contents: '**/*.war'
    TargetFolder: '$(build.artifactstagingdirectory)'
  condition: succeededOrFailed()

- task: PublishBuildArtifacts@1
  displayName: 'Publish Artifact: Root'
  inputs:
    PathtoPublish: '$(build.artifactstagingdirectory)'
    ArtifactName: Root
  condition: succeededOrFailed()

- task: CopyFiles@2
  displayName: 'Copy wars to build directory'
  inputs:
    SourceFolder: '$(build.artifactstagingdirectory)/target'
    TargetFolder: '/home/myadmin/builds/$(build.buildnumber)'

- task: CopyFiles@2
  displayName: 'copying docker file to Build Directory'
  inputs:
    SourceFolder: Admin
    TargetFolder: '/home/myadmin/builds/$(build.buildnumber)'

- bash: |
   # Write your commands here
   mv /home/myadmin/builds/$(build.buildnumber)/mypack0.0.1.war /home/myadmin/builds/$(build.buildnumber)/ROOT.war

  displayName: 'Name war file Root.war'

- task: Docker@2
  displayName: 'Build the docker image'
  inputs:
    repository: 'mycontainerregistry.azurecr.io/myservice'
    command: build
    Dockerfile: '/home/myadmin/builds/$(build.buildnumber)/Dockerfile'
    tags: '$(Build.BuildNumber)-DEV'

- bash: |
   # Write your commands here

   docker login mycontainerregistry.azurecr.io
   docker push mycontainerregistry.azurecr.io/myservice:$(Build.BuildNumber)-DEV

  displayName: 'Push Docker Image'


- task: CopyFiles@2
  displayName: 'Copy Deployment file'
  inputs:
    SourceFolder: /home/myadmin/kubernetes
    TargetFolder: '/home/myadmin/builds/$(build.buildnumber)'

- task: qetza.replacetokens.replacetokens-task.replacetokens@3
  displayName: 'Replace image in deployment file'
  inputs:
    rootDirectory: '/home/myadmin/builds/$(build.buildnumber)'
    targetFiles: '**/*.yml'

vyshakh
  • 143
  • 3
  • 11

1 Answers1

2

In my previous answer, I said when I wait for nearly 20-30 mins, the interface of agent will prompt below message.

enter image description here

In fact, this is a process which upgrade the agent to latest version automatically.

Yes, when you using YAML with private agent, the agent version must be the latest one. No matter you add the demands or not.

For our system, the agent version is a implicit demand that your agent must satisfied with the latest one when you applying it in YAML.

If it is not satisfied, it will be blocked and the agent upgrade process will be forced to be performed automatically by system after some times.

So, to execute the private agent in YAML successfully, please upgrade the agent to latest one manually.

enter image description here


Since what my colleague and I talked are all private to microsoft in this ticket, sorry you could not get visible on this summary. So, here I take the screenshots about it, and you can refer to it: https://i.stack.imgur.com/P8Qld.jpg

We are still working on why the system prompting so confusing message like: All eligible agents are disabled or offline. And, am trying to do some contribution to let this message more clear, for example: no agents meet demands: agent version xxx.

Mengdi Liang
  • 17,577
  • 2
  • 28
  • 35
  • So, any of the pipeline.yml with self hosted cant run? I meant to say if we follow pipeline yaml method without converting the classic will also result the same error? – vyshakh Nov 08 '19 at 06:32
  • 1
    @Vowner, Until now, yes. As I reproduced with different scenario, no matter the pipeline.yml was written by yourself or converting from classic mode, seems all have this issue if you using demand in it. Including using `equals` in YAML. This should be affect by recently update, because it worked fine not long time ago. – Mengdi Liang Nov 08 '19 at 06:50
  • Sorry for my repeated questions on same topic, as i am beginner to AzureDevops. If we remove the demand also its not executing. My agent machine already have Maven installed.. So do i need to specifically mention he demand again for maven. However after removing the demand also from the yaml same issue.. – vyshakh Nov 08 '19 at 07:27
  • 1
    @Vowner. Seemed really this! Will update my issue report ticket and contact the corresponding product group to investigate its root cause. Is it same with you that prompt some abnormal message in agent console like this https://imgur.com/a/xkLW2Aa? Also, it's not problem. Feel free to leave comment here if you still facing any problem. – Mengdi Liang Nov 08 '19 at 08:00
  • 1
    @Vowner, suggest you could follow my issue report ticket and comment with your error there. Thus our engineer would to know the impact of this issue. As work around, please use classic mode first. Would try to fix this usage as soon as possible. – Mengdi Liang Nov 08 '19 at 08:01
  • 1
    @Vowner, Did you still facing this issue now? The product group has started this investigation. Do you mind share me your private info by a private way? – Mengdi Liang Nov 13 '19 at 09:38
  • yes, the issue still persists.. But i cant provide you the requested things – vyshakh Nov 13 '19 at 14:21
  • 1
    @Vowner. Ok. Will let my colleague investigate mine to know the root cause of that, since I could reproduce this error on my account. Then will give you the suggestion on how to fix that. But, at last, if this issue relevant to the account and the fix need deployed to account, you can provide those info on the DC ticket I raised, there you can choose Microsoft only to protect your sensitive info. Will update the progress here once I got any update from our product group. – Mengdi Liang Nov 13 '19 at 14:48
  • 1
    Could you involved yourself in that Developer Community ticket? Since the issue no longer occur on my side after the agent could be run with above **abnormal message prompted**, our engineer can not investigate further. Can you provide your some info there?https://imgur.com/a/EMeBRn5 Don't worry about the security, we has option **Microsoft Only" can for you choose when you post the comment. Then your message would **only be seen by our microsoft internal engineer**. To better solve your issue, I very hope you could provide your info in that ticket. – Mengdi Liang Nov 20 '19 at 04:38
  • We have reported the same again . https://developercommunity.visualstudio.com/content/problem/828971/converted-classic-build-job-to-yaml-is-not-working.html We are still facing the same issue. – vyshakh Nov 21 '19 at 06:27
  • 1
    @Vowner. See it. I will let the DC team duplicate these 2 tickets. Then Brad could investigate it together. Very thanks you joined. – Mengdi Liang Nov 21 '19 at 06:32
  • 1
    @Vowner, Hi, My colleague and I has figure out the solution and the caused. Since what we talked in that ticket are all private to microsoft, sorry you haven't seen those. So, I summary that and update them in my answer. Please check, and have a try. Let me know whether it can let your YAML work. If not, I will continue work with my colleague together. – Mengdi Liang Dec 25 '19 at 16:20
  • Can you please give us some update on this topic? I added a new comment [link](https://developercommunity.visualstudio.com/comments/1069626/view.html). – minus one Jun 08 '20 at 19:32