Reputation: 65
I have just started trying out Jenkins and Artifactory. I have managed to create a jenkins job that just runs MSBuild to create an .exe. I have also managed to upload this .exe to Artifactory.
What I would now like to do is to be able to add metadata e.g. git commit id, unit test result etc. to the artifacts that I want to load to Artifactory.
In Jenkins I can do that either by including a job configuration or including a filespec .json file.
Is the only way to add properties in the filespec dynamically to create a filespec dynamically? Or is there any other way in Jenkins (perhaps using Artifactory RestAPI) to add properties to the artefact before uploading to Artifactory?
I appreciate all the help I can get. Thanks! Sami
Upvotes: 2
Views: 1664
Reputation: 1726
What are you using to upload your exe to Artifactory? JFrog CLI? Jenkins artifactory plugin?
Assuming this is the Jenkins Artifactory Plugin, you can use a file spec to define the properties that you want to upload (that is the 'props' element described in https://www.jfrog.com/confluence/display/RTF/Using+File+Specs).
The file spec format supports variables when used with JFrog CLI, the variables defined with --spec-vars (see https://www.jfrog.com/confluence/display/CLI/CLI+for+JFrog+Artifactory#CLIforJFrogArtifactory-UploadingFiles), so I imagine that you can also use variables when used from the Jenkins Artifactory plugin...
Upvotes: 3