1090. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 10/12/2018 4:05:12 PM Eastern Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.

1090.1 Files compared

# Location File Last Modified
1 Vetlink 2.0.zip\Vetlink 2.0\vetlink-web.zip\vetlink-web Jenkinsfile Fri Aug 24 18:42:02 2018 UTC
2 Vetlink 2.0.zip\Vetlink 2.0\vetlink-web.zip\vetlink-web Jenkinsfile Fri Oct 12 13:48:49 2018 UTC

1090.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 2 836
Changed 1 2
Inserted 0 0
Removed 0 0

1090.3 Comparison options

Whitespace
Character case Differences in character case are significant
Line endings Differences in line endings (CR and LF characters) are ignored
CR/LF characters Not shown in the comparison detail

1090.4 Active regular expressions

No regular expressions were active.

1090.5 Comparison detail

  1   properties ([
  2     paramete rs([
  3       boolea nParam(nam e: 'CLEAN' , defaultV alue: true , descript ion: 'clea ns workspa ce on star t up'),
  4       choice (name: 'FA IL_WAIT',  choices: " 0\n1\n5\n1 0\n15\n20" , descript ion: 'On f ailure, am ount of ti me to wait  before fa iling and  terminatin g the job.  This allo ws for tro ubleshooti ng in the  job enviro nment.')
  5      ])
  6   ])
  7  
  8   /********* ********** ********** *******
  9    * Applica tion-speci fic values
  10    ********* ********** ********** *******/
  11   def appChe ckoutDir =  "vetlink- web"
  12   def enviro nmentFileL ist = []
  13  
  14  
  15   def APIGAT EWAY_ADDR  = 'localho st:8089'
  16   def STASH_ URL = env. STASH_URL  ?: "https: // DNS . URL "
  17   def buildU serID
  18  
  19   node('buil d-docker-l arge'){
  20           de f repos =  [:]
  21           de f executio nError
  22  
  23           /* *********
  24            *  These wil l be used  throughout  the build  process a s the appl ication wo rkspace an d the stac k workspac e.
  25            *   Both wil l be set t o the dire ctory into  which the ir respect ive source  code is p ulled/chec ked out
  26            * *********/
  27           de f app_work space = ap pCheckoutD ir
  28  
  29           bu ildUserID  = sh (
  30                    scri pt: "id -u ",
  31                    retu rnStdout:  true
  32           ). trim()
  33  
  34           st age('initi alization' ) {
  35                    sh " docker sto p \$(docke r ps -a -q ) || true  ; docker r m \$(docke r ps -a -q ) || true"
  36                    noti fySlack()
  37           }
  38  
  39           st age('clean  workspace ') {
  40                    if ( params.CLE AN) {
  41                    clea nWs notFai lBuild: tr ue
  42                    }
  43           }
  44  
  45           st age('check out'){
  46                    //Ca n't obtain  this dire ctory name  from next genConfig. yml becaus e that fil e isn't ye t checked  out
  47                    dir( appCheckou tDir){
  48                             checko ut scm
  49                             repos  = readYaml  file: 'ne xtgenConfi g.yml'
  50                    }
  51                    /*** *******
  52                     * I ntent is t o use exis ting artif acts in Je nkins to s peed the b uild proce ss; howeve r,
  53                     *   acceptance  tests exi st within  the indivi dual repos . Perform  shallow ch eckouts of  all 
  54                     *   source rep os
  55                     *** *******/
  56                    para llel repos .collectEn tries { ke y, value - >
  57                             value. collectEnt ries { sub key, subva lue ->
  58                                      ["$subke y-checkout " : source Checkout(s ubvalue)]
  59                             }
  60                    }
  61  
  62                    app_ workspace  = pwd() +  "/" + repo s["core"][ "applicati on"]["chec koutDir"]
  63           }
  64           st age('regis try login' ){
  65                    with Credential s([[$class : 'Usernam ePasswordM ultiBindin g', creden tialsId: ' innovation s_gitlab',  passwordV ariable: ' DTR_PASS',  usernameV ariable: ' DTR_USER'] ]){
  66                                      sh "dock er login h ttps://mob ileapps.va ftl.us:925 0 -u \"${e nv.DTR_USE R}\" -p \" ${env.DTR_ PASS}\""
  67                    }
  68                    sh " aws ecr ge t-login -- region us- east-1 --n o-include- email | ba sh"
  69           }
  70           st age('prep' ){
  71                    para llel 'perm issions':{
  72                             def ch mods = ""
  73                             repos. each { key , value ->
  74                                      value.ea ch { subke y, subvalu e ->
  75                                               def dirPer m = dirPer missions(s ubvalue)
  76                                               chmods +=  dirPerm ?  dirPerm +  " && " : " "
  77                                      }
  78                             }
  79                             chmods  = chmods. endsWith(" && ") ? ch mods[0..-4 ] : chmods
  80                             sh chm ods
  81                    }
  82  
  83           }
  84  
  85           tr y {
  86                    /* E nvironment  settings  that will  be used th roughout t he build/r un/test pr ocess */
  87                    with Env(["NEXT GEN_APP_HO ME=${app_w orkspace}" , "COMPOSE _HTTP_TIME OUT=480"])  {
  88  
  89                             /* Wor karound -  performing  actions t hat use do cker-compo se before  running ru n-all.sh * /
  90                             stage( 'create do cker netwo rk'){
  91                                      sh "dock er network  inspect a pigateway- network ||  docker ne twork crea te apigate way-networ k"
  92                             }
  93  
  94                             /* The  builder w ill be use d in subse quent step s, and thu s should b e pulled " up front"  */
  95                             stage( 'pull buil der'){
  96                                      dir(app_ workspace) {
  97                                               sh "./grad lew pullBu ildImages"
  98                                      }
  99                             }
  100  
  101                             stage( 'pull and  build depe ndencies') {
  102                                      def buil dSteps = r epos["serv ices"].col lectEntrie s { subkey , subvalue  ->
  103                                               ["$subkey- build" : a pplication Build(subk ey, subval ue, buildU serID, rep os["core"] ["applicat ion"]["che ckoutDir"] )]
  104                                      }
  105  
  106                                      /* Don't  perform m ore than m axParallel  build act ions simul taneously:
  107                                       * Trans form: [k1: v1,k2:v2,k 3:v3,k4:v4 ,k5:v5]
  108                                       * Into:  [[k1:v1,k 2:v2,k3:v3 ],[k4:v4,k 5:v5]]
  109                                       */
  110                                      def maxP arallel =  3
  111                                      def buil dSubSteps  = []
  112                                      /* Initi alize buil dSubSteps  as a colle ction of m aps */
  113                                      (buildSt eps.size() /maxParall el).setSca le(0, BigD ecimal.ROU ND_CEILING ).times {  buildSubSt eps[it] =  [:] }
  114                                      /* Itera te over th e map, put ting the v alues into  the build Substeps[f loor(idx/m axParallel )] */
  115                                      buildSte ps.eachWit hIndex { k ey, val, i dx ->
  116                                               buildSubSt eps[((idx  / maxParal lel).setSc ale(0, Big Decimal.RO UND_FLOOR) ).intValue ()][key] =  val
  117                                      }
  118                                      parallel  'nextgen  image pull ':{
  119                                               dir(app_wo rkspace){
  120                                                       sh  "./gradle w pullStac k"
  121                                               }
  122                                      }, 'dev  image pull ':{
  123                                               dir(app_wo rkspace){
  124                                                       sh  "./gradle w pullDev"
  125                                               }
  126                                      }, 'buil d dependen cies':{
  127                                               buildSubSt eps.each {  subSteps  ->
  128                                                       pa rallel sub Steps
  129                                               }
  130                                      }
  131                             }
  132  
  133                             stage( 'build app lication') {
  134                                      script a pplication Build("app lication",  repos["co re"]["appl ication"],  buildUser ID, repos[ "core"]["a pplication "]["checko utDir"])
  135                             }
  136  
  137                             stage( 'build dev  images'){
  138                                      def imag eBuildStep s = repos[ "services" ].collectE ntries { s ubkey, sub value ->
  139                                               ["$subkey- image-buil d" : appli cationImag eBuild(sub key, subva lue, build UserID, re pos["core" ]["applica tion"]["ch eckoutDir" ])]
  140                                      }
  141                                      imageBui ldSteps +=  ["applica tion-image -build" :  applicatio nBuild("ap plication" , repos["c ore"]["app lication"] , buildUse rID, repos ["core"][" applicatio n"]["check outDir"])]
  142  
  143                                      def maxP arallel =  3
  144                                      def imag eBuildSubS teps = []
  145                                      /* Initi alize buil dSubSteps  as a colle ction of m aps */
  146                                      (imageBu ildSteps.s ize()/maxP arallel).s etScale(0,  BigDecima l.ROUND_CE ILING).tim es { image BuildSubSt eps[it] =  [:] }
  147                                      /* Itera te over th e map, put ting the v alues into  the image BuildSubSt eps[floor( idx/maxPar allel)] */
  148                                      imageBui ldSteps.ea chWithInde x { key, v al, idx ->
  149                                               imageBuild SubSteps[( (idx / max Parallel). setScale(0 , BigDecim al.ROUND_F LOOR)).int Value()][k ey] = val
  150                                      }
  151                                      imageBui ldSubSteps .each { su bSteps ->
  152                                               parallel s ubSteps
  153                                      }
  154                             }
  155  
  156                             stage( 'start nex tgen-stack '){
  157                                      sh "dock er network  prune -f"
  158                                      dir (app _workspace ) {
  159                                               sh "./grad lew runSta ck"
  160                                      }
  161                             }
  162  
  163                             stage( 'start app lication')  {
  164                                      dir (app _workspace ) {
  165                                               sh "./grad lew runDev "
  166                                      }
  167                             }
  168  
  169                             stage( 'verify st ack up') {
  170                                      sh "dock er ps -a - -format 't able {{.Im age}}\t{{. Names}}\t{ {.Status}} ' ; docker  images -- format 'ta ble {{.Rep ository}}\ t{{.Tag}}\ t{{.Digest }}'"
  171  
  172                                      def firs tRun = tru e
  173  
  174                                      retry(10 ) {
  175                                               if(!firstR un) {
  176                                                       sl eep time:  1, unit: ' MINUTES'
  177                                                       di r(repos["c ore"]["sta ck"]["chec koutDir"]) {
  178                                                                sh " docker-com pose resta rt registr ator"
  179                                                       }
  180                                               }
  181                                               firstRun =  false
  182  
  183                                               verifyUrl( "http://${ APIGATEWAY _ADDR}/use rs/v1/sess ion", 200)
  184                                               verifyUrl( "http://${ APIGATEWAY _ADDR}/eul a/v1/agree ment", 200 )
  185                                               verifyUrl( "http://${ APIGATEWAY _ADDR}/way f/v1/", 20 0)
  186                                               verifyUrl( "http://${ APIGATEWAY _ADDR}/eul a-web/", 4 03)
  187                                      }
  188                             }
  189                             stage( 'test'){
  190                                      sh "dock er images  --format ' table {{.R epository} }\t{{.Tag} }\t{{.Dige st}}'"
  191                                      /* Bring  up the se lenium_hub  and selen ium_node * /
  192                                      sh "dock er-compose  -f $app_w orkspace/n extgen/doc ker-compos e.build.ym l -f $app_ workspace/ nextgen/do cker-compo se.test.ym l up -d"
  193                                      script c omponentTe st("applic ation", re pos["core" ]["applica tion"], bu ildUserID,  "${app_wo rkspace}/n extgen")
  194                             }
  195                    }
  196           }
  197           ca tch(err) {
  198                    curr entBuild.r esult = 'F AILURE'
  199                    echo  "EXECUTIO N ERROR: $ {err}"
  200                    exec utionError  = err
  201                    slee p time: pa rams.FAIL_ WAIT.toInt eger(), un it: 'MINUT ES'
  202  
  203           }
  204           fi nally{
  205                    stag e('stop')  {
  206                             sh "do cker ps -a "
  207                             sh "mk dir -p log s && for c ontainer i n \$(docke r ps -a -q ) ; do doc ker logs \ $container  &> logs/\ $(docker p s -af \"ID =\$contain er\" --for mat \"{{.N ames}}\"). log ; done "
  208                             sh "do cker stop  \$(docker  ps -a -q)  && docker  rm \$(dock er ps -a - q)" // Sto p all cont ainers
  209                    }
  210                    stag e('archive '){
  211                             archiv eArtifacts  'logs/*.l og,**/scre enshots/*. png'
  212                             junit  allowEmpty Results: t rue, testR esults: '* */*_test.x ml'
  213                    }
  214                    if ( executionE rror) {
  215                             error  "${executi onError}"
  216                    }
  217           }
  218   }
  219  
  220   /********* ********** ********** ********** ********** ********** ********** ********** ********** ***
  221    *                                           SUPPORT M ETHODS
  222    *
  223    * The fol lowing met hods are u sed by the  pipeline  to perform  repetitiv e operatio ns or
  224    *  return  closures  (anonymous  code bloc ks) that r epresent c ommon buil d steps po pulated
  225    *  with v alues from  the nextg enConfig y aml
  226    ********* ********** ********** ********** ********** ********** ********** ********** ********** ***/
  227  
  228   /********* *
  229    * Name: s ourceCheck out
  230    * Descrip tion: Retu rns a clos ure repres enting a J enkinsfile  checkout  step for a  git repos itory;
  231    *                                  allows  variable s etting of:
  232    *                                          - git bran ch (`branc h`)
  233    *                                          - submodul es (`hasSu bmodules`  - If `true `, disable Submodules  will be s et to `fal se`)
  234    *                                          - reposito ry project /repo (`re po`)
  235    * Paramet ers: repo:  A <Map> r epresentin g a reposi tory const ruct
  236    * Return:  A closure  represent ing a Jenk insfile ch eckout ste p (or a de scriptive  no-op)
  237    ********* */
  238   def source Checkout(r epo){
  239           /*  If there  is a repo  for the en try, perfo rm checkou t */
  240           if  (repo.rep o){
  241                    retu rn {
  242                             checko ut(
  243                                      changelo g: false,
  244                                      poll: fa lse,
  245                                      scm: [
  246                                               $class: 'G itSCM',
  247                                               branches:  [
  248                                                       [  name: "*/$ {repo.bran ch}" ]
  249                                               ],
  250                                               doGenerate SubmoduleC onfigurati ons: false ,
  251                                               extensions : [
  252                                                       [  $class: 'S ubmoduleOp tion', dis ableSubmod ules: !rep o.hasSubmo dules, par entCredent ials: true , recursiv eSubmodule s: false,  reference:  '', track ingSubmodu les: false  ],
  253                                                       [  $class: 'C heckoutOpt ion', time out: 20 ],
  254                                                       [  $class: 'C loneOption ', noTags:  false, re ference: ' ', shallow : true ],
  255                                                       [  $class: 'R elativeTar getDirecto ry', relat iveTargetD ir: repo.c heckoutDir  ]
  256                                               ], submodu leCfg: [],
  257                                               userRemote Configs: [
  258                                                       [  credential sId: 'STAS H_USER', u rl: "${STA SH_URL}/sc m/${repo.r epo}.git"  ]
  259                                               ]
  260                                      ]
  261                             )
  262                }
  263           }
  264           /*  Otherwise , return a  no-op */
  265           el se{
  266                    retu rn {
  267                             echo " No repo sp ecified"
  268                    }
  269           }
  270   }
  271  
  272   /********* *
  273    * Name: d irPermissi ons
  274    * Descrip tion: Gene rate strin gs represe nting shel l chmod co mmands
  275    * Paramet ers: repo:  A <Map> r epresentin g a reposi tory const ruct
  276    * Output:  A string  representi ng a shell  chmod com mand
  277    ********* */
  278   def dirPer missions(r epo){
  279           re turn repo. dirPermiss ion ? "sud o chmod -R  ${repo.di rPermissio n} ${repo. checkoutDi r}" : ""
  280   }
  281  
  282   /********* *
  283    * Name: v erifyUrl
  284    * Descrip tion: Uses  `curl` to  verify if  a URL res ponse code  is as exp ected
  285    * Paramet ers:  url:  A <String > URL to t est
  286    *                                 expected Response:  A <String>  or <Integ er> HTTP r esponse co de
  287    * Output:  None (exe cutes a Je nkinsfile  build step  that may  succeed or  fail)
  288    ********* */
  289   def verify Url(url, e xpectedRes ponse) {
  290           sh  "test \$( curl -sL - w '%{http_ code}' -o  /dev/null  '${url}')  = '${expec tedRespons e}'"
  291   }
  292  
  293   /********* *
  294    * Name: c omponentTe st
  295    * Descrip tion: Retu rns a clos ure repres enting the  acceptanc e test ste p(s) for a  component  (applicat ion, apple t, etc);
  296    *                                  this ma y be no-op ; one-off  test (like  a curl),  or an rspe c acceptan ce test
  297    * Paramet ers:  name : A <Strin g> name of  the compo nent
  298    *                                 repo: A  <Map> repr esenting a  repositor y construc t
  299    *                                 buildUse rID (optio nal): A <S tring> use r ID
  300    *                                 builderD ir (option al): The d irectory i n which th e build/te st compose  files are  located
  301    *                                          * NOTE: It  is assume d that doc ker-compos e.build.ym l AND dock er-compose .test.yml  will exist
  302    *                                                           in t his or the  workspace  root dire ctory
  303    * Output:  A closure  represent ing Jenkin sfile test  step(s)
  304    ********* */
  305   def compon entTest(na me, repo,  buildUserI D, builder Dir){
  306           /*  Default n o-op build  action */
  307           de f testClos ure = { ec ho "No tes ts to run  for ${name }" }
  308           /*  If there  is an arti fact speci fied, buil d step sho uld copy a nd explode  that arti fact */
  309           if (repo.test Script) {
  310                    test Closure =  {
  311                             if(!bu ildUserID) {
  312                                      buildUse rID = sh (
  313                                               script: "i d -u",
  314                                               returnStdo ut: true
  315                                      ).trim()
  316                             }
  317                             dir(bu ilderDir ? : "."){
  318                                      sh "dock er-compose  -f docker -compose.b uild.yml - f docker-c ompose.tes t.yml run  --name ${n ame}-test  --rm -u $b uildUserID  builder / bin/bash - c \"cd ${r epo.checko utDir ?: " ."}/${repo .buildDir  ?: "."}  & & bundle i nstall &&  gem list & & cd ${rep o.testDir  ?: "."} &&  \\\$GEM_H OME/bin/rs pec --form at RspecJu nitFormatt er --out $ {name}_tes t.xml ${re po.testScr ipt}\""
  319                             }
  320                    }
  321           }
  322           re turn testC losure
  323   }
  324  
  325  
  326   /********* *
  327    * Name: a pplication Build
  328    * Descrip tion: Retu rns a clos ure repres enting the  build ste p(s) for a n applicat ion;
  329    *                                  will be  skipped i f the yaml  entry set s skipCIBu ild=true
  330    * Paramet ers:  name : A <Strin g> name of  the conta iner
  331    *                                 repo: A  <Map> repr esenting a  repositor y construc t
  332    *                                 buildUse rID (optio nal): A <S tring> use r ID
  333    *                                 baseDir:  The direc tory in wh ich to ini tiate the  build, if  not repo.c heckoutDir
  334    * Output:  A closure  represent ing Jenkin sfile buil d step(s)
  335    ********* */
  336   def applic ationBuild (name, rep o, buildUs erID, base Dir=null){
  337           de f closure  = { echo " Skipping b uild" }
  338           if (repo.skip CIBuild){
  339                    clos ure = { ec ho "Skippi ng build p er `skipCI Build` fla g" }
  340           }
  341           el se if(!rep o.buildCom mand){
  342                    clos ure = { ec ho "Skippi ng build;  no buildCo mmand defi ned"}
  343           }
  344           el se {
  345                    clos ure = {
  346                             if(!bu ildUserID) {
  347                                      buildUse rID = sh (
  348                                               script: "i d -u",
  349                                               returnStdo ut: true
  350                                      ).trim()
  351                             }
  352                             buildD ir = baseD ir ?: repo .checkoutD ir ?: "."
  353                             dir(bu ildDir){
  354                                      sh "COMP OSE_HTTP_T IMEOUT=300  docker-co mpose -f n extgen/doc ker-compos e.build.ym l run --na me ${name} -build --r m -u ${bui ldUserID}  builder /b in/bash -c  \"cd ${bu ildDir} &&  ./gradlew  --no-daem on --proje ct-cache-d ir=/tmp/pr oject_cach e ${name}B uild -Pski pCheckout= true --sta cktrace\""
  355                             }
  356                    }
  357           }
  358           re turn closu re
  359   }
  360  
  361   /********* *
  362    * Name: a pplication ImageBuild
  363    * Descrip tion: Retu rns a clos ure repres enting the  docker im age build  step(s) fo r an appli cation;
  364    *                                  will be  skipped i f the yaml  entry set s skipCIBu ild=true
  365    * Paramet ers:  name : A <Strin g> name of  the conta iner
  366    *                                 repo: A  <Map> repr esenting a  repositor y construc t
  367    *                                 buildUse rID (optio nal): A <S tring> use r ID
  368    *                                 baseDir:  The direc tory in wh ich to ini tiate the  build, if  not repo.c heckoutDir
  369    * Output:  A closure  represent ing Jenkin sfile buil d step(s)
  370    ********* */
  371   def applic ationImage Build(name , repo, bu ildUserID,  baseDir=n ull){
  372           de f closure  = { echo " Skipping b uild" }
  373           if (repo.skip CIBuild){
  374                    clos ure = { ec ho "Skippi ng image b uild per ` skipCIBuil d` flag" }
  375           }
  376           el se if(!rep o.buildCom mand){
  377                    clos ure = { ec ho "Skippi ng image b uild; no b uildComman d defined" }
  378           }
  379           el se {
  380                    clos ure ={
  381                             if(!bu ildUserID) {
  382                                      buildUse rID = sh (
  383                                               script: "i d -u",
  384                                               returnStdo ut: true
  385                                      ).trim()
  386                             }
  387                             buildD ir = baseD ir ?: repo .checkoutD ir ?: "."
  388                             dir(bu ildDir){
  389                                      sh "./gr adlew ${na me}ImageBu ild --stac ktrace\""
  390                             }
  391                    }
  392           }
  393           re turn closu re
  394   }
  395  
  396  
  397   def notify Slack(Stri ng buildSt atus = 'ST ARTED') {
  398       // Bui ld status  of null me ans succes s.
  399       buildS tatus = bu ildStatus  ?: 'SUCCES S'
  400  
  401       def co lor
  402  
  403       if (bu ildStatus  == 'STARTE D') {
  404           co lor = '#D4 DADF'
  405       } else  if (build Status ==  'SUCCESS')  {
  406           co lor = '#BD FFC3'
  407       } else  if (build Status ==  'UNSTABLE' ) {
  408           co lor = '#FF FE89'
  409       } else  {
  410           co lor = '#FF 9FA1'
  411       }
  412  
  413       def ms g = "${bui ldStatus}:  `${env.JO B_NAME}` # ${env.BUIL D_NUMBER}: \n${env.BU ILD_URL}"
  414  
  415       slackS end(color:  color, me ssage: msg )
  416   }
  417  
  418  
  419