今天同时看完《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. 题解 P3620 【[APIO/CTSC 2007]数据备份】

    直接贪心(每次选最小)的话显然不对...样例都过不了... 选两个办公楼的时候,显然不能跨越另一个楼,这样不优... 于是 先把原数列处理成n-1个的数(每一个办公楼和上一个的距离),存在a[]中 题 ...

  2. css3中@font-face模块自定义字体

    一.@font-face模块介绍 @font-face是CSS3中的一个模块,他主要是把自己定义的Web字体嵌入到你的网页中,随着@font-face模块的出现,在Web的开发中使用字体不再只能使用W ...

  3. A1041 Be Unique (20 分)

    一.技术总结 这题在思考的时候遇见了,不知道怎么处理输入顺序问题,虽然有记录每个的次数,事后再反过来需要出现一次的且在第一次出现, 这时我们其实可以使用另一个数组用来存储输入顺序的字符,然后再用另一个 ...

  4. 【转】hibernate对象三种状态

    hibernate里对象有三种状态: 1,Transient 瞬时 :对象刚new出来,还没设id,设了其他值. 2,Persistent 持久:调用了save().saveOrUpdate(),就变 ...

  5. linux数据库中使用MD5加密

    MD5加密算法源码下载:https://pan.baidu.com/s/1nwyN0xV 下载完成了之后解压,得到两个文件 环境搭建: 1.把md5.h文件拷贝到/usr/include/目录下 su ...

  6. pom中更换阿里云仓库时不要忽略了pluginRepositories

    用maven也大几年了,也一直在用阿里云的中央仓库. 不喜欢在maven的settings.xml里改,更喜欢直接在pom.xml里改,因为受git管理,小伙伴们拉下来即可. 然而网上的大部分技术文章 ...

  7. sqlyog管理关系型数据库mysql数据库之sqlyog的安装管理

    .关系型数据库 有库有表,有关系 非关系型数据库  存储对象.集 下面的所有演示截图都是基不超过SQLyog 11进行的. 1. 2.点击上图中的应用程序,进行安装. 安装sqlyog , 账户dd0 ...

  8. [转帖]PostgreSQL的时间/日期函数使用

    PostgreSQL的时间/日期函数使用 https://www.cnblogs.com/mchina/archive/2013/04/15/3010418.html 这个博客的 文章目录比上一个好十 ...

  9. 宽字符与Unicode (c语言 汉语字符串长度)

    在C语言中,我们使用char来定义字符,占用一个字节,最多只能表示128个字符,也就是ASCII码中的字符.计算机起源于美国,char 可以表示所有的英文字符,在以英语为母语的国家完全没有问题. 但是 ...

  10. 【BZOJ4833】最小公倍佩尔数(min-max容斥)

    [BZOJ4833]最小公倍佩尔数(min-max容斥) 题面 BZOJ 题解 首先考虑怎么求\(f(n)\),考虑递推这个东西 \((1+\sqrt 2)(e(n-1)+f(n-1)\sqrt 2) ...