今天同时看完《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. requests--Cookie设置

    前戏 有些页面需要登录才可以访问,而服务器是根据cookie来进行判断的,服务器拿到浏览器的cookie,然后再数据库里进行查询判断,如果校验通过,则服务器认为是登录过的,才有继续访问的权限,否则,服 ...

  2. 2019CCPC网络预选赛 八道签到题题解

    目录 2019中国大学生程序设计竞赛(CCPC) - 网络选拔赛 6702 & 6703 array 6704 K-th occurrence 6705 path 6706 huntian o ...

  3. nodejs的作用【转】

    来源地址:https://www.zhihu.com/question/33578075/answer/56951771 如果你去年注意过技术方面的新闻,我敢说你至少看到node.js不下一两次.那么 ...

  4. windows 排查javaWeb程序占用CPU过高问题(可追踪到问题代码所在行)

      1.情景展示 java虚拟机占用这么高的CPU,肯定不正常! 2.原因分析 第一个是tomcat,正在运行java项目: 第二个是eclipse,因为eclipse的运行依赖于java. 现在的问 ...

  5. 推荐WEB 端批量移动设备管理控制工具STF

    推荐WEB 端批量移动设备管理控制工具STF 1 官方网站 https://openstf.io/ 2 github https://github.com/openstf/stf 后面有时间了,抽空也 ...

  6. c# 自动给版本升级,遇9变0且前面一个版本加1

    /// <summary> /// 版本辅助类 /// 创建人: /// 创建时间:2019-11-18 13:53:55 /// </summary> public clas ...

  7. ThinkPHP连接Oracle数据库的详细教程

    一. 操作环境搭建 系统:Windows7 旗舰版 64位PHP环境:wampserver2.2e-php5.4.3-httpd2.2.22-mysql5.5.24 32位版ThinkPHP:3.0正 ...

  8. javascirpt的json.stringify()方法在IE浏览器兼容性模式下出错的原因与解决办法

    今天开机混底薪的时候遇到一个JSON.stringify()在IE浏览器兼容模式下的问题. 问题描述 一个弹窗选择的功能原来好好的,突然就不行了. 想要调试调试不了,报错信息也看不到(一开F12这破I ...

  9. nginx产生【413 request entity too large】错误的原因与解决方法

    项目上在做上传文件(清单导入)的时候产生了这个错误: 从字面上看,说的是请求的实体太大的问题,那么可以联想到是HTTP请求中的Body大小被限制了的原因. Nginx中的[client_max_bod ...

  10. HTML模版大全网

    HTML模版大全网,里面有一部分是后台管理的网站模版,HTML全都有.大家有需要的话,可以自行去下载. http://www.htmlmbdq.com