jfrog artifactory jenkins pipeline 集成
Posted rongfengliang-荣锋亮
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了jfrog artifactory jenkins pipeline 集成相关的知识,希望对你有一定的参考价值。
1. 预备环境
artifactory ( 开源版本 )
maven
jenkins
jenkins artifactory plugin (在插件管理安装即可)
2. 配置artifactory
a. maven local 仓库
![](https://image.cha138.com/20210607/4c871b567725485b8cd936232e1c069b.jpg)
![](https://image.cha138.com/20210607/f51d066f8d1243f6bb45eb0e1acd6e20.jpg)
![](https://image.cha138.com/20210607/ff19db97e05948dcb94e50969e48d215.jpg)
b. jenkins 配置(添加 artifactory 账户信息)
![](https://image.cha138.com/20210607/f40e7881e41e44409bd71fde33fa97bf.jpg)
3. jenkins pipeline 配置(实例使用github 实例)
jenkinsfile 内容如下:
node("docker-64") {
def server = Artifactory.newServer url: "http://xxxxxx:8081/artifactory", credentialsId: \'jfrog-artifactory\'
def rtMaven = Artifactory.newMavenBuild()
def buildInfo
stage (\'Clone\') {
git url: \'https://github.com/jfrogdev/project-examples.git\'
}
stage (\'Artifactory configuration\') {
rtMaven.tool = \'64maven\' // Tool name from Jenkins configuration
rtMaven.deployer releaseRepo: \'aliyun\', snapshotRepo: \'aliyun\', server: server
buildInfo = Artifactory.newBuildInfo()
}
stage (\'Exec Maven\') {
rtMaven.run pom: \'maven-example/pom.xml\', goals: \'clean install\', buildInfo: buildInfo
}
stage (\'Publish build info\') {
server.publishBuildInfo buildInfo
}
}
4. jenkins 构建效果
![](https://image.cha138.com/20210607/398f47c4556a46938bd0b0ca12dc6423.jpg)
5. artifactory 效果
![](https://image.cha138.com/20210607/90a45c09852b4b4492f8c59bd3fb046a.jpg)
![](https://image.cha138.com/20210607/99f3b78beaf840b2867854f812a7e8e8.jpg)
![](https://image.cha138.com/20210607/6c0ad31791084bc68d01592fa46f136c.jpg)
![](https://image.cha138.com/20210607/9cb567ac30a9407591f44836ebff7dc5.jpg)
6. 总结
总的来说还是比较好用的,结合jenkins pipeline 可能方便的进行信息的查看,同时jfrog artifactory 的功能也是比较强大的,可以方便我们进行历史构建信息的查询
7. 参考资料
https://wiki.jenkins.io/display/JENKINS/Artifactory+Plugin
http://www.jfrogchina.com/open-source
以上是关于jfrog artifactory jenkins pipeline 集成的主要内容,如果未能解决你的问题,请参考以下文章
如何在将通用工件上传到jenkins管道中的JFrog Artifactory时重命名现有文件夹
jenkins 与 jfrog container registry 集成示例
使用声明性管道将项目 Jar 作为 maven 工件发布到 Jfrog Artifactory