Advertisement
Guest User

METHOD CODE TOO LARGE

a guest
Mar 7th, 2019
576
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Groovy 46.01 KB | None | 0 0
  1. #!groovy
  2.  
  3.  
  4. import groovy.time.TimeCategory
  5. import groovy.time.TimeDuration
  6.  
  7. times = [:]
  8.  
  9.  
  10.  
  11. pipeline {
  12.     agent {
  13.         node {
  14.             label 'pipeline_builder'
  15.         }
  16.     }
  17.  
  18.  
  19.     stages {
  20.         stage('Build') {
  21.             when {
  22.                 environment name: 'SKIP_BUILD', value: 'false'
  23.                 beforeAgent true
  24.             }
  25.             failFast true
  26.             parallel {
  27.                 stage('Build 1') {
  28.                     agent {
  29.                         node {
  30.                             label 'pipeline_builder'
  31.                         }
  32.                     }
  33.                     when {
  34.                         environment name: 'SKIP_BUILD', value: 'false'
  35.                         beforeAgent true
  36.                     }
  37.                     steps {
  38.                         timeout(time: 60, unit: 'MINUTES') {
  39.                             startStage();
  40.                             script {
  41.                                 letsBuildSomething()
  42.                             }
  43.                         }
  44.                     }
  45.                     post {
  46.                         success {
  47.                             script {
  48.                                 postBuildSuccess()
  49.                             }
  50.                         }
  51.                         failure {
  52.                             script {
  53.                                 postBuildFailure()
  54.                             }
  55.                         }
  56.                         cleanup {
  57.                             script {
  58.                                 postBuildCleanup()
  59.                             }
  60.                             endStage()
  61.                         }
  62.                     }
  63.                 }
  64.                 stage('Build 1') {
  65.                     agent {
  66.                         node {
  67.                             label 'pipeline_builder'
  68.                         }
  69.                     }
  70.                     when {
  71.                         environment name: 'SKIP_BUILD', value: 'false'
  72.                         beforeAgent true
  73.                     }
  74.                     steps {
  75.                         timeout(time: 60, unit: 'MINUTES') {
  76.                             startStage();
  77.                             script {
  78.                                 letsBuildSomething()
  79.                             }
  80.                         }
  81.                     }
  82.                     post {
  83.                         success {
  84.                             script {
  85.                                 postBuildSuccess()
  86.                             }
  87.                         }
  88.                         failure {
  89.                             script {
  90.                                 postBuildFailure()
  91.                             }
  92.                         }
  93.                         cleanup {
  94.                             script {
  95.                                 postBuildCleanup()
  96.                             }
  97.                             endStage()
  98.                         }
  99.                     }
  100.                 }
  101.                 stage('Build 1') {
  102.                     agent {
  103.                         node {
  104.                             label 'pipeline_builder'
  105.                         }
  106.                     }
  107.                     when {
  108.                         environment name: 'SKIP_BUILD', value: 'false'
  109.                         beforeAgent true
  110.                     }
  111.                     steps {
  112.                         timeout(time: 60, unit: 'MINUTES') {
  113.                             startStage();
  114.                             script {
  115.                                 letsBuildSomething()
  116.                             }
  117.                         }
  118.                     }
  119.                     post {
  120.                         success {
  121.                             script {
  122.                                 postBuildSuccess()
  123.                             }
  124.                         }
  125.                         failure {
  126.                             script {
  127.                                 postBuildFailure()
  128.                             }
  129.                         }
  130.                         cleanup {
  131.                             script {
  132.                                 postBuildCleanup()
  133.                             }
  134.                             endStage()
  135.                         }
  136.                     }
  137.                 }
  138.                 stage('Build 1') {
  139.                     agent {
  140.                         node {
  141.                             label 'pipeline_builder'
  142.                         }
  143.                     }
  144.                     when {
  145.                         environment name: 'SKIP_BUILD', value: 'false'
  146.                         beforeAgent true
  147.                     }
  148.                     steps {
  149.                         timeout(time: 60, unit: 'MINUTES') {
  150.                             startStage();
  151.                             script {
  152.                                 letsBuildSomething()
  153.                             }
  154.                         }
  155.                     }
  156.                     post {
  157.                         success {
  158.                             script {
  159.                                 postBuildSuccess()
  160.                             }
  161.                         }
  162.                         failure {
  163.                             script {
  164.                                 postBuildFailure()
  165.                             }
  166.                         }
  167.                         cleanup {
  168.                             script {
  169.                                 postBuildCleanup()
  170.                             }
  171.                             endStage()
  172.                         }
  173.                     }
  174.                 }
  175.                 stage('Build 1') {
  176.                     agent {
  177.                         node {
  178.                             label 'pipeline_builder'
  179.                         }
  180.                     }
  181.                     when {
  182.                         environment name: 'SKIP_BUILD', value: 'false'
  183.                         beforeAgent true
  184.                     }
  185.                     steps {
  186.                         timeout(time: 60, unit: 'MINUTES') {
  187.                             startStage();
  188.                             script {
  189.                                 letsBuildSomething()
  190.                             }
  191.                         }
  192.                     }
  193.                     post {
  194.                         success {
  195.                             script {
  196.                                 postBuildSuccess()
  197.                             }
  198.                         }
  199.                         failure {
  200.                             script {
  201.                                 postBuildFailure()
  202.                             }
  203.                         }
  204.                         cleanup {
  205.                             script {
  206.                                 postBuildCleanup()
  207.                             }
  208.                             endStage()
  209.                         }
  210.                     }
  211.                 }
  212.                 stage('Build 1') {
  213.                     agent {
  214.                         node {
  215.                             label 'pipeline_builder'
  216.                         }
  217.                     }
  218.                     when {
  219.                         environment name: 'SKIP_BUILD', value: 'false'
  220.                         beforeAgent true
  221.                     }
  222.                     steps {
  223.                         timeout(time: 60, unit: 'MINUTES') {
  224.                             startStage();
  225.                             script {
  226.                                 letsBuildSomething()
  227.                             }
  228.                         }
  229.                     }
  230.                     post {
  231.                         success {
  232.                             script {
  233.                                 postBuildSuccess()
  234.                             }
  235.                         }
  236.                         failure {
  237.                             script {
  238.                                 postBuildFailure()
  239.                             }
  240.                         }
  241.                         cleanup {
  242.                             script {
  243.                                 postBuildCleanup()
  244.                             }
  245.                             endStage()
  246.                         }
  247.                     }
  248.                 }
  249.                 stage('Build 1') {
  250.                     agent {
  251.                         node {
  252.                             label 'pipeline_builder'
  253.                         }
  254.                     }
  255.                     when {
  256.                         environment name: 'SKIP_BUILD', value: 'false'
  257.                         beforeAgent true
  258.                     }
  259.                     steps {
  260.                         timeout(time: 60, unit: 'MINUTES') {
  261.                             startStage();
  262.                             script {
  263.                                 letsBuildSomething()
  264.                             }
  265.                         }
  266.                     }
  267.                     post {
  268.                         success {
  269.                             script {
  270.                                 postBuildSuccess()
  271.                             }
  272.                         }
  273.                         failure {
  274.                             script {
  275.                                 postBuildFailure()
  276.                             }
  277.                         }
  278.                         cleanup {
  279.                             script {
  280.                                 postBuildCleanup()
  281.                             }
  282.                             endStage()
  283.                         }
  284.                     }
  285.                 }
  286.                 stage('Build 1') {
  287.                     agent {
  288.                         node {
  289.                             label 'pipeline_builder'
  290.                         }
  291.                     }
  292.                     when {
  293.                         environment name: 'SKIP_BUILD', value: 'false'
  294.                         beforeAgent true
  295.                     }
  296.                     steps {
  297.                         timeout(time: 60, unit: 'MINUTES') {
  298.                             startStage();
  299.                             script {
  300.                                 letsBuildSomething()
  301.                             }
  302.                         }
  303.                     }
  304.                     post {
  305.                         success {
  306.                             script {
  307.                                 postBuildSuccess()
  308.                             }
  309.                         }
  310.                         failure {
  311.                             script {
  312.                                 postBuildFailure()
  313.                             }
  314.                         }
  315.                         cleanup {
  316.                             script {
  317.                                 postBuildCleanup()
  318.                             }
  319.                             endStage()
  320.                         }
  321.                     }
  322.                 }
  323.                 stage('Build 1') {
  324.                     agent {
  325.                         node {
  326.                             label 'pipeline_builder'
  327.                         }
  328.                     }
  329.                     when {
  330.                         environment name: 'SKIP_BUILD', value: 'false'
  331.                         beforeAgent true
  332.                     }
  333.                     steps {
  334.                         timeout(time: 60, unit: 'MINUTES') {
  335.                             startStage();
  336.                             script {
  337.                                 letsBuildSomething()
  338.                             }
  339.                         }
  340.                     }
  341.                     post {
  342.                         success {
  343.                             script {
  344.                                 postBuildSuccess()
  345.                             }
  346.                         }
  347.                         failure {
  348.                             script {
  349.                                 postBuildFailure()
  350.                             }
  351.                         }
  352.                         cleanup {
  353.                             script {
  354.                                 postBuildCleanup()
  355.                             }
  356.                             endStage()
  357.                         }
  358.                     }
  359.                 }
  360.                 stage('Build 1') {
  361.                     agent {
  362.                         node {
  363.                             label 'pipeline_builder'
  364.                         }
  365.                     }
  366.                     when {
  367.                         environment name: 'SKIP_BUILD', value: 'false'
  368.                         beforeAgent true
  369.                     }
  370.                     steps {
  371.                         timeout(time: 60, unit: 'MINUTES') {
  372.                             startStage();
  373.                             script {
  374.                                 letsBuildSomething()
  375.                             }
  376.                         }
  377.                     }
  378.                     post {
  379.                         success {
  380.                             script {
  381.                                 postBuildSuccess()
  382.                             }
  383.                         }
  384.                         failure {
  385.                             script {
  386.                                 postBuildFailure()
  387.                             }
  388.                         }
  389.                         cleanup {
  390.                             script {
  391.                                 postBuildCleanup()
  392.                             }
  393.                             endStage()
  394.                         }
  395.                     }
  396.                 }
  397.                 stage('Build 1') {
  398.                     agent {
  399.                         node {
  400.                             label 'pipeline_builder'
  401.                         }
  402.                     }
  403.                     when {
  404.                         environment name: 'SKIP_BUILD', value: 'false'
  405.                         beforeAgent true
  406.                     }
  407.                     steps {
  408.                         timeout(time: 60, unit: 'MINUTES') {
  409.                             startStage();
  410.                             script {
  411.                                 letsBuildSomething()
  412.                             }
  413.                         }
  414.                     }
  415.                     post {
  416.                         success {
  417.                             script {
  418.                                 postBuildSuccess()
  419.                             }
  420.                         }
  421.                         failure {
  422.                             script {
  423.                                 postBuildFailure()
  424.                             }
  425.                         }
  426.                         cleanup {
  427.                             script {
  428.                                 postBuildCleanup()
  429.                             }
  430.                             endStage()
  431.                         }
  432.                     }
  433.                 }
  434.                 stage('Build 1') {
  435.                     agent {
  436.                         node {
  437.                             label 'pipeline_builder'
  438.                         }
  439.                     }
  440.                     when {
  441.                         environment name: 'SKIP_BUILD', value: 'false'
  442.                         beforeAgent true
  443.                     }
  444.                     steps {
  445.                         timeout(time: 60, unit: 'MINUTES') {
  446.                             startStage();
  447.                             script {
  448.                                 letsBuildSomething()
  449.                             }
  450.                         }
  451.                     }
  452.                     post {
  453.                         success {
  454.                             script {
  455.                                 postBuildSuccess()
  456.                             }
  457.                         }
  458.                         failure {
  459.                             script {
  460.                                 postBuildFailure()
  461.                             }
  462.                         }
  463.                         cleanup {
  464.                             script {
  465.                                 postBuildCleanup()
  466.                             }
  467.                             endStage()
  468.                         }
  469.                     }
  470.                 }
  471.                 stage('Build 1') {
  472.                     agent {
  473.                         node {
  474.                             label 'pipeline_builder'
  475.                         }
  476.                     }
  477.                     when {
  478.                         environment name: 'SKIP_BUILD', value: 'false'
  479.                         beforeAgent true
  480.                     }
  481.                     steps {
  482.                         timeout(time: 60, unit: 'MINUTES') {
  483.                             startStage();
  484.                             script {
  485.                                 letsBuildSomething()
  486.                             }
  487.                         }
  488.                     }
  489.                     post {
  490.                         success {
  491.                             script {
  492.                                 postBuildSuccess()
  493.                             }
  494.                         }
  495.                         failure {
  496.                             script {
  497.                                 postBuildFailure()
  498.                             }
  499.                         }
  500.                         cleanup {
  501.                             script {
  502.                                 postBuildCleanup()
  503.                             }
  504.                             endStage()
  505.                         }
  506.                     }
  507.                 }
  508.                 stage('Build 1') {
  509.                     agent {
  510.                         node {
  511.                             label 'pipeline_builder'
  512.                         }
  513.                     }
  514.                     when {
  515.                         environment name: 'SKIP_BUILD', value: 'false'
  516.                         beforeAgent true
  517.                     }
  518.                     steps {
  519.                         timeout(time: 60, unit: 'MINUTES') {
  520.                             startStage();
  521.                             script {
  522.                                 letsBuildSomething()
  523.                             }
  524.                         }
  525.                     }
  526.                     post {
  527.                         success {
  528.                             script {
  529.                                 postBuildSuccess()
  530.                             }
  531.                         }
  532.                         failure {
  533.                             script {
  534.                                 postBuildFailure()
  535.                             }
  536.                         }
  537.                         cleanup {
  538.                             script {
  539.                                 postBuildCleanup()
  540.                             }
  541.                             endStage()
  542.                         }
  543.                     }
  544.                 }
  545.                 stage('Build 1') {
  546.                     agent {
  547.                         node {
  548.                             label 'pipeline_builder'
  549.                         }
  550.                     }
  551.                     when {
  552.                         environment name: 'SKIP_BUILD', value: 'false'
  553.                         beforeAgent true
  554.                     }
  555.                     steps {
  556.                         timeout(time: 60, unit: 'MINUTES') {
  557.                             startStage();
  558.                             script {
  559.                                 letsBuildSomething()
  560.                             }
  561.                         }
  562.                     }
  563.                     post {
  564.                         success {
  565.                             script {
  566.                                 postBuildSuccess()
  567.                             }
  568.                         }
  569.                         failure {
  570.                             script {
  571.                                 postBuildFailure()
  572.                             }
  573.                         }
  574.                         cleanup {
  575.                             script {
  576.                                 postBuildCleanup()
  577.                             }
  578.                             endStage()
  579.                         }
  580.                     }
  581.                 }
  582.                 stage('Build 1') {
  583.                     agent {
  584.                         node {
  585.                             label 'pipeline_builder'
  586.                         }
  587.                     }
  588.                     when {
  589.                         environment name: 'SKIP_BUILD', value: 'false'
  590.                         beforeAgent true
  591.                     }
  592.                     steps {
  593.                         timeout(time: 60, unit: 'MINUTES') {
  594.                             startStage();
  595.                             script {
  596.                                 letsBuildSomething()
  597.                             }
  598.                         }
  599.                     }
  600.                     post {
  601.                         success {
  602.                             script {
  603.                                 postBuildSuccess()
  604.                             }
  605.                         }
  606.                         failure {
  607.                             script {
  608.                                 postBuildFailure()
  609.                             }
  610.                         }
  611.                         cleanup {
  612.                             script {
  613.                                 postBuildCleanup()
  614.                             }
  615.                             endStage()
  616.                         }
  617.                     }
  618.                 }
  619.                 stage('Build 1') {
  620.                     agent {
  621.                         node {
  622.                             label 'pipeline_builder'
  623.                         }
  624.                     }
  625.                     when {
  626.                         environment name: 'SKIP_BUILD', value: 'false'
  627.                         beforeAgent true
  628.                     }
  629.                     steps {
  630.                         timeout(time: 60, unit: 'MINUTES') {
  631.                             startStage();
  632.                             script {
  633.                                 letsBuildSomething()
  634.                             }
  635.                         }
  636.                     }
  637.                     post {
  638.                         success {
  639.                             script {
  640.                                 postBuildSuccess()
  641.                             }
  642.                         }
  643.                         failure {
  644.                             script {
  645.                                 postBuildFailure()
  646.                             }
  647.                         }
  648.                         cleanup {
  649.                             script {
  650.                                 postBuildCleanup()
  651.                             }
  652.                             endStage()
  653.                         }
  654.                     }
  655.                 }
  656.                 stage('Build 1') {
  657.                     agent {
  658.                         node {
  659.                             label 'pipeline_builder'
  660.                         }
  661.                     }
  662.                     when {
  663.                         environment name: 'SKIP_BUILD', value: 'false'
  664.                         beforeAgent true
  665.                     }
  666.                     steps {
  667.                         timeout(time: 60, unit: 'MINUTES') {
  668.                             startStage();
  669.                             script {
  670.                                 letsBuildSomething()
  671.                             }
  672.                         }
  673.                     }
  674.                     post {
  675.                         success {
  676.                             script {
  677.                                 postBuildSuccess()
  678.                             }
  679.                         }
  680.                         failure {
  681.                             script {
  682.                                 postBuildFailure()
  683.                             }
  684.                         }
  685.                         cleanup {
  686.                             script {
  687.                                 postBuildCleanup()
  688.                             }
  689.                             endStage()
  690.                         }
  691.                     }
  692.                 }
  693.                 stage('Build 1') {
  694.                     agent {
  695.                         node {
  696.                             label 'pipeline_builder'
  697.                         }
  698.                     }
  699.                     when {
  700.                         environment name: 'SKIP_BUILD', value: 'false'
  701.                         beforeAgent true
  702.                     }
  703.                     steps {
  704.                         timeout(time: 60, unit: 'MINUTES') {
  705.                             startStage();
  706.                             script {
  707.                                 letsBuildSomething()
  708.                             }
  709.                         }
  710.                     }
  711.                     post {
  712.                         success {
  713.                             script {
  714.                                 postBuildSuccess()
  715.                             }
  716.                         }
  717.                         failure {
  718.                             script {
  719.                                 postBuildFailure()
  720.                             }
  721.                         }
  722.                         cleanup {
  723.                             script {
  724.                                 postBuildCleanup()
  725.                             }
  726.                             endStage()
  727.                         }
  728.                     }
  729.                 }
  730.                 stage('Build 1') {
  731.                     agent {
  732.                         node {
  733.                             label 'pipeline_builder'
  734.                         }
  735.                     }
  736.                     when {
  737.                         environment name: 'SKIP_BUILD', value: 'false'
  738.                         beforeAgent true
  739.                     }
  740.                     steps {
  741.                         timeout(time: 60, unit: 'MINUTES') {
  742.                             startStage();
  743.                             script {
  744.                                 letsBuildSomething()
  745.                             }
  746.                         }
  747.                     }
  748.                     post {
  749.                         success {
  750.                             script {
  751.                                 postBuildSuccess()
  752.                             }
  753.                         }
  754.                         failure {
  755.                             script {
  756.                                 postBuildFailure()
  757.                             }
  758.                         }
  759.                         cleanup {
  760.                             script {
  761.                                 postBuildCleanup()
  762.                             }
  763.                             endStage()
  764.                         }
  765.                     }
  766.                 }
  767.                 stage('Build 1') {
  768.                     agent {
  769.                         node {
  770.                             label 'pipeline_builder'
  771.                         }
  772.                     }
  773.                     when {
  774.                         environment name: 'SKIP_BUILD', value: 'false'
  775.                         beforeAgent true
  776.                     }
  777.                     steps {
  778.                         timeout(time: 60, unit: 'MINUTES') {
  779.                             startStage();
  780.                             script {
  781.                                 letsBuildSomething()
  782.                             }
  783.                         }
  784.                     }
  785.                     post {
  786.                         success {
  787.                             script {
  788.                                 postBuildSuccess()
  789.                             }
  790.                         }
  791.                         failure {
  792.                             script {
  793.                                 postBuildFailure()
  794.                             }
  795.                         }
  796.                         cleanup {
  797.                             script {
  798.                                 postBuildCleanup()
  799.                             }
  800.                             endStage()
  801.                         }
  802.                     }
  803.                 }
  804.                 stage('Build 1') {
  805.                     agent {
  806.                         node {
  807.                             label 'pipeline_builder'
  808.                         }
  809.                     }
  810.                     when {
  811.                         environment name: 'SKIP_BUILD', value: 'false'
  812.                         beforeAgent true
  813.                     }
  814.                     steps {
  815.                         timeout(time: 60, unit: 'MINUTES') {
  816.                             startStage();
  817.                             script {
  818.                                 letsBuildSomething()
  819.                             }
  820.                         }
  821.                     }
  822.                     post {
  823.                         success {
  824.                             script {
  825.                                 postBuildSuccess()
  826.                             }
  827.                         }
  828.                         failure {
  829.                             script {
  830.                                 postBuildFailure()
  831.                             }
  832.                         }
  833.                         cleanup {
  834.                             script {
  835.                                 postBuildCleanup()
  836.                             }
  837.                             endStage()
  838.                         }
  839.                     }
  840.                 }
  841.                 stage('Build 1') {
  842.                     agent {
  843.                         node {
  844.                             label 'pipeline_builder'
  845.                         }
  846.                     }
  847.                     when {
  848.                         environment name: 'SKIP_BUILD', value: 'false'
  849.                         beforeAgent true
  850.                     }
  851.                     steps {
  852.                         timeout(time: 60, unit: 'MINUTES') {
  853.                             startStage();
  854.                             script {
  855.                                 letsBuildSomething()
  856.                             }
  857.                         }
  858.                     }
  859.                     post {
  860.                         success {
  861.                             script {
  862.                                 postBuildSuccess()
  863.                             }
  864.                         }
  865.                         failure {
  866.                             script {
  867.                                 postBuildFailure()
  868.                             }
  869.                         }
  870.                         cleanup {
  871.                             script {
  872.                                 postBuildCleanup()
  873.                             }
  874.                             endStage()
  875.                         }
  876.                     }
  877.                 }
  878.                 stage('Build 1') {
  879.                     agent {
  880.                         node {
  881.                             label 'pipeline_builder'
  882.                         }
  883.                     }
  884.                     when {
  885.                         environment name: 'SKIP_BUILD', value: 'false'
  886.                         beforeAgent true
  887.                     }
  888.                     steps {
  889.                         timeout(time: 60, unit: 'MINUTES') {
  890.                             startStage();
  891.                             script {
  892.                                 letsBuildSomething()
  893.                             }
  894.                         }
  895.                     }
  896.                     post {
  897.                         success {
  898.                             script {
  899.                                 postBuildSuccess()
  900.                             }
  901.                         }
  902.                         failure {
  903.                             script {
  904.                                 postBuildFailure()
  905.                             }
  906.                         }
  907.                         cleanup {
  908.                             script {
  909.                                 postBuildCleanup()
  910.                             }
  911.                             endStage()
  912.                         }
  913.                     }
  914.                 }
  915.                 stage('Build 1') {
  916.                     agent {
  917.                         node {
  918.                             label 'pipeline_builder'
  919.                         }
  920.                     }
  921.                     when {
  922.                         environment name: 'SKIP_BUILD', value: 'false'
  923.                         beforeAgent true
  924.                     }
  925.                     steps {
  926.                         timeout(time: 60, unit: 'MINUTES') {
  927.                             startStage();
  928.                             script {
  929.                                 letsBuildSomething()
  930.                             }
  931.                         }
  932.                     }
  933.                     post {
  934.                         success {
  935.                             script {
  936.                                 postBuildSuccess()
  937.                             }
  938.                         }
  939.                         failure {
  940.                             script {
  941.                                 postBuildFailure()
  942.                             }
  943.                         }
  944.                         cleanup {
  945.                             script {
  946.                                 postBuildCleanup()
  947.                             }
  948.                             endStage()
  949.                         }
  950.                     }
  951.                 }
  952.                 stage('Build 1') {
  953.                     agent {
  954.                         node {
  955.                             label 'pipeline_builder'
  956.                         }
  957.                     }
  958.                     when {
  959.                         environment name: 'SKIP_BUILD', value: 'false'
  960.                         beforeAgent true
  961.                     }
  962.                     steps {
  963.                         timeout(time: 60, unit: 'MINUTES') {
  964.                             startStage();
  965.                             script {
  966.                                 letsBuildSomething()
  967.                             }
  968.                         }
  969.                     }
  970.                     post {
  971.                         success {
  972.                             script {
  973.                                 postBuildSuccess()
  974.                             }
  975.                         }
  976.                         failure {
  977.                             script {
  978.                                 postBuildFailure()
  979.                             }
  980.                         }
  981.                         cleanup {
  982.                             script {
  983.                                 postBuildCleanup()
  984.                             }
  985.                             endStage()
  986.                         }
  987.                     }
  988.                 }
  989.                 stage('Build 1') {
  990.                     agent {
  991.                         node {
  992.                             label 'pipeline_builder'
  993.                         }
  994.                     }
  995.                     when {
  996.                         environment name: 'SKIP_BUILD', value: 'false'
  997.                         beforeAgent true
  998.                     }
  999.                     steps {
  1000.                         timeout(time: 60, unit: 'MINUTES') {
  1001.                             startStage();
  1002.                             script {
  1003.                                 letsBuildSomething()
  1004.                             }
  1005.                         }
  1006.                     }
  1007.                     post {
  1008.                         success {
  1009.                             script {
  1010.                                 postBuildSuccess()
  1011.                             }
  1012.                         }
  1013.                         failure {
  1014.                             script {
  1015.                                 postBuildFailure()
  1016.                             }
  1017.                         }
  1018.                         cleanup {
  1019.                             script {
  1020.                                 postBuildCleanup()
  1021.                             }
  1022.                             endStage()
  1023.                         }
  1024.                     }
  1025.                 }
  1026.                 stage('Build 1') {
  1027.                     agent {
  1028.                         node {
  1029.                             label 'pipeline_builder'
  1030.                         }
  1031.                     }
  1032.                     when {
  1033.                         environment name: 'SKIP_BUILD', value: 'false'
  1034.                         beforeAgent true
  1035.                     }
  1036.                     steps {
  1037.                         timeout(time: 60, unit: 'MINUTES') {
  1038.                             startStage();
  1039.                             script {
  1040.                                 letsBuildSomething()
  1041.                             }
  1042.                         }
  1043.                     }
  1044.                     post {
  1045.                         success {
  1046.                             script {
  1047.                                 postBuildSuccess()
  1048.                             }
  1049.                         }
  1050.                         failure {
  1051.                             script {
  1052.                                 postBuildFailure()
  1053.                             }
  1054.                         }
  1055.                         cleanup {
  1056.                             script {
  1057.                                 postBuildCleanup()
  1058.                             }
  1059.                             endStage()
  1060.                         }
  1061.                     }
  1062.                 }
  1063.                 stage('Build 1') {
  1064.                     agent {
  1065.                         node {
  1066.                             label 'pipeline_builder'
  1067.                         }
  1068.                     }
  1069.                     when {
  1070.                         environment name: 'SKIP_BUILD', value: 'false'
  1071.                         beforeAgent true
  1072.                     }
  1073.                     steps {
  1074.                         timeout(time: 60, unit: 'MINUTES') {
  1075.                             startStage();
  1076.                             script {
  1077.                                 letsBuildSomething()
  1078.                             }
  1079.                         }
  1080.                     }
  1081.                     post {
  1082.                         success {
  1083.                             script {
  1084.                                 postBuildSuccess()
  1085.                             }
  1086.                         }
  1087.                         failure {
  1088.                             script {
  1089.                                 postBuildFailure()
  1090.                             }
  1091.                         }
  1092.                         cleanup {
  1093.                             script {
  1094.                                 postBuildCleanup()
  1095.                             }
  1096.                             endStage()
  1097.                         }
  1098.                     }
  1099.                 }
  1100.                 stage('Build 1') {
  1101.                     agent {
  1102.                         node {
  1103.                             label 'pipeline_builder'
  1104.                         }
  1105.                     }
  1106.                     when {
  1107.                         environment name: 'SKIP_BUILD', value: 'false'
  1108.                         beforeAgent true
  1109.                     }
  1110.                     steps {
  1111.                         timeout(time: 60, unit: 'MINUTES') {
  1112.                             startStage();
  1113.                             script {
  1114.                                 letsBuildSomething()
  1115.                             }
  1116.                         }
  1117.                     }
  1118.                     post {
  1119.                         success {
  1120.                             script {
  1121.                                 postBuildSuccess()
  1122.                             }
  1123.                         }
  1124.                         failure {
  1125.                             script {
  1126.                                 postBuildFailure()
  1127.                             }
  1128.                         }
  1129.                         cleanup {
  1130.                             script {
  1131.                                 postBuildCleanup()
  1132.                             }
  1133.                             endStage()
  1134.                         }
  1135.                     }
  1136.                 }
  1137.                 stage('Build 1') {
  1138.                     agent {
  1139.                         node {
  1140.                             label 'pipeline_builder'
  1141.                         }
  1142.                     }
  1143.                     when {
  1144.                         environment name: 'SKIP_BUILD', value: 'false'
  1145.                         beforeAgent true
  1146.                     }
  1147.                     steps {
  1148.                         timeout(time: 60, unit: 'MINUTES') {
  1149.                             startStage();
  1150.                             script {
  1151.                                 letsBuildSomething()
  1152.                             }
  1153.                         }
  1154.                     }
  1155.                     post {
  1156.                         success {
  1157.                             script {
  1158.                                 postBuildSuccess()
  1159.                             }
  1160.                         }
  1161.                         failure {
  1162.                             script {
  1163.                                 postBuildFailure()
  1164.                             }
  1165.                         }
  1166.                         cleanup {
  1167.                             script {
  1168.                                 postBuildCleanup()
  1169.                             }
  1170.                             endStage()
  1171.                         }
  1172.                     }
  1173.                 }
  1174.                 stage('Build 1') {
  1175.                     agent {
  1176.                         node {
  1177.                             label 'pipeline_builder'
  1178.                         }
  1179.                     }
  1180.                     when {
  1181.                         environment name: 'SKIP_BUILD', value: 'false'
  1182.                         beforeAgent true
  1183.                     }
  1184.                     steps {
  1185.                         timeout(time: 60, unit: 'MINUTES') {
  1186.                             startStage();
  1187.                             script {
  1188.                                 letsBuildSomething()
  1189.                             }
  1190.                         }
  1191.                     }
  1192.                     post {
  1193.                         success {
  1194.                             script {
  1195.                                 postBuildSuccess()
  1196.                             }
  1197.                         }
  1198.                         failure {
  1199.                             script {
  1200.                                 postBuildFailure()
  1201.                             }
  1202.                         }
  1203.                         cleanup {
  1204.                             script {
  1205.                                 postBuildCleanup()
  1206.                             }
  1207.                             endStage()
  1208.                         }
  1209.                     }
  1210.                 }
  1211.                 stage('Build 1') {
  1212.                     agent {
  1213.                         node {
  1214.                             label 'pipeline_builder'
  1215.                         }
  1216.                     }
  1217.                     when {
  1218.                         environment name: 'SKIP_BUILD', value: 'false'
  1219.                         beforeAgent true
  1220.                     }
  1221.                     steps {
  1222.                         timeout(time: 60, unit: 'MINUTES') {
  1223.                             startStage();
  1224.                             script {
  1225.                                 letsBuildSomething()
  1226.                             }
  1227.                         }
  1228.                     }
  1229.                     post {
  1230.                         success {
  1231.                             script {
  1232.                                 postBuildSuccess()
  1233.                             }
  1234.                         }
  1235.                         failure {
  1236.                             script {
  1237.                                 postBuildFailure()
  1238.                             }
  1239.                         }
  1240.                         cleanup {
  1241.                             script {
  1242.                                 postBuildCleanup()
  1243.                             }
  1244.                             endStage()
  1245.                         }
  1246.                     }
  1247.                 }
  1248.             }
  1249.         }
  1250.     }
  1251.  
  1252.     post {
  1253.         always {
  1254.             postBuild()
  1255.         }
  1256.     }
  1257.  
  1258.  
  1259.     options {
  1260.         // Make sure that there is an upper limit to the execution time of the job.
  1261.         // This is important to make sure that the pipeline won't get stuck.
  1262.         timeout(time: 6, unit: 'HOURS')
  1263.  
  1264.         // We perform the checkouts where required on each step.
  1265.         // Because of that there is no need for the pipeline default checkout
  1266.         skipDefaultCheckout true
  1267.  
  1268.         // Set some limits on the artifacts that we to make sure that the machine
  1269.         buildDiscarder(logRotator(numToKeepStr: env.CHANGE_ID ? '5' : '20', artifactNumToKeepStr: env.CHANGE_ID ? '5' : '20'))
  1270.  
  1271.         // Enable ansi coloring in the blue ocean console (red for errors etc)
  1272.         ansiColor('gnome-terminal')
  1273.  
  1274.         // Add timestamps to each line in the console output
  1275.         timestamps()
  1276.  
  1277.         //parallels always failFast
  1278.         parallelsAlwaysFailFast()
  1279.     }
  1280.  
  1281.     parameters {
  1282.         booleanParam(name: 'SKIP_BUILD', defaultValue: false, description: '')
  1283.     }
  1284. }
  1285.  
  1286.  
  1287. def startStage(){
  1288.     if (env.STAGE_NAME == null) { return }
  1289.     if (!times.containsKey(env.STAGE_NAME)) {
  1290.         times[env.STAGE_NAME] = [:]
  1291.     }
  1292.     times[env.STAGE_NAME].start =  new Date()
  1293. }
  1294.  
  1295.  
  1296. def endStage(){
  1297.     if (env.STAGE_NAME == null) { return }
  1298.     if (!times.containsKey(env.STAGE_NAME)) {
  1299.         times[env.STAGE_NAME] = [:]
  1300.     }
  1301.    
  1302.     times[env.STAGE_NAME].end =  new Date()
  1303.     println "Stage ${env.STAGE_NAME} lasted ${timeDiff(times[env.STAGE_NAME].start, times[env.STAGE_NAME].end)}"
  1304. }
  1305.  
  1306.  
  1307. @NonCPS
  1308. def timeDiff(Date startDate, Date endDate) {
  1309.     TimeDuration td = TimeCategory.minus(endDate, startDate)
  1310.     return td
  1311. }
  1312.  
  1313.  
  1314. def letsBuildSomething() {
  1315. }
  1316.  
  1317. def postBuildSuccess() {
  1318. }
  1319.  
  1320. def postBuildFailure() {
  1321. }
  1322.  
  1323. def postBuildCleanup() {
  1324. }
  1325.  
  1326. def postBuild(){
  1327. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement