Build promotion can be done by using our REST-API query for Build Promotion. This query will require a simple JSON file with the desired details for the promotion, i.e. “targetRepo”, copy artifacts or move them to the destination repository etc.
You can see in our wiki page the set of details required in the JSON file for promoting a build and the REST query for running the promotion.
Here is an example for the REST query, using cURL and the JSON file:
curl -u user:password -H”Content-type:application/json” –data-binary @promote.json -X POST “http://server:port/artifactory/api/build/promote/buildName/buildNumber”
“dryRun” : false,
“targetRepo” : “ext-snapshot-local”,
“artifacts” : true,
“dependencies” : true,
“scopes” : [ “compile”, “runtime” ],
Please note that the promotion requires a build info file which is part of our build integration feature.
In case your build deploys snapshot artifacts, and you are interested in promoting them from snapshot to release artifacts while moving them into another repository, you can use the build-promotion user plugin. This plugin can be found here.
To run this plugin, you will need to put it under the $ARTIFACTORY_HOME/etc/plugins/ folder and enable logger in the $ARTIFACTORY_HOME/etc/logback.xml with the plugin name so this plugin will print into the artifactory.log. For example:
<level value=”info” />
Once the plugin is set and loaded, you can run the snapshotToRelease promotion by running the Execute Build Promotion REST-API query. For example:
You can find more information about user plugin and how to setup the plugins here.