I've been trying to find a way to upload builds to artifactory using CURL. I know that we can easily send packages, but i can't find info on sending builds that will land here:
Thanks !
In general, builds are published in two steps:
build.name
set to the build name, and build.number
set to the build number. If these properties are not set correctly, Artifactory won't know that they belong to your build.The build info file is uploaded. This isn't an artifact, and it uses a special REST API (this one). The build info file itself is a JSON file describing the build, and contains the build name and number, the checksums for all the files belonging to the build, and a lot of other (mostly optional) information. This is usually generated by a build tool, but the above link to the REST API has an example file that can be used as a reference to make one from scratch, if you really need it. An example for uploading a build info file:
curl -XPUT http://localhost:8081/artifactory/api/build -H "Content-Type: application/json" -T build.json
In your specific case, you appear to be using Conan. You can take a look at this, which documents how to generate and upload a build info file. Steps:
CONAN_TRACE_FILE
environment variable to a file path. This logs your build information to a trace file that can be converted to a build info file.In your Conan home, create a file artifacts.properties
. This file tells Conan to add specific properties (including the build.name
and build.number
required for deploying a build) whenever it deploys an artifact. An example artifacts.properties
file:
artifact_property_build.name=MyBuild
artifact_property_build.number=23
artifact_property_build.timestamp=1487676992
Run all of your build steps, including deploying the artifacts. Each step will log to the file you set in CONAN_TRACE_FILE
.
Run the conan_build_info
command and pass it the path to the CONAN_TRACE_FILE
. This will generate an appropriate build info file.
conan_build_info /tmp/traces.log --output /tmp/build_info.json
The newly generated build info file can now be uploaded to Artifactory using curl, as described above.
You can also publish a build using the JFrog CLI (documentation here)