3

I created an environment and registered a virtual machine (on prem) as a resource Envrionemnt setup

Whenever I try to run the deployment in the resources, the pipeline gets stuck in the deployment stage. Inside of the job, the only log that I see is JOb is pending...Pipeline Status

This is the relevant section of the pipeline:

- stage: deployInTest
  displayName: Deploy in Test Envs
  dependsOn: build
  jobs:
  - deployment: Deploy
    displayName: "Deploy in Test"
    environment:
      name: 'Development'
      resourceType: VirtualMachine 
    strategy:
      runOnce:
        deploy:
          steps:
          - task: DownloadBuildArtifacts@1
            inputs:
              buildType: 'current'
              downloadType: 'single'
              artifactName: 'frontEnd'
              downloadPath: '$(System.ArtifactsDirectory)'

Note that if I change this to the following yaml, the stage runs, but it tries to execute the task IISWebAppManagementOnMachineGroup@0 on the deployment server (OnPrem too) where IIS is not installed.

- stage: deployInTest
  displayName: Deploy in Test Envs
  dependsOn: build
  jobs:
  - deployment: Deploy
    displayName: "Deploy in dev3"
    environment: "Development"
    strategy:
      runOnce:
        deploy:
          steps:
          - task: DownloadBuildArtifacts@1
            inputs:
              buildType: 'current'
              downloadType: 'single'
              artifactName: 'frontEnd'
              downloadPath: '$(System.ArtifactsDirectory)'
havan
  • 164
  • 2
  • 11

1 Answers1

4

Ok, so after trying something that was in the back on my mind since yesterday it worked. I saw another post in SO (I can't find it right now) that had the same issue, but they had 2 deployment jobs.

Their solution was to give them unique names i.e. 'DeployInTest' instead of deploy.

For me changing

- stage: deployInTest
  displayName: Deploy in Test Envs
  dependsOn: build
  jobs:
  - deployment: Deploy
    displayName: "Deploy in Test"

Into

- stage: deployInTest
  displayName: Deploy in Test Envs
  dependsOn: build
  jobs:
  - deployment: DeployInTest #<-- this is what changed
    displayName: "Deploy in Test"

Did the trick. I just realized that I was even trying that before writing the question. I'll edit the question to show the actual status with which it was not working

havan
  • 164
  • 2
  • 11
  • Thanks a lot for pointing this out. I almost got mad. :) After some searching the web, I also found a hint in the docs (see first infobox): https://learn.microsoft.com/en-us/azure/devops/pipelines/process/deployment-jobs?view=azure-devops Basically all Azure Pipelines YAML keywords aren't allowed as IDs. – Michaelvsk Oct 13 '22 at 06:20