今天同时看完《Pro Continuous Delivery With Jenkins 2.0》,

这书与工作关系很大,但也是快速翻翻。

本书着重点jenkins高可用环境搭建,与github,k8s的集成。

如果是新手,baby step方式,很有亲和力。

于我,收获一个成熟的pipeline script.

node('docker_it') {

    stage('Poll') {
        checkout([$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations:
        false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'github-account',
        url: 'https://github.com/pro-continuous-delivery/hello-world-greeting.git']]])
    }

    stage('Build'){
        sh 'mvn clean verify -DskipITs=true';
    }

    stage('Static Code Analysis'){
        sh 'mvn clean verify sonar:sonar';
    }

    stage ('Integration Test'){
        sh 'mvn clean verify -Dsurefire.skip=true';
    }

    stage ('Publish to Artifactory'){
        def server = Artifactory.server 'Default Artifactory Server'
        def uploadSpec = """{
            "files": [{
                "pattern": "target/hello-0.0.1.war",
                "target": "helloworld-greeting-project/${BUILD_NUMBER}/",
                "props": "Integration-Tested=Yes;Performance-Tested=No"
            }]
        }"""
        server.upload(uploadSpec)
    }

    stash includes: 'target/hello-0.0.1.war,src/pt/Hello_World_Test_Plan.jmx', name: 'binary'
}

node('docker_pt') {

    stage ('Start Tomcat'){
        sh '''cd /home/jenkins/tomcat/bin
        ./startup.sh''';
    }

    stage ('Deploy to Testing Env'){
        unstash 'binary'
        sh 'cp target/hello-0.0.1.war /home/jenkins/tomcat/webapps/';
    }

    stage ('Performance Testing'){
        sh '''cd /opt/jmeter/bin/
        ./jmeter.sh -n -t /home/jenkins/workspace/helloworld-greeting-cd/src/pt/Hello_World_
        Test_Plan.jmx -l /home/jenkins/workspace/helloworld-greeting-cd/test_report.jtl''';
        step([$class: 'ArtifactArchiver', artifacts: '**/*.jtl'])
    }

    stage ('Promote build in Artifactory'){
        withCredentials([usernameColonPassword(credentialsId: 'artifactory-account', variable:
        'credentials')]) {
            sh 'curl -u${credentials} -X PUT "http://172.17.8.108:8081/artifactory/api/storage/
            helloworld-greeting-project/${BUILD_NUMBER}/hello-0.0.1.war?properties=Performance-
            Tested=Yes"';
        }
    }
}

《Pro Continuous Delivery With Jenkins 2.0》随书笔记的更多相关文章

  1. openStack CI(Continuous interaction)/CD(Continuous delivery) Gerrit/Jenkins安装及集成,插件配置

    preFace: CI/CD practice part contains the following action items and fields of expertise: Gerrit ins ...

  2. Jenkins实现CI(Continuous Integration)到CD(Continuous Delivery)

    Pipeline as Code是2.0的精髓所在,是帮助Jenkins实现CI(Continuous Integration)到CD(Continuous Delivery)华丽转身的关键推手.所谓 ...

  3. Go as continuous delivery tool for .NET

    http://simon-says-architecture.com/2014/02/28/go-as-continuous-delivery-tool-for-net/ Following my p ...

  4. 解决Jenkins 2.0 初始化界面卡住的问题

    ***************************************** *原创博客转载请注明出处,谢谢!* **************************************** ...

  5. Jenkins 2.0 要来了

    Jenkins 在2016/02/29日发布了2.0 alpha版本,https://jenkins-ci.org/2.0/ , 改进界面,向前兼容,增加新功能: 1.初始化时可以选择推荐插件或自定义 ...

  6. 关于CI/CD/CD (Continuous Integration/Continuous Delivery/Continuous Deployment)

    Continuous Integration (CI) Continuous integration (CI) is the process that ensures the stability of ...

  7. cocos2d-x 3.0游戏实例学习笔记 《跑酷》 完结篇--源代码放送

    说明:这里是借鉴:晓风残月前辈的博客,他是将泰然网的跑酷教程,用cocos2d-x 2.X 版本号重写的,眼下我正在学习cocos2d-X3.0 于是就用cocos2d-X 3.0重写,并做相关笔记 ...

  8. 《玩转Django2.0》读书笔记-探究视图

    <玩转Django2.0>读书笔记-探究视图 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 视图(View)是Django的MTV架构模式的V部分,主要负责处理用户请求 ...

  9. 《玩转Django2.0》读书笔记-编写URL规则

    <玩转Django2.0>读书笔记-编写URL规则 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. URL(Uniform Resource Locator,统一资源定位 ...

随机推荐

  1. 「总结」插头$dp$

    集中做完了插头$dp$ 写一下题解. 一开始学的时候还是挺蒙的. 不过后来站在轮廓线$dp$的角度上来看就简单多了. 其实就是一种联通性$dp$,只不过情况比较多而已了. 本来转移方式有两种.逐行和逐 ...

  2. [LeetCode] 210. Course Schedule II 课程清单之二

    There are a total of n courses you have to take, labeled from 0 to n-1. Some courses may have prereq ...

  3. 面试:Semaphore(信号量)的成长之路

    2019最寒冷,面试跳槽不能等 马上就3月份了,所谓的金三银四招聘季.2019年也许是互联网最冷清的一年,很多知名的大型互联网公司都裁员过冬.当然也有一些公司还在持续招人的,比如阿里就宣称不裁员,反而 ...

  4. java 获取用户输入

    import java.util.Scanner; public class Sample { public static void main(String[] args) { int num; Sc ...

  5. 不同种类的ICP算法

    摘自<三维点云数据拼接中ICP及其改进算法综述>

  6. 实现100以内的素数输出(Python与C++对比)

    今天从链接http://www.2cto.com/kf/201302/187699.html中看到了Python实现100以内的素数输出的算法,颇受感触.尤其是被其中的Python的列表生成器的使用方 ...

  7. vertica单节点故障恢复 Startup Failed, ASR Required

    测试环境的vertica是单节点的,无法做到故障自动恢复,需要手工处理.案例如下: 发现5433端口连接不上,vertica挂了,手工运行admintools,重新启动vertica,仍然失败,提示: ...

  8. SQL ------------- 最大与最小函数

    sql max()  函数  求最大值,可以查询汉字,字母,日期,数字 注意:字母和汉字按照 a-z 依次查找,第一个最大的就是需要的                    比如:有两个字母或汉字都是 ...

  9. Android项目实现Module目录结构分组

    一.背景 项目需求的频繁迭代,新的产品功能在不断添加和延伸,随之带来的是,项目技术复杂度的提升. 近几年来,Android模块化.组件化相关技术得到极速发展,将项目整体进行分层,不同的层次之间依据实际 ...

  10. 【微信】微信小程序ISO上wx.scanCode BUG

    ================================================== BUG情况: 小程序在onLoad 主动调用wx.scanCode,安卓手机没有问题.iso调用失 ...