Incremental build VSTS for files changed only (Wor

2020-03-26 09:09发布

问题:

I have a build and release pipeline for Wordpress php files, but I only want to create a build for the files changed in source control. I am not using a Visual Studio Build task as this does not apply in case of php files I guess.

Here is how the pipeline is configured: Currently under the build I am using publish artifacts only from $(Build.SourcesDirectory) and under the release pipeline I am copying those artifacts to the website using FTP upload.

Since the amount of files is larger than 10K,

I want it to only build files that have changed and publish those instead of the whole directory again.

How do I achieve that within the build as the release will automatically pick files up based on the artifacts.

回答1:

There isn’t the feature in VSTS that can just pick files up based on the previous artifacts.

You can refer to these ways to achieve it:

  1. Create XML file that stores the last upload/publish information of each files (e.g. file name, date time, changeset/commit version).
  2. Create a PowerShell script file that included the logical to compare files (get files metadata and compare with that XML file) and copy updated files to specific folder
  3. Publish the files in that folder