对于tar.gz归档文件,artifactory archive entry download API会系统地失败。
整个归档文件可以通过https://jcr.mydomain/artifactory/osb-cmdb-builds/manual_report.tgz下载,但https://jcr.mydomain/artifactory/osb-cmdb-builds/manual_report.tgz!/osb-cmdb/build/reports/tests/test/index.html上的个别文件会失败,并显示消息Unable to find zip resource: 'osb-cmdb/build/reports/tests/test/index.html' using full URI '/artifactory/osb-cmdb-builds/manual_report.tgz!/osb-cmdb/build/reports/tests/test/index.html'
但是,artifactory存储库浏览器可以正确地显示存档的内容。
这是使用docker镜像jfrog/artifactory-jcr版本:7.3.2和tar重现的
$ tar --version
tar (GNU tar) 1.29
$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.4 LTS"我是不是漏掉了什么?这是一个在以后的版本中修复的artifactory bug吗?
以下是重现该问题的步骤:
$ tar cvfz manual_report2.tgz ./osb-cmdb/build/reports/tests/test/index.html
$ tar tvfz manual_report2.tgz
-rw-r--r-- guillaume/guillaume 4193 2020-04-01 22:25 ./osb-cmdb/build/reports/tests/test/index.html查看browsing screenshot entry download screenshot屏幕截图
以及https://meta.stackexchange.com/questions/47689/how-can-i-attach-a-file-to-a-post中建议的google drive上的sample tgz
解决方法:使用zip或tar格式,而不是tar.gz格式。
发布于 2020-04-03 03:41:04
这个问题与“。在文件的路径中。您可以在树浏览器屏幕截图中看到路径的一部分。当您尝试下载时,Artifactory找不到文件的原因是路径缺少点。
点的棘手之处在于,它被认为是一个特殊的符号,可以转换到当前目录中。如果您尝试将其包含在用于下载文件的URL中,浏览器将删除该文件。
但是,通过使用URL编码,我能够使用cURL下载该文件:
curl -vv "http://localhost:8081/artifactory/generic-local/manual_report2.tgz%21/%2E/osb-cmdb/build/reports/tests/test/index.html"以下URL编码的使用适用于Firefox:
http://localhost:8081/artifactory/generic-local/manual_report2.tgz!%2F./osb-cmdb/build/reports/tests/test/index.html发布于 2020-04-03 18:27:19
( @dror-bereznitsky答案的改进)
避免在tar.gz归档文件中使用前导./。
如果归档路径是动态计算的(例如,find . -name "pattern"的结果),则按照https://unix.stackexchange.com/a/250186/381792中的建议使用--transform='s|^\./||S'参数调用tar命令
$ find . -name "index.html"
./osb-cmdb/build/reports/tests/test/index.html
$ tar cvfz manual_report2.tgz --transform='s|^\./||S' `find . -name "index.html"`
$ tar tvfz manual_report2.tgz
-rw-r--r-- guillaume/guillaume 4193 2020-04-01 22:25 osb-cmdb/build/reports/tests/test/index.htmlhttps://stackoverflow.com/questions/60988334
复制相似问题