havan
havan

Reputation: 164

Azure DevOps Pipeline with environments get stuck

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)'

Upvotes: 3

Views: 1566

Answers (1)

havan
havan

Reputation: 164

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

Upvotes: 4

Related Questions