Build Promotion

JFrog REST APIs

Content Type
REST API
ft:sourceType
Paligo

Description: Change the status of a build, optionally moving or copying the build's artifacts and its dependencies to a target repository and setting properties on promoted artifacts.

All artifacts from all scopes are included by default while dependencies are not. Scopes are additive (or). From version 5.7, the target repository can be a virtual repository.

Since: 2.3.3

Security: Requires a privileged user. From version 6.6, requires Deploy permission for the build.

Usage: POST /api/build/promote/{buildName}/{buildNumber} -H "Content-Type: application/json" --upload-file build-promotion.json

Query parameters (optional):

Field

Type

Description

project

string

The name of the project that contains the build to be promoted. If not defined, Artifactory uses the default build-info repo.Projects

Consumes: application/json (application/vnd.org.jfrog.artifactory.build.PromotionRequest+json)

POST /api/build/promote/my-build/51
{
 "status": "staged",                            
 "comment" : "Tested on all target platforms.", 
 "ciUser": "builder",                           
 "timestamp" : ISO8601,                          
                                                
 "dryRun" : false,                              
 "sourceRepo" : "libs-snapshot-local",           
 "targetRepo" : "libs-release-local",           
 "copy": false,                                 
 "artifacts" : true,                            
 "dependencies" : false,                        
 "scopes" : [ "compile", "runtime" ],           
 "comment" : "Tested on all target platforms.", 
 "ciUser": "builder",                           
 "timestamp" : ISO8601,                         
                                                
 "dryRun" : false,                              
 "sourceRepo" : "libs-snapshot-local",           
 "targetRepo" : "libs-release-local",           
 "copy": false,                                 
 "artifacts" : true,                            
 "dependencies" : false,                        
 "scopes" : [ "compile", "runtime" ],           
 "properties": {                                
     "components": ["c1","c3","c14"],
     "release-name": ["fb3-ga"]
 },
 "failFast": true                               
}

The request includes the following information:

Property

Mandatory

Type

Description

status

optional

string

The new status of the build. This is especially important when performing a promotion that only changes the status of the build without copying or moving artifacts and dependencies.

If the status is not defined for a move or copy operation, the following occurs during promotion:

  • If targetRepo is defined, the move or copy operation is performed but the promotion is not tracked.

  • If targetRepo is not defined, the promotion is ignored (without any error).

comment

optional

string

An optional comment describing the reason for the promotion.

ciUser

mandatory

string

The user that invoked promotion from the CI server.

timestamp

mandatory

date and time

The time when the promotion command was received by Artifactory (ISO8601 format).

The format is: 'yyyy-MM-dd'T'HH:mm:ss.SSSZ'. Example: '2016-02-11T18:30:24.825+0200'.

dryRun

mandatory

boolean

When set to true, performs a dry run of the promotion without executing any operation in Artifactory. This enables you to test whether the promotion will succeed. The results are returned in a JSON file.

The default value is false.

sourceRepo

optional

string

The repository from which the build contents will be copied or moved. If this property is not defined, the source repository is resolved automatically.

targetRepo

optional

string

The target repository to which the build contents will be copied or moved. This property does not need to defined if the promotion involves a change of status only.

copy

mandatory

boolean

Determines how to perform the build promotion:

  • true: Copies the artifacts (and optionally, the dependencies) to the targetRepo.

  • false: Moves the artifacts (and optionally, the dependencies) to the targetRepo.

The default value is false (move).

artifacts

mandatory

boolean

Determines whether to move/copy the build's artifacts.

The default value is true.

dependencies

mandatory

boolean

Determines whether to move/copy the build's dependencies.

The default value is false (dependencies are not included).

scopes

optional

array

An array of dependency scopes that indicate the circumstances under which a dependency is available. Relevant when dependencies is set to true. Common examples include compile and runtime.

properties

optional

array

A list of properties to attach to the build's artifacts (regardless of whether a targetRepo is defined.

failFast

mandatory

boolean

When set to true, fails and aborts the promotion operation upon receiving an error.

The default value is true.

Produces: application/json (application/vnd.org.jfrog.artifactory.build.PromotionResult+json)

Sample Output:

{
  "messages" : [
    {
      "level": "error",
      "message": "The repository has denied...."
    },...
  ]
}

Status Codes:

Code

Description

200

Success

401

Bad Credentials

403

Permission Denied

404

Not Found