[英]Artifactory REST API: How can I reassociate a build with a deployed artifact?
When you deploy an artifact to Artifactory over an existing artifact, it does not associate it with the build that the existing artifact has. 在现有工件上将工件部署到Artifactory时,它不会将其与现有工件具有的构建关联。
For example: If you used the Jenkins Artifactory Plugin to deploy three artifacts: 例如:如果您使用Jenkins Artifactory插件来部署三个工件:
example.jar
example.pom
example.json
Then it would create a new build, associate these artifacts with that build, and deploy the artifacts to the location and repo you specified. 然后,它将创建一个新构建,将这些构件与该构建相关联,并将构件部署到您指定的位置和repo。
Let's say this deployed to /libs-release-local/example/1.0/ with buildName "example-build" and buildNumber 51 假设使用buildName“example-build”和buildNumber 51将其部署到/libs-release-local/example/1.0/
If you looked at the artifacts, you will see on the build tab that it is associated with the build-info.json. 如果您查看了工件,您将在构建选项卡上看到它与build-info.json相关联。
Now, let's say you deploy example.json using the REST API to the same location: 现在,假设您使用REST API将example.json部署到同一位置:
PUT /libs-release-local/example/1.0/example.json
Now the new artifact is not associated with the build-info.json! 现在,新工件与build-info.json无关!
How can I deploy the artifact so that it is associated with an already existing build-info.json? 如何部署工件以使其与已存在的build-info.json相关联? (in this example, the "/example-build/51" build).
(在此示例中,“/ example-build / 51”构建)。
Not being able to do this causes all sorts of issues (such as when build_promotion is done, it promotes only the previously associated artifacts, and not anything deployed later.) 无法执行此操作会导致各种问题(例如,当build_promotion完成时,它仅提升先前关联的工件,而不会提升以后部署的任何工件。)
Artifactory associates the Build Info
descriptor with the build artifacts artifacts based on their checksum . Artifactory基于其校验和将
Build Info
描述符与构建工件工件相关联。
If you look at the JSON which is the Build Info
descriptor, you'll be able to see: 如果你看一下
Build Info
描述符的JSON,你将能够看到:
{
...
"modules" : [ {
"id" : "org._10ne.gradle:rest-gradle-plugin:0.2.0",
"artifacts" : [ {
"type" : "pom",
"sha1" : "f0dcec6a603aa99f31990e20c0f314749f0e22ca",
"md5" : "427dcf49c07cc7be175ea31fd92da44e",
"name" : "rest-gradle-plugin-0.2.0.pom"
},
....
}
}
A Build Info
descriptor describes a "build" which is essentially a single unit of module/s produced by a certain process; Build Info
描述符描述“构建”,其基本上是由特定过程产生的单个模块单元; this process depends on a specific environment. 这个过程取决于特定的环境。
You're deploying a new artifact which was not part of the original process or environment that the Build Info
describes; 您正在部署一个新工件,该工件不是
Build Info
描述的原始流程或环境的一部分 ; if it was, it would have been produced with the exact same checksum as the former artifact 如果是的话,它将使用与前一个工件完全相同的校验和生成
You are basically compromising the integrity of the "build" unit . 您基本上会损害“构建”单元的完整性 。
The "right" way to do it would be to start a new build process and produce a valid Build Info
descriptor. “正确”的方法是启动新的构建过程并生成有效的
Build Info
描述符。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.