gitazure-devopsazure-pipelinesdevopsazure-pipelines-yaml

Clean All build directories in Azure DevOps Pipeline settings is not working while using YAML configuration


I use Azure DevOps for some time, and I always use Classic Editor GUI when crafting Build Pipeline. Now I'm trying to create new pipeline using YAML. Everything went well and the build was successful. But, I have noticed different behavior in checkout task compared to pipeline using Classic Editor. In both pipelines, settings used in 'Get sources' tab are same(see the below screenshot)

enter image description here

In case of Classic Editor pipeline, checkout task Deletes and recreates $(Agent.BuildDirectory). This results in initializing a new, local Git repository for every build. But, for YAML pipeline, checkout task only performing a git clean -ffdx and removing source directories only. How to resolve this issue for YAML pipelines?

YAML pipeline log:

enter image description here

Classic Editor pipeline log:

enter image description here


Solution

  • Setting clean all build directories option(in below screenshot) in devops UI is not working in case of YAML builds.

    enter image description here

    But you can specify this in YAML file itself by using the workspace setting of a Job. This is working as expected.

    jobs:
    - job: Job1
      workspace:
        clean: all # what to clean up before the job runs - outputs | resources | all