如何检测工件中的重复工件

发布于 2024-12-05 02:52:51 字数 128 浏览 0 评论 0 原文

我知道工件使用基于校验和的存储,并且即使我以不同的名称上传多个相同的工件,也只会存储工件的一份副本。

由于我有许多项目具有版本匿名但可能相同的 jar,因此我想知道是否有任何方法可以让神器告诉我在多个 id 下引用了哪些神器。

I know that artifactory uses checksum based storage and will only store one copy of an artifact even if I upload multiple identical ones under different names.

As I have many projects with version-anonymous but probably identical jars, I would like to know if there is any way of getting artifactory to tell me which artifacts are referenced under multiple ids.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

不知在何时 2024-12-12 02:52:51

虽然 Artifactory 没有提供此信息的现有功能,但实际上使用利用 Artifactory 的 REST-API

例如,您可以编写一个树遍历器(使用 文件夹信息资源)将校验和映射到文件(文件校验和可以使用文件信息资源)。

或者,如果您使用 Artifactory 的 Pro 版本,则可以使用 文件列表资源

While Artifactory has no existing feature that provides this info, it is actually quite easy to achieve with a small script that utilizes Artifactory's REST-API.

You can for example, write a tree walker (using the Folder Info resource) that maps checksums to files (file checksum can be obtained using the File Info resource).

Or if you use the Pro version of Artifactory, you can retrieve a list of all artifacts within a repository using the File List resource

清秋悲枫 2024-12-12 02:52:51

下面是针对 PostGreSQL 数据库运行的 SQL。我还没有尝试过使用任何其他数据库。

select sha1_actual, node_name, node_path, repo, *
from nodes
where sha1_actual in 
(
    select sha1_actual 
    from nodes
    where node_type != 0
    group by sha1_actual
    having count(1) > 1
)
order by sha1_actual

Here's SQL to run against the PostGreSQL database. I haven't tried it with any other database.

select sha1_actual, node_name, node_path, repo, *
from nodes
where sha1_actual in 
(
    select sha1_actual 
    from nodes
    where node_type != 0
    group by sha1_actual
    having count(1) > 1
)
order by sha1_actual
固执像三岁 2024-12-12 02:52:51
#!/bin/bash

#
# search in artifactory, lists duplicates [email protected]
#

search=$1

if [ "X$search" == "X" ]
then
    echo "$0 <search item>"
    exit 1
else
    search=`echo $search |sed -e 's/ /\%20/gi' `
    search="*${search}*"
fi

USER=`whoami`
PASS=${PASS:-somepass}
CREDS=${USER}:${PASS}
ARTIFACTORY=https://artifactory.somesite.com/artifactory

curl -s -u ${CREDS} -o search.txt ${ARTIFACTORY}/api/search/artifact\?name=${search}

echo "List of all uris is in search.txt"
echo "All instances of $search follow"
echo "---------------------------------"
grep $search search.txt | grep -v pom | awk '{ print $3}'  | xargs -i  basename {} | sort | uniq -c | sort -rn
#!/bin/bash

#
# search in artifactory, lists duplicates [email protected]
#

search=$1

if [ "X$search" == "X" ]
then
    echo "$0 <search item>"
    exit 1
else
    search=`echo $search |sed -e 's/ /\%20/gi' `
    search="*${search}*"
fi

USER=`whoami`
PASS=${PASS:-somepass}
CREDS=${USER}:${PASS}
ARTIFACTORY=https://artifactory.somesite.com/artifactory

curl -s -u ${CREDS} -o search.txt ${ARTIFACTORY}/api/search/artifact\?name=${search}

echo "List of all uris is in search.txt"
echo "All instances of $search follow"
echo "---------------------------------"
grep $search search.txt | grep -v pom | awk '{ print $3}'  | xargs -i  basename {} | sort | uniq -c | sort -rn
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文