Search code examples
jfrog-cli

How to upload deployment artifact in JFrog Artifactory with properties using JFrog-CLI?


I am able to

  1. build the deployment artifact in Jenkins job and

  2. upload this artifact with the below jfrog-cli command to Artifactory.

    jf rt u /home/appuser/temp/artifacts.zip project-artifacts-repo/ProjectName/GitBranchName/artifacts.zip --flat=true --server-id=app_artifactory

However, I am not able to update properties like 'GIT_COMMIT=$GIT_COMMIT;JENKINS_BUILD_URL=$BUILD_URL' in the same command for the artifact.zip being uploaded. It throws the Wrong number of arguments (4) error. Hopefully, jfrog-cli supports updating properties on the artifact zip file.

Can you please help me to update the above-mentioned properties in the same jfrog-cli command?


Solution

  • It is possible using the --target-props command option.
    To continue the example in the question:

    jf rt u --flat=true --server-id=app_artifactory \
       --target-props="GIT_COMMIT=$GIT_COMMIT;JENKINS_BUILD_URL=$BUILD_URL" \
       /home/appuser/temp/artifacts.zip \
       project-artifacts-repo/ProjectName/GitBranchName/artifacts.zip 
    

    For more information, please refer to the documentation.