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)
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:
Classic Editor pipeline log:
Setting clean all build directories option(in below screenshot) in devops UI is not working in case of YAML builds.
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
It is really strange because I have this (in YAML build)
I found this in documentation:
When clean is set to true the build pipeline performs an undo of any changes in
$(Build.SourcesDirectory)
. More specifically, the following Git commands are executed prior to fetching the source.
git clean -ffdx
git reset --hard HEAD
Do you have clean option enabled?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With