If you upload an artifact to Artifactory and don't provide a checksum, it gives this warning:
How do you upload with curl
and include a checksum?
Checksum-Based Storage Overview Artifactory uniquely stores artifacts using checksum-based storage. A file that is uploaded to Artifactory, first has its SHA1 checksum calculated, and is then renamed to its checksum.
The benefits of checksum-based storage are unquestionable. From vastly improved performance when accessing binaries through significant reduction in filestore usage volume to support for any packaging format that may emerge on the market, checksum-based storage is a significant factor in optimizing your CI/CD workflow.
Go to the artifact browser, select the repository you want to upload to, and hit the Set Me Up button for instructions. You can upload a file using Artifactory UI. Go to the artifact browser, select the repository you want to upload to, and hit the Upload button for instructions.
This feature currently isn't well documented, an example is found on this page:
https://www.jfrog.com/knowledge-base/what-are-client-checksum-server-checksum-and-checksum-policy-in-local-repositories/
Simply add the following to the curl command: "--header "X-Checksum-<type>:${CHECKSUM}"
Sha1
CHECKSUM=$(shasum -a 1 foo.zip | awk '{ print $1 }') curl --header "X-Checksum-Sha1:${CHECKSUM}" --upload-file "foo.zip -u "admin:<apikey>" -v https://artifactory.example.com/foo/
MD5
CHECKSUM=$(md5sum foo.zip | awk '{ print $1 }') curl --header "X-Checksum-MD5:${CHECKSUM}" --upload-file "foo.zip -u "admin:<apikey>" -v https://artifactory.example.com/foo/
Or provide both checksums at once
ARTIFACT_MD5_CHECKSUM=$(md5sum foo.zip | awk '{print $1}') ARTIFACT_SHA1_CHECKSUM=$(shasum -a 1 foo.zip | awk '{ print $1 }') curl --upload-file "foo.zip" \ --header "X-Checksum-MD5:${ARTIFACT_MD5_CHECKSUM}" \ --header "X-Checksum-Sha1:${ARTIFACT_SHA1_CHECKSUM}" \ -u "admin:<apikey>" \ -v https://artifactory.example.com/foo/
Unfortunatley, uploading with the sha256 doesn't work with curl because of a bug
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With