Azure Devops YAML Pipeline - Deployment Job does not respect the timeoutInMinutes property

54 views Asked by At

I am using Yaml pipelines in Azure Dev Ops, and have a multi-stage build/deploy.

Based on the documentation here : https://learn.microsoft.com/en-us/azure/devops/pipelines/process/phases?view=azure-devops&tabs=yaml

It suggests a job has a property of timeoutInMinutes.

We however have a -Job, which is followed by a -Deployment (which the docs say is just a special type of job). The deployment is executed on a Azure Devops Environment, which is just an Azure Deployment Agent on a self-hosted docker container.

The execution works fine but the job always times out at 60 minutes regardless.

Example YML

 -jobs
  - job: JobA
        timeoutInMinutes: 30
        [...]
  - deployment: JobB
        timeoutInMinutes: 360
        dependsOn:
          - JobA
        environment:
          name: MyEnvironment
          resourceType: VirtualMachine
          tags: "TheAgent"
        strategy:
          runOnce:
            deploy:
              timeoutInMinutes: 360
              steps:
                 [... long running task...]

The issue is that the deployment job deploys and then has a task within it to run off some automated regression tooling which takes between 70-90 minutes.

The job running on agent [name] ran longer than the maximum time of 60 minutes.

I must be missing something surely? For a self-hosted agent there is no reason to have this limit? Is there an alternative to this?

1

There are 1 answers

0
wade zhou - MSFT On

As per the doc, you can also set the timeout at task level in the deployment job. Please remove timeoutInMinutes after deploy: as it's not the correct syntax.

enter image description here

sample as below:

  - deployment: JobB
    timeoutInMinutes: 360         # larger timeout than task
    dependsOn:
      - JobA
    environment:
      name: MyEnvironment
      resourceType: VirtualMachine
      tags: "TheAgent"
    strategy:
      runOnce:
        deploy:
          steps:
          - powershell: |
              long time job which more than 60mins
            timeoutInMinutes: 120           # define timeout on task level

Checked on my side, with deployment job which has a self-hosted agent(VM,not container), even not have timeout in task level, it can work more than 1hour. Hence, you can also check if the self-container is still working after 1hour.

enter image description here