1. 获取files list
curl -u ${JFROG_USER}:${JFROG_PWD} -X POST ${ARTIFACTORY_URL}/api/search/aql -H 'Content-Type: text/plain' -d \
"items.find({ \
\"type\" : \"file\", \
\"repo\" : {\"\$eq\" : \"${atf_repo}\"}, \
\"path\":{\"\$match\":\"${atf_path}*\"} \
}).include(\"name\",\"repo\",\"path\",\"actual_md5\",\"type\")" | tee "${tmp_file}"
2.获取多少天创建的files list
curl -u ${JFROG_USER}:${JFROG_PWD} -X POST ${ARTIFACTORY_URL}/api/search/aql -H 'Content-Type: text/plain' -d \
"items.find({ \
\"type\" : \"file\", \
\"repo\" : {\"\$eq\" : \"${repo}\"}, \
\"\$or\": [\
{\
\"\$and\": [\
{\
\"created\": { \"\$before\":\"${retention_days}d\" }\
}\
]\
}\
]\
}).include(\"name\",\"repo\",\"path\",\"actual_md5\",\"type\")" \
| jq '.results' \
| jq '.[] | "\(.repo)/\(.path)/\(.name)"' \
| sed 's/"//g' \
| sed "s#^#${ARTIFACTORY_URL}/#g"
3. 下载文件
curl -u ${JFROG_USER}:${JFROG_PWD} -O ${ARTIFACTORY_URL}/temp/1.txt
4.上传文件
curl -X PUT -u ${JFROG_USER}:${JFROG_PWD} -T 1.txt "${ARTIFACTORY_URL}/temp/1.txt"
# deploy files with property
curl -X PUT -u ${JFROG_USER}:${JFROG_PWD} -T 1.sh "${ARTIFACTORY_URL}/temp/1.sh;retention.days=20;build_os=ubuntu-18.04;"
5. copy 文件
curl -X POST -u ${JFROG_USER}:${JFROG_PWD} ${ARTIFACTORY_URL}/api/copy/temp/1.txt?to=temp/2.txt
6. 删除文件
curl -X DELETE -u ${JFROG_USER}:${JFROG_PWD} ${ARTIFACTORY_URL}/temp/1.txt