Thursday, April 7, 2022

[SOLVED] Artifactory: How to upload directory (contain debian packages) to local repo via curl command

Issue

This is how I upload files individually to our Artifactory:

curl -H 'X-JFrog-Art-Api:<API KEY>' -XPUT "https://<OUR SERVER>/artifactory/<REPO>/V1/<FILE>;deb.distribution=trusty;deb.component=main;deb.architecture=all" -T <FILE>

I can't seem to find how to upload a whole directory(contain debian packages), I'd assume it would something like this:

curl -H 'X-JFrog-Art-Api:<API KEY>' -XPUT "https://<OUR SERVER>/artifactory/<REPO>/<DIRECTORY>/;deb.distribution=trusty;deb.component=main;deb.architecture=all" -T <DIRECTORY>

Can someone help me out? Thanks!


Solution

We can make use of the Deploy artifacts from Archive REST API to upload a whole directory. However, we need to archive the directory and Artifactory will explode the archive when it's deployed by using the header "X-Explode-Archive: true"

Example:-

curl  -H 'X-JFrog-Art-Api:API KEY' \
-XPUT "http://OUR SERVER/artifactory/test-debianlocal/pool/deb.zip;deb.distribution=wheezy;deb.component=main;deb.architecture=i386" \
--header "X-Explode-Archive: true" \
-T deb.zip


Answered By - Balaji L S
Answer Checked By - Gilberto Lyons (WPSolving Admin)