Elo*_*irt 6 deployment rest automation curl nexus
我正在尝试验证我从Nexus下载的工件的校验和.我可以抓住工件并下载它们并检查它们的md5sum或sha1sum,但是我需要根据Nexus的实际总和来检查它,以便我可以验证它们是否正确.
这是我用来从Nexus获取文件的命令:
curl -v -L -o /mylocation/artifact.war -u 'myuser:mypass' --get 'http://ournexus.com/service/local/artifact/maven/content?g=com.ours.stuff&a=our-service-war&v=LATEST&r=snapshots&p=war'
Run Code Online (Sandbox Code Playgroud)
通过http://nexus.xwiki.org/nexus/nexus-indexer-lucene-plugin/default/docs/path__lucene_search.html,似乎我也可以搜索sha1总和,但是当我做&sha1时,我什么都没得到额外的或sha1 =(总和),即使我省略了上述所有选项,也没有提取任何内容.
这是有效的,但它是针对特定的战争,我们需要最新的(显然):
http://ournexus.com/service/local/repositories/snapshots/content/com/ours/stuff/ourapp/1.0.0-SNAPSHOT/ourapp-1.0.0-20140730.173704-88.war.sha1
Run Code Online (Sandbox Code Playgroud)
这是可能的,我是在正确的轨道上吗?
Nexus 2
使用工件内容 APIp通过将(打包)或e(扩展)参数指定为jar.md5或jar.sha1(或与实际打包相关的其他参数)来直接获取 MD5/SHA1 校验和文件。
例子:
$ curl -s 'http://mynexus/service/local/artifact/maven/content?g=com.example&a=example&v=1.2.3&r=my-repo&e=jar.sha1'
55856d711ab8b88f8c7b04fd85ff1643ffbfde7c
Run Code Online (Sandbox Code Playgroud)
Nexus 3
使用搜索 API查找并下载资产。
$ curl -sL 'https://mynexus/service/rest/v1/search/assets/download?repository=my-repo&sort=version&maven.groupId=com.example&maven.artifactId=example&maven.baseVersion=LATEST-SNAPSHOT&maven.extension=jar.sha1&maven.classifier='
7ff1ca9fb889c73d095b69a52d5c8609482b63ab
Run Code Online (Sandbox Code Playgroud)
您可以直接获取文件,也可以使用 Nexus API 以编程方式检索文件。
以下网址:
http://localhost:8081/nexus/service/local/artifact/maven/resolve?g=log4j&a=log4j&v=1.2.9&r=central
Run Code Online (Sandbox Code Playgroud)
返回以下结果:
<artifact-resolution>
<data>
<presentLocally>true</presentLocally>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.9</version>
<extension>jar</extension>
<snapshot>false</snapshot>
<snapshotBuildNumber>0</snapshotBuildNumber>
<snapshotTimeStamp>0</snapshotTimeStamp>
<sha1>55856d711ab8b88f8c7b04fd85ff1643ffbfde7c</sha1>
<repositoryPath>/log4j/log4j/1.2.9/log4j-1.2.9.jar</repositoryPath>
</data>
</artifact-resolution>
Run Code Online (Sandbox Code Playgroud)
xmllint 命令可用于解析 sha1 校验和值,如下所示:
$ curl -s "http://localhost:8081/nexus/service/local/artifact/maven/resolve?g=log4j&a=log4j&v=1.2.9&r=central" | xmllint --xpath "///sha1/text()" -
55856d711ab8b88f8c7b04fd85ff1643ffbfde7c
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7317 次 |
| 最近记录: |