Upload entire folder to Artifactory (free version) using cURL

I have a jFrog Artifactory local installation that is shipped with some other software that uses it heavily and I am forced to use it.

Since I don’t have the time to connect my GitLab CI to Artifactory (not sure if even possible with the free version), I decided to download my CI artifacts and then add them manually to a local Artifactory generic repo.

Initially I tried the Deploy button but neither single nor multiple upload seems to work as expected:

  • Single file upload requires a lot of work (target path needs to be written manually) and for some file (e.g. DLLs and even some LICENSE files (without extension)) it states that the file is undefined whatever that means. Directories do not seem to work at all (which would make sense I guess)
  • Multiple files upload works in terms of being able to upload multiple files. However, again I need to specify the target path manually. Also some files also give me the undefined nonsense.

I tried the curl that is given to the user when clicking on Set Me Up in the Deploy section, e.g.

curl -u admin:password -T <PATH_TO_FILE> “http://127.0.0.1:8081/artifactory/Dependencies/<TARGET_FILE_PATH>”

As I have found out this is something cURL doesn’t support. I read (but might have missed something) the manpage for the tool.

So I started digging. I found (e.g. SO answer)

curl -u user:password -X PUT http://[artifactory URL]/[repository name] -T /tmp/src/archive.zip -H 'X-Explode-Archive: true'

where the directory is archived, deployed and extracted, which ensures that the underlying directory structure is preserved. However, everyone seems to forget this is a Pro feature and if you try it, you will promptly get an error from Artifactory telling you this:

"errors" : [ {
    "status" : 400,
    "message" : "This REST API is available only in Artifactory Pro."
  } ]
}

My search lead me to the next one:

find <DIR-TO-UPLOAD> -type f -exec curl -u admin:password -T {} "http://127.0.0.1:8081/artifactory/<REPO>/"

However, perhaps because I am using Git Bash (I have read there are some issue running cURL in particular in such an environment) I get

$ find debug -type f -exec curl -u admin:password -T {} "http://127.0.0.1:8081/artifactory/Dependencies/"
find: missing argument to `-exec'

At least find seems to work in terms of getting a list of files, e.g.

...

debug/include/spdlog/tweakme.h
debug/include/spdlog/version.h
debug/lib
debug/lib/DirectXTex.lib
debug/lib/DirectXTex.pdb
debug/lib/imgui_static.lib
debug/lib/spdlogd.lib
debug/LICENSE
debug/LICENSES_nlohmann
debug/LICENSE_argparse
debug/LICENSE_DirectXTex
debug/LICENSE_imgui
debug/LICENSE_nlohmann
debug/LICENSE_opencv
debug/LICENSE_spdlog
debug/OpenCVConfig-version.cmake
debug/OpenCVConfig.cmake
debug/setup_vars_opencv4.cmd
debug/x64
debug/x64/vc16
debug/x64/vc16/bin
debug/x64/vc16/bin/opencv_calib3d4100d.dll
debug/x64/vc16/bin/opencv_core4100d.dll

...

I am currently looking into writing a script (since I use Windows probably in Powershell) to do something similar to

#!/bin/sh

for file in /folder/path/* # Can replace with find call
do
  curl -u username:password -T ${file} http://www.example.com/folder/${file}
done

cURL also supports multiple files and URLs in a single call.

But I am curious if the free version of Artifactory is really that crippled and such a trivial task is not supported without the customer having to pay up. I currently have almost 700 files (DLLs, libs, config files, LICENSE files, documentation and what not) and I certainly don’t have the willpower to manually upload each one manually.

Since I am new to Artifactory, I would also like to know if one can copy artifacts to wherever the repository Artifactory manages stores its files on the local system. Sadly, I have the feeling that would not be possible but worth asking anyways.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật