1

I have directory like /tmp/some-js/(a lot of folders)

I added it into zip /tmp/some-js.zip

I have structure in artifactory like /npm-dev/some-js/*

I put into artifactory this zip with command

curl -u user:api-key -k -X PUT https://xxx.xx.xx.xx:8081/artifactory/npm_dev/some-js/ -T /tmp/some-js.zip

And I have got directory in artifactory /npm-dev/some-js/some-js.zip/*

There is a way to specify unpacking some-js.zip contents into /npm-dev/some-js ?

TylerH
  • 20,799
  • 66
  • 75
  • 101
mamol
  • 91
  • 2
  • 11
  • Seems duplicate of: https://stackoverflow.com/questions/40477093/how-to-upload-entire-directory-to-artifactory-in-linux-using-curl-or-any-shell-s. You can add a header to extract the content of the zip file during upload, by adding X-Explode-Archive: true – Tom.A Jun 28 '22 at 08:44
  • @Tom.A thank you! I didn't find this post. Should i delete this? – mamol Jun 28 '22 at 09:01
  • Does this answer your question? [How to upload entire directory to artifactory in Linux using curl or any shell script or any commandline utility in Linux?](https://stackoverflow.com/questions/40477093/how-to-upload-entire-directory-to-artifactory-in-linux-using-curl-or-any-shell-s) – TylerH Aug 10 '22 at 15:50

1 Answers1

2

Uploading an archive file (such as a zip file) to Artifactory and extracting its content to a specific directory is done by:

PUT https://<jfrog-platform>/artifactory/the-repo/path/to/dir/file.zip
X-Explode-Archive: true

<file-content>

The content of file.zip will be extracted and deployed under the-repo/path/to/dir/, preserving the relative directory structure in the zip file. So if file.zip has the following structure:

foo/
  |- bar.txt
  |- baz.txt

The following files will be created in Artifactory:

the-repo/path/to/dir/foo/bar.txt
the-repo/path/to/dir/foo/baz.txt

Using curl and the details in the question:

curl -u user:api-key \
     -k \
     -X PUT \
     https://xxx.xx.xx.xx:8081/artifactory/npm_dev/some-js/some-js.zip \
     -T /tmp/some-js.zip
     -H "X-Explode-Archive: true"

For more information, see the documentation on Deploy Artifacts from Archive

yinon
  • 1,418
  • 11
  • 14