0

The process outlined below is simplified to demonstrate the issue I'm facing.

Process:

enter image description here

  • Create ‘Solutions’ folder in artifact staging directory ($.Build.ArtifactStagingDirectory).

  • Install required tools

  • Export .zip package from Dynamics 365 source system to ‘Solutions’ folder in artifact directory ($.Build.ArtifactStagingDirectory\Solutions)

  • Publish Artifact ($.Build.ArtifactStagingDirectory)

  • Commit Artifact to a Git Repo

Behavior on first run of pipeline

  • Correct folder structure is observed.

enter image description here

Behavior on second run of pipeline

  • Duplication of root folder

enter image description here

Behavior on third run of pipeline

  • Second level down Solution folder is found and updated.
  • It is only the second run of the pipeline that duplicates the root folder. From here on in, it will find and update the file in the duplicated, second level down, folder.

enter image description here

Manual Cleanup

  • I can remove the contents of the top-level solutions folder to give me this structure – which looks cleaner. Still, this is not ideal given there is an unnecessary Solutions folder with no contents.

enter image description here

Why is the folder duplicated on the second run of the pipeline, and is there anyway to stop this?

1 Answers1

1

Why is the folder duplicated on the second run of the pipeline, and is there anyway to stop this?

The behavior you encountered has something to do with the Commit to Git task from Azure Devops Service extension: Backup data during build or release.

I reproduced same issue and found that this strange behavior would happen if your files were placed in one folder (Solutions). If our files are in root directory of Path, it works well to override the old files with same names.

To answer your original question:

1.The reason why the folder is duplicated on the second run is related to the design of the task itself instead of Azure Devops Service.

2.And the only way to stop this is to place your xx.zip directly in path ($.Build.ArtifactStagingDirectory) instead of creating Solutions folder. Also, you may try opening issue here to contact the author of this extension. I guess the author would consider modifying the extension if he gets your feedback.

In addition:

Though using git-related tasks is very easy to do some git actions, I suggest you can also consider using CMD/PS task to use git commands to do the commit/push/... You can find many topics online and here's one of my related issue.

Hope it helps :)

LoLance
  • 25,666
  • 1
  • 39
  • 73