简体   繁体   中英

How to Avoid redeployment of same artifact?

In our Client project we have 6 applications, Three Java and three .NET. We have the code in the same repository in different folders for each app. The case is that we need to compare the artifacts which is being built with the previous builds to know changes are made or not. If changes are made then deploy it else Do not deploy it. Also, based on the apps. Say if I work on the One Java and one .NET app, I will want to deploy only these two and rest four apps need not be deployed unnecessarily. How can we achieve this without manual intervention? Please suggest us with a solution.

You can try to set up a build pipeline and corresponding release pipeline for each app.

  1. In the build pipeline for each app, you can use the ' Paths ' key to specify the file paths that can trigger the build pipeline.

  2. In the release pipeline for each app, you can try setting up a step to execute the API " Builds - Get Changes Between Builds " to get the changes between the current build and previous build. If no any change made between the two builds, skip the subsequent deployment step.

[UPDATE]

Is there any equivalent API which could provide the difference between two artifacts even if the build manually runs without any changes? So if we do not see any changes in result we could cancel the release pipeline.

To avoid deploying the artifacts that have the same source version, as I mentioned above, you can try using the API " Builds - Get Changes Between Builds ". In Response body of this API, it will return the array list of commits between the two specified builds.

  • If have changes between the two builds, the value of " count " property is the number of the commits. And in the " value "property (array object), these commits will be listed.

    在此处输入图像描述

  • If no any change between the two builds, the value of " count " is 0, and " value " is an empty array.

    在此处输入图像描述

In your case, you just need to check whether the value of " count " is greater than 0. If greater than 0, start the deployment. If equal to 0, skip the deployment to avoid re-deployment.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM