jfrog artifactory jenkins pipeline 集成

1. 预备环境
artifactory ( 开源版本 )
maven  
jenkins 
jenkins artifactory plugin (在插件管理安装即可)
2. 配置artifactory 
 
a. maven local 仓库
 
 
b. jenkins 配置(添加 artifactory 账户信息)
 
 
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 构建效果
 
 
5. artifactory 效果
 
 
 
 
 
6. 总结
总的来说还是比较好用的,结合jenkins pipeline 可能方便的进行信息的查看,同时jfrog artifactory 的功能也是比较强大的,可以方便我们进行历史构建信息的查询
7. 参考资料
https://wiki.jenkins.io/display/JENKINS/Artifactory+Plugin
http://www.jfrogchina.com/open-source

posted on 2017-11-09 15:26 荣锋亮 阅读(...) 评论(...) 编辑 收藏

导航