答案 0 :(得分:13)
此功能目前尚未有详细记录,此页面上提供了一个示例:
只需将以下内容添加到curl命令:"--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/
或者一次提供两个校验和
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/
不幸的是,使用sha256上传并不适用于卷曲because of a bug
答案 1 :(得分:7)
对于MD5,SHA1和SHA256,这在7.4.3中对我有用。
for file in $(find a_folder -type f)
do
ARTIFACT_MD5_CHECKSUM=$(md5sum $file | awk '{print $1}')
ARTIFACT_SHA1_CHECKSUM=$(shasum -a 1 $file | awk '{ print $1 }')
ARTIFACT_SHA256_CHECKSUM=$(shasum -a 256 $file | awk '{ print $1 }')
echo curl --upload-file $file \
--header "X-Checksum-MD5:${ARTIFACT_MD5_CHECKSUM}" \
--header "X-Checksum-Sha1:${ARTIFACT_SHA1_CHECKSUM}" \
--header "X-Checksum-Sha256:${ARTIFACT_SHA256_CHECKSUM}" \
-u "admin:${APIKEY}" \
-v http://URL/$file
done
答案 2 :(得分:0)
由于我不允许发表评论,因此我将发表澄清作为答案。
This comment建议Deploy Artifact by Checksum
API是有关带有校验和验证的上传的文档。但这仅对Artifactory中已经存在的工件上传有效。
As documented,它将拒绝使用404上传新的工件。