如何获取 Nexus 存储库的给定命名空间中的工件名称列表



我只需要在 nexus 存储库中获取给定命名空间下的工件名称。

用于上传的关联网址:http://nexus.it.test.com:8080/nexus/repository/rawcentral/com.test/

示例工件名称:release_dev_2018909.tar.gz

请帮助我使用确切的 shell 命令来获取所有工件名称的列表。蒂亚

上面的脚本可以帮助你

#!/bin/bash
url="http://fileserver/service/rest/beta/search/assets?repository=maven-releases&name=dot-files"
artifact=( $(curl -s -X GET --header 'Accept: application/json' 
    "$url" | grep -Po '"downloadUrl" : ".*?[^\]*.(zip.sha1|zip)",' | 
    awk -F '"' '{print $4}' | sort -Vr | head -n2) )
((${#artifact[@]})) || echo "ERROR! No artifacts found at provided url!"
for i in "${artifact[@]}"; do
    if [[ $i =~ (sha1) ]]; then
        checksum=$(curl -s "$i" | awk '{print $1}')
    else
        file="$(echo "$i" | awk -F "/" '{print $NF}')"
        curl -sO "$i" || { echo "ERROR: Download failed!"; exit 1; }
        if [ "$(sha1sum "$file" | awk '{print $1}')" != "$checksum" ]; then
            echo "ERROR: Checksum validation on $file failed!"; exit 1;
        else
            printf "Downloaded : %snChecksum   : %sn" "$file" "$checksum"
        fi
    fi
done
#EOF

最新更新