Some builds created through the API can not be promoted

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Some builds created through the API can not be promoted


I want to create a build which includes a number of artifacts that have been deployed separately. I can not get it to work.

To try to understand the issue I've made a small test case but it behaves very strangely it seems to me. It tries to do the following using curl calls:

  1. Delete the test repository
  2. Create the test repository
  3. Delete the build, if it remains from a previous run
  4. Create the build, containing a test artifact
  5. Promote the build to the test repository
When creating the build I use a json file which is a stripped down version of the json file Maven left when I created the test artifact.

Now, the strange part I don't understand: the promotion step (5) fails if the build is numbered 2. It works if it is numbered 1. Actually creating the build works in both cases, it is the promotion that differs. The error message is

  "errors" : [ {
    "status" : 400,
    "message" : "Unable to find artifacts of build 'goerans-maven-bygge' #2: aborting promotion."
  } ]

I've looked at the builds and the repositories via the web interface to Artifactory, but I don't see any explanation of what goes wrong. I do see that my test repository gets populated when promoting build 1, but not when promoting build 2.


The curl command used to create the build looks like this

curl -u … -X PUT -H 'Content-Type: application/' --upload goerans-maven-bygge.1.json …/api/build
The contents of the json file is this:
  "version" : "1.0.1",
  "name" : "goerans-maven-bygge",
  "number" : "1",
  "started" : "2016-08-17T14:01:54.222+0200",
  "modules" : [ {
    "id" : "com.jeppesen.jcms:goerans-maven-bygge:1.0.0",
    "artifacts" : [ {
      "type" : "pom",
      "sha1" : "a1e1e32d511b6f481755808b80dff5f9d0d8249f",
      "md5" : "942c74d767a10a62ec0168544d97ca32",
      "name" : "goerans-maven-bygge-1.0.0.pom"
    } ]
  } ]
When creating a build with number 2, the file sets number to 2, otherwise it is the same.

When promoting the build; I use this curl command

curl -u … -X POST -H 'Content-Type: application/json' --data '{"status":"befordrad","ciUser":"göran","copy": true,"targetRepo":"görans-förråd","properties":{"status":["befordrad"]}}' …/api/build/promote/goerans-maven-bygge/1
This works, but when having created build 2 and thus having a 2 at the end of the latter curl command, it fails with the error message mentioned above.