今天同时看完《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. mysql悲观锁的实现

    https://www.cnblogs.com/laoyeye/p/8228467.html 参考原文链接, //0.开始事务 begin;/begin work;/start transaction ...

  2. TCP/UDP通信中server和client是如何知道对方IP地址的

    在TCP通信中 client是主动连接的一方,client对server的IP的地址提前已知的.如果是未知则是没办法通信的. server是在accpet返回的时候知道的,因为数据包中包含客户端的IP ...

  3. [LeetCode] 119. Pascal's Triangle II 杨辉三角之二

    Given a non-negative index k where k ≤ 33, return the kth index row of the Pascal's triangle. Note t ...

  4. LeetCode 75. Sort Colors (颜色分类):三路快排

    Given an array with n objects colored red, white or blue, sort them in-place so that objects of the ...

  5. 是时候解决 students's Test 假设检验(显著性检验)了

    T test 由来已久 T 检验的概念 假设检验的步骤 假设检验可以分为三步: 建立检验假设和确定检验水准 单侧检验与双侧检验 选定检验方法和计算检验统计量 确定P值和做出推断结论 假设检验的两类错误 ...

  6. ReentrantLock和Condition实现生产者和消费者

    一个生产者和一个消费者 public class ConditionTest { private static ReentrantLock lock = new ReentrantLock(); pr ...

  7. sublime-text-3-build-3207 破解+注册码

    按照以下步骤依次进行 打开 https://hexed.it/ 单机 "Open file" 并选择 "sublime_text.exe" 可执行文件. 转到 ...

  8. OCC与MVCC 的区别

    一.前言 在数据库中,并发控制是指在多个用户/进程/线程同时对数据库进行操作时,如何保证事务的一致性和隔离性的,同时最大程度地并发. 当多个用户/进程/线程同时对数据库进行操作时,会出现3种冲突情形: ...

  9. 一些个人认为特别的安卓 App 介绍

    MoboPlayer (一款息屏也能播放视频的 App) 快图浏览(快速列出手机中的图片和视频,小巧且不会申请安卓各种权限)

  10. Prometheus Grafana可视化展示Linux资源使用率

    Prometheus Grafana可视化展示Linux资源使用率  Grfana官方仪表盘下载:https://grafana.com/dashboards 数据源推荐:https://grafan ...