1977. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 4/18/2019 5:56:04 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.

1977.1 Files compared

# Location File Last Modified
1 MCCF_EDI_TAS_TASCore v2.0_Build_10.zip\MCCF_EDI_TAS_Vistalink Jenkinsfile Wed Apr 3 02:27:40 2019 UTC
2 MCCF_EDI_TAS_TASCore v2.0_Build_10.zip\MCCF_EDI_TAS_Vistalink Jenkinsfile Wed Apr 17 15:59:02 2019 UTC

1977.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 3 1656
Changed 2 4
Inserted 0 0
Removed 0 0

1977.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

1977.4 Active regular expressions

No regular expressions were active.

1977.5 Comparison detail

  1   pipeline()  {
  2      // Decl are enviro nment vari ables
  3      environ ment{
  4         def  productAcr onym="TAS"
  5         def  productMaj orVersion= '01'
  6         def  productMin orVersion= '00'
  7         def  productRev =''
  8         def  packageVer sion="${pr oductMajor Version}.$ {productMi norVersion }"
  9         def  dateString  = new Dat e(currentB uild.start TimeInMill is).format ('yyyyMMdd _HHmmss')
  10         def  LOG_DIR =  "${WORKSPA CE}/logs"
  11         def  DIST_OUTPU T_FILENAME =''
  12         def  DIST_OUTPU T_FILE=''
  13         def  lastCommit ID=''
  14         def  packageNam e='VAVLGat eway'
  15         def  WEB_BASEDI R="/var/ww w/html"
  16         def  STAGING_DI R="${WEB_B ASEDIR}/de v/tas"
  17         def  mccf_git_r epo="https ://bitbuck et.org/hal faker/mccf _tas_vista link"
  18         def  buildResul tUUID=''
  19         def  TASWorkspa ce="${WORK SPACE}"
  20         def  RTC_COMPON ENT="MCCF_ EDI_TAS_Vi stalink"
  21         def  productBui ldDir="${R TC_COMPONE NT}"
  22         def  TAS_BUILD_ ARTIFACTS= "Build_Art ifacts"
  23         def  lastGitTag =''
  24         def  scmtool="/ opt/ibm/te amconcert/ 6.0.1/jazz /scmtools/ eclipse/sc m.sh"
  25         def  localTMP=" ${WORKSPAC E}/tmp"
  26         def  branch_nam e=''
  27         def  conPWSeed= UUID.rando mUUID().to String()
  28      }
  29      // Prep are Jenkin s workspac e with sou rce code
  30      agent a ny
  31      options  { timesta mps() }
  32      stages{
  33       stage( 'Prepare w orkspace w ith source  code') {
  34         step s{
  35           sc ript{
  36               def bldEN V=ENV?.tri m().toUppe rCase()
  37               echo "det ermine reg ion for ${ bldENV}"
  38               def regio n=bldENV[0 ..2]
  39               echo "det ermine mai n env for  region ${r egion}, (a ka ${bldEN V})"
  40               def mainE NV=bldENV[ -3..-1]
  41               echo "det ermine act ion for ${ bldENV}, ( aka ${regi on}, ${mai nENV})"
  42               switch(re gion){
  43                  case " AWS":
  44                     ech o "AWS env ironment,  Prepare Ha lfaker wor kspace"
  45                     dir ("${RTC_CO MPONENT}") {
  46                         getHalfake rCode()
  47                     }
  48                     bre ak
  49                  case " MAG":
  50                     ech o ("Initia lize works pace from  RTC")
  51                     if  (!TGT_STRE AM?.trim() .toUpperCa se().equal s("DEV")){
  52                         STAGING_DI R="${WEB_B ASEDIR}/rt c/tas"
  53                     }
  54                     tea mconcert([
  55                         buildType:  [
  56                            buildDe finition:  "${buildDe finitionId }",
  57                            value:  'buildDefi nition'
  58                         ]
  59                     ])
  60                     ech o ("Verify  component  (${RTC_CO MPONENT})  exists")
  61                     sh  '''
  62                         if [[ -d " ${RTC_COMP ONENT}" ]]
  63                         then
  64                            echo "C omponent ( ${RTC_COMP ONENT}) ex ists, safe  to procee d"
  65                         else
  66                            fail "F AIL: No co mponent ($ {RTC_COMPO NENT}) fou nd"
  67                         fi
  68                     '''
  69                     ech o "MAG env ironment,  determine  SRC_STREAM "
  70                     if( mainENV.eq uals("DEV" ) &&  SRC_ STREAM?.tr im().toUpp erCase().e quals("HAF ")){
  71                         echo "need  to get HA F code"
  72                         dir("${loc alTMP}"){
  73                            getHalf akerCode()
  74                            echo "n eed to che ck lastGit Commit aga inst lastG itTag"
  75                         }
  76                         dir("${RTC _COMPONENT }"){
  77                            sh 'cp  -p .projec t ../tasvi stalink.pr oject'
  78                            sh 'cp  -p .jazzig nore ../ta svistalink .jazzignor e'
  79                            sh 'rsy nc -acvWh  "${localTM P}/" . --e xclude ".g it" --del'
  80                            sh 'mv  ../tasvist alink.proj ect .proje ct'
  81                            sh 'mv  ../tasvist alink.jazz ignore .ja zzignore'
  82                         }
  83                     }
  84                     bre ak
  85                  defaul t:
  86                     ech o "local e nvironment , Prepare  Halfaker w orkspace"
  87                     dir ("${RTC_CO MPONENT}") {
  88                         getHalfake rCode()
  89                     }
  90               }
  91           }
  92         }
  93       }
  94       // Per form pre-b uild tasks
  95       stage( 'Pre-Build  Setup'){
  96         envi ronment {
  97           de f pom = ''
  98           de f reposito ries_found =false
  99           de f bad_file s=''
  100         }
  101         step s{
  102           ec ho "create  log direc tory ${LOG _DIR}"
  103           sh  "if [[ -d  ${LOG_DIR } ]]; then  rm -f ${L OG_DIR}/*;  else mkdi r -p ${LOG _DIR};fi"
  104           ec ho ("verif y there ar e no repos itories li sted in po m files")
  105           sc ript{
  106               foundPomF iles=findF iles glob:  "${produc tBuildDir} /**/pom.xm l"
  107               foundPomF iles.each{
  108                  echo " examining   ${it.getP ath()}"
  109                  pom =  readMavenP om file: i t.getPath( )
  110                  reposi tories = p om.reposit ories
  111                  if (re positories ){
  112                     ech o ("reposi tories fou nd are ${r epositorie s}")
  113                     rep ositories_ found=true
  114                     bad _files <<  it.getPath ()
  115                     ech o bad_file s
  116                  }
  117               }
  118               if(reposi tories_fou nd == 'tru e'){
  119                  echo ' repositori es found i n pom file s, fail th e build'
  120                  echo b ad_files
  121                  error( "Build fai led becaus e there ar e reposito ries prese nt in pom  files")
  122               }
  123               else{
  124                  echo " no reposit ories list ed in pom  files, pro ceed"
  125               }
  126           }
  127           sc ript{
  128              if(ENV?.tr im().toUpp erCase().s tartsWith( "MAG")){
  129                echo "bu ilding in  MAG, do no t use git  commit in  packageVer sion"
  130                productR ev="${BUIL D_NUMBER}_ ${dateStri ng}"
  131              }
  132              else {
  133                echo "gi t build"
  134                lastComm itID=getLa stGitCommi t()
  135                echo "la st commit  is ${lastC ommitID}"
  136                if(lastC ommitID?.t rim()){
  137                  produc tRev="${BU ILD_NUMBER }_${lastCo mmitID}"
  138                }
  139              }
  140              echo "fina l packageV ersion for  tag ${pac kageVersio n}.${produ ctRev}"
  141              DIST_OUTPU T_FILENAME ="${packag eName}_${p ackageVers ion}.${pro ductRev}-b undle.tar. gz"
  142              DIST_OUTPU T_FILE = " ${productB uildDir}/V AVLGateway /target/${ DIST_OUTPU T_FILENAME }"
  143           }
  144           ec ho "buildi ng for pac kage ${DIS T_OUTPUT_F ILENAME}"
  145           di r ("${prod uctBuildDi r}"){
  146              echo "WORK AROUND: ad d the prec ompiled xm ltypes to  the local  maven repo  store"
  147              sh """mvn  install:in stall-file  -Dfile=./ libs/xmlty pes-1.6.1. jar -Dgrou pId=gov.va .med -Dart ifactId=xm ltypes -Dv ersion=1.6 .1 -Dpacka ging=jar"" "
  148              echo "WORK AROUND: ad d the prec ompiled xb eans to th e local ma ven repo s tore"
  149              sh """mvn  install:in stall-file  -Dfile=./ libs/xbean -1.6.0.jar  -DgroupId =gov.va.me d -Dartifa ctId=xbean  -Dversion =1.6.0 -Dp ackaging=j ar"""
  150           }
  151         }
  152       }
  153       stage( 'Build Vis taLink'){
  154         step s{
  155           ec ho "build  the projec t ${produc tBuildDir} /VistaLink "
  156           di r ("${prod uctBuildDi r}/VistaLi nk"){
  157              sh """mvn  -X -l ${LO G_DIR}/Vis taLink_com pile_${dat eString}.l og -Drevis ion="${pro ductMajorV ersion}.${ productMin orVersion} " -Dbuild. number="${ BUILD_NUMB ER}" -Dcon PWSeed=${c onPWSeed}  clean comp ile"""
  158           }
  159         }
  160       }
  161       stage( 'Unit-test  VistaLink '){
  162         step s{
  163           ec ho "build  the projec t ${produc tBuildDir} /VistaLink "
  164           di r ("${prod uctBuildDi r}/VistaLi nk"){
  165              sh """mvn  -e -Dmaven .test.fail ure.ignore =false -Dr evision="$ {productMa jorVersion }.${produc tMinorVers ion}" -Dbu ild.number ="${BUILD_ NUMBER}" - DconPWSeed =${conPWSe ed} -Dgrou ps="Unit"  test"""
  166           }
  167         }
  168       }
  169       stage( 'Package V istaLink') {
  170         step s{
  171           ec ho "Packag e ${produc tBuildDir} /VistaLink "
  172           di r ("${prod uctBuildDi r}/VistaLi nk"){
  173              sh """mvn  -X-l ${LOG _DIR}/Vist aLink_pack age_${date String}.lo g -DskipTe sts -Drevi sion="${pr oductMajor Version}.$ {productMi norVersion }" -Dbuild .number="$ {BUILD_NUM BER}" -Dco nPWSeed=${ conPWSeed}  clean pac kage"""
  174              echo "add  the newly  compiled V istaLink t o the loca l maven re po store"
  175              sh """mvn  install:in stall-file  -Dfile=./ target/Vis taLink-${p roductMajo rVersion}. ${productM inorVersio n}.${BUILD _NUMBER}.j ar -Dgroup Id=VistaLi nk -Dartif actId=Vist aLink -Dve rsion=${pr oductMajor Version}.$ {productMi norVersion }.${BUILD_ NUMBER} -D packaging= jar"""
  176           }
  177         }
  178       }
  179       stage( 'Build VAV istaLinkSe rver'){
  180         step s{
  181           ec ho "build  the projec t ${produc tBuildDir} /VAVistaLi nkServer"
  182           di r ("${prod uctBuildDi r}/VAVista LinkServer "){
  183              sh """mvn  -X -l ${LO G_DIR}/VAV istaLinkSe rver_compi le_${dateS tring}.log  -Drevisio n="${produ ctMajorVer sion}.${pr oductMinor Version}"  -Dbuild.nu mber="${BU ILD_NUMBER }" -Dvista link.versi on="${prod uctMajorVe rsion}.${p roductMino rVersion}. ${BUILD_NU MBER}" cle an compile """
  184           }
  185         }
  186       }
  187       stage( 'Unit-test  VAVistaLi nkServer') {
  188         step s{
  189           ec ho "build  the projec t ${produc tBuildDir} /VAVistaLi nkServer"
  190           di r ("${prod uctBuildDi r}/VAVista LinkServer "){
  191              sh """mvn  -e -Dmaven .test.fail ure.ignore =false -Dr evision="$ {productMa jorVersion }.${produc tMinorVers ion}"  -Db uild.numbe r="${BUILD _NUMBER}"  -Dvistalin k.version= "${product MajorVersi on}.${prod uctMinorVe rsion}.${B UILD_NUMBE R}" -Dgrou ps="Unit"  test"""
  192           }
  193         }
  194       }
  195       stage( 'Package V AVistaLink Server'){
  196         step s{
  197           ec ho "Packag e ${produc tBuildDir} /VAVistaLi nkServer"
  198           di r ("${prod uctBuildDi r}/VAVista LinkServer "){
  199              sh """mvn  -X -l ${LO G_DIR}/VAV istaLinkSe rver_packa ge_${dateS tring}.log  -DskipTes ts -Drevis ion="${pro ductMajorV ersion}.${ productMin orVersion} "  -Dbuild .number="$ {BUILD_NUM BER}" -Dvi stalink.ve rsion="${p roductMajo rVersion}. ${productM inorVersio n}.${BUILD _NUMBER}"  clean pack age"""
  200              echo "add  the newly  compiled V AVistaLink Server to  the local  maven repo  store"
  201               sh """mvn  install:in stall-file  -Dfile=./ target/VAV istaLinkSe rver-${pro ductMajorV ersion}.${ productMin orVersion} .${BUILD_N UMBER}.jar  -DgroupId = DNS . URL .tas -Dart ifactId=VA VistaLinkS erver -Dve rsion=${pr oductMajor Version}.$ {productMi norVersion }.${BUILD_ NUMBER} -D packaging= jar"""
  202           }
  203         }
  204       }
  205       stage( 'Package M yVLTestPin g'){
  206         step s{
  207           ec ho "Prepar e to packa ge ${produ ctBuildDir }/MyVLTest Ping"
  208           di r("${produ ctBuildDir }/MyVLTest Ping"){
  209              sh """mvn  -X -DskipT ests -Drev ision="${p roductMajo rVersion}. ${productM inorVersio n}"  -Dbui ld.number= "${BUILD_N UMBER}" -D vavlserver .version=" ${productM ajorVersio n}.${produ ctMinorVer sion}.${BU ILD_NUMBER }" -Dvista link.versi on="${prod uctMajorVe rsion}.${p roductMino rVersion}. ${BUILD_NU MBER}" cle an package """
  210           }
  211         }
  212       }
  213       stage( 'Create VA VLGateway  Distributi on'){
  214         step s{
  215           ec ho "Prepar e to packa ge ${produ ctBuildDir }/VAVLGate way"
  216           di r("${produ ctBuildDir }/VAVLGate way"){
  217              sh """mvn  -X -DskipT ests -Drev ision="${p roductMajo rVersion}. ${productM inorVersio n}" -Dbuil d.number=" ${productR ev}" clean  package"" "
  218           }
  219  
  220           ec ho "====== ========== ========== ========== ========== "
  221           ec ho "versio n of Vista Link is ${ productMaj orVersion} .${product MinorVersi on}.${BUIL D_NUMBER}"
  222           ec ho "versio n of VAVis taLinkServ er is ${pr oductMajor Version}.$ {productMi norVersion }.${BUILD_ NUMBER}"
  223           ec ho "versio n of MyVLT estPing is  ${product MajorVersi on}.${prod uctMinorVe rsion}.${B UILD_NUMBE R}"
  224           ec ho "versio n of VAVLG ateway is  ${productM ajorVersio n}.${produ ctMinorVer sion}.${pr oductRev}"
  225           ec ho "         output f ilename is  ${DIST_OU TPUT_FILEN AME}"
  226           ec ho "====== ========== ========== ========== ========== "
  227         }
  228       }
  229       stage( 'Run Forit fy Scan')  {
  230         envi ronment {
  231           de f fortifyR esults=''
  232         }
  233         step s{
  234           sc ript{
  235              echo "run  fortify sc an"
  236              try{
  237                dir ("${ productBui ldDir}"){
  238                  fortif yResults=s h(
  239                  return Stdout: tr ue, 
  240                  script : './runFo rtifyScan. sh -Drevis ion="${pro ductMajorV ersion}.${ productMin orVersion} "  -Dbuild .number="$ {BUILD_NUM BER}" -Dva vlserver.v ersion="${ productMaj orVersion} .${product MinorVersi on}.${BUIL D_NUMBER}"  -Dvistali nk.version ="${produc tMajorVers ion}.${pro ductMinorV ersion}.${ BUILD_NUMB ER}"'
  241                  ).trim ()
  242                }
  243             
  244              catch (Exc eption e){
  245                echo "Fo rtify scan  failed wi th ${e}"
  246                echo "ar e we ignor ing the re sults: ${e nv.ignoreF ortifyResu lts?.trim( )}"
  247                if(env.i gnoreForti fyResults? .trim() ==  'true'){
  248                  curren tBuild.res ult='SUCCE SS'
  249                }
  250                else{
  251                  curren tBuild.res ult='FAILU RE'
  252                }
  253              }
  254           }
  255  
  256           ec ho "cleanu p after we  are finis hed, remov ing all th e built ja rs"
  257           di r("${produ ctBuildDir }/VAVLGate way"){
  258              sh """
  259              mvn depend ency:purge -local-rep ository -D manualIncl ude=gov.va .VistaLink Http,va.go v.tas,gov. va.med,Vis taLink -Dv erbose=tru e -DreReso lve=false
  260              """
  261           }
  262         }
  263       }
  264       stage( 'Stage Dis tribution  Package')  {
  265          ste ps{
  266           ec ho "stage  the packag ed distrib ution (${D IST_OUTPUT _FILE}) fo r ${packag eName}"
  267           st ageLatestA rtifact("$ {DIST_OUTP UT_FILE}")
  268         }
  269       }
  270     }
  271     post{
  272       always {
  273         echo  "POST alw ays: all t asks are c ompleted,  collecting  environme nt variabl es to ${WO RKSPACE}/$ {BUILD_TAG }.log"
  274         sh ' printenv > > $WORKSPA CE/$BUILD_ TAG.enviro nment.log'
  275         echo  "POST alw ays: archi ving all l ogs and ar tifacts sp ecified"
  276         juni t allowEmp tyResults:  true, hea lthScaleFa ctor: 1.0,  testResul ts: '**/ta rget/suref ire-report s/**/*.xml '
  277       }
  278       succes s{
  279         echo  'POST suc cess: chec k environm ent to det ermine com mit action s'
  280         scri pt {
  281           de f myENV="$ {ENV}"
  282           de f subENV=m yENV[0..2]
  283           de f MAG_ARTI FACT_LOCAT ION = "${W ORKSPACE}/ ${TAS_BUIL D_ARTIFACT S}/${packa geVersion} "
  284           ec ho "POST s uccess: de termine pr oper commi t action f or ${myENV }, (aka ${ subENV})"
  285           sw itch(subEN V.toUpperC ase()){
  286              case "AWS" :
  287                echo "PO ST success : AWS envi ronment, u se git to  tag this b uild"
  288                gitTagBu ild()
  289                echo "PO ST success : reset cu rrentBuild Result '${ currentBui ld.result  }' if null  or not su ccess"
  290                if(curre ntBuild.re sult != 'S UCCESS'){  currentBui ld.result= 'SUCCESS'}
  291                echo "PO ST success : in AWS,  make MSTEA MS notific ation '${c urrentBuil d.result}' "
  292                notifyMS Teams(curr entBuild.r esult)
  293                break
  294              case "MAG" :
  295                echo "PO ST success : MAG envi ronment, c opy packag ed artifac t (${DIST_ OUTPUT_FIL E}) to ${T AS_BUILD_A RTIFACTS}"
  296                sh """
  297                  mkdir  -p "${MAG_ ARTIFACT_L OCATION}"
  298                  cp "${ DIST_OUTPU T_FILE}" " ${MAG_ARTI FACT_LOCAT ION}/"
  299                  echo " POST succe ss: check  ${MAG_ARTI FACT_LOCAT ION}/${DIS T_OUTPUT_F ILENAME}"
  300                  if [[  -f "${MAG_ ARTIFACT_L OCATION}/$ {DIST_OUTP UT_FILENAM E}" ]]
  301                  then
  302                    echo  "POST suc cess: Arti fact (${MA G_ARTIFACT _LOCATION} /${DIST_OU TPUT_FILEN AME}) exis ts, safe t o proceed"
  303                  else
  304                    fail  "FAIL: PO ST success : No artif act (${MAG _ARTIFACT_ LOCATION}/ ${DIST_OUT PUT_FILENA ME}) found "
  305                  fi
  306                 """
  307                echo "cl eanup prio r to check in and del iver"
  308                dir("${p roductBuil dDir}"){
  309                  sh 'rm  -rf **/lo gs'
  310                  sh 'rm  -rf **/ta rget'
  311                  sh 'fi nd . -name  "*.log" - type f -de lete'
  312                }
  313                dir("${R TC_COMPONE NT}"){
  314                  sh 'rm  -rf **/lo gs'
  315                  sh 'rm  -rf **/ta rget'
  316                  sh 'fi nd . -name  "*.log" - type f -de lete'
  317                  sh 'rm  -rf *@*'
  318                }
  319                rtcCheck in()
  320                rtcDeliv er()
  321                echo "PO ST success : send ema il notific ation '${c urrentBuil d.result}' "
  322                notifyBu ildStatus( currentBui ld.result)
  323              break
  324              default:
  325               echo "POS T success:  local env ironment,  send no no tices"
  326               echo "POS T success:  local env ironment,  do not com mit any ta g"
  327           }
  328         }
  329         echo  "POST suc cess: coll ecting con sole log"
  330         getC onsoleLog( )
  331         echo  "POST suc cess: arch iving all  logs and a rtifacts s pecified"
  332         arch iveArtifac ts allowEm ptyArchive : true, ar tifacts: ' **/*.log,  **/*.fpr,  **/*.pdf,  **/target/ surefire-r eports/**/ *.xml' , o nlyIfSucce ssful: fal se
  333         echo  'POST suc cess: Perf orming cle anup tasks  after bui ld success '
  334         dele teDir()
  335       }
  336       // Per form tasks  upon erro r
  337       failur e{
  338         scri pt{
  339           ec ho "POST f ailure: re set curren tBuildResu lt '${curr entBuild.r esult }' i f null or  not failed "
  340           if (currentBu ild.result  != 'FAILU RE'){ curr entBuild.r esult='FAI LURE'}
  341           if (BUILD_URL .toLowerCa se().conta ins("aws") ){
  342              echo "POST  failure:  in AWS, ma ke MSTEAMS  notificat ion '${cur rentBuild. result}'"
  343              notifyMSTe ams(curren tBuild.res ult)
  344           }
  345           if (ENV.toLow erCase().c ontains("l ocal")){
  346                echo "PO ST failure : local en vironment,  send no n otices"
  347           }
  348           el se{
  349              echo "POST  failure:  send email  notificat ion '${cur rentBuild. result}'"
  350              notifyBuil dStatus(cu rrentBuild .result)
  351           }
  352         }
  353         echo  "POST fai lure: coll ecting con sole log"
  354         getC onsoleLog( )
  355         echo  "POST fai lure: arch iving all  logs and a rtifacts s pecified"
  356         arch iveArtifac ts allowEm ptyArchive : true, ar tifacts: ' **/*.log,  **/*.fpr,  **/*.pdf,  **/target/ surefire-r eports/**/ *.xml' , o nlyIfSucce ssful: fal se
  357         echo  'POST fai lure: Perf orming cle anup tasks  for build  failure'
  358         dele teDir()
  359       }
  360     }
  361   }
  362   // FUNCTIO NS SPECIFI C TO HALFA KER BEGIN
  363  
  364   // FUNCTIO NS USED
  365    // git fu nctions
  366   // Functio n to get b ranch name
  367   def getBra nchName(){
  368     def bran ch="${GIT_ BRANCH}"
  369     return b ranch.toke nize('/')[ 1].toLower Case()
  370   }
  371  
  372   // Functio n to load  workspace
  373   def getHal fakerCode( ){
  374     branch_n ame=getBra nchName()
  375     echo "($ {branch_na me}), [${G IT_BRANCH} ]"
  376     echo "ge t the code "
  377     sh """
  378       git co nfig --glo bal core.a utocrlf fa lse
  379       git co nfig --glo bal creden tial.helpe r 'cache - -timeout=3 600'
  380     """
  381     git cred entialsId:  'jenkins_ build', ur l: "${mccf _git_repo} ", poll: f alse, bran ch: "${bra nch_name}"
  382     echo ("g et last gi t tag")
  383     lastGitT ag=gitDesc ribe()
  384     def last Commit=get LastGitCom mit()
  385     echo ("c heck lastG itTag (${l astGitTag} )")
  386     echo ("n eed to ver ify last c ommit (${l astCommit} ) is part  of last ta g (${lastG itTag}), s o we can c heckin")
  387     if ( las tGitTag?.t rim() ){
  388       echo ( "Ready to  build ${la stGitTag}  (${lastCom mit})")
  389     }
  390     else {
  391       error( "FAIL: no  source pul led from $ {mccf_git_ repo}")
  392     }
  393   }
  394  
  395   def gitDes cribe(){
  396     echo "ge tting last  git tag"
  397     def MYIN FO
  398     def tagE xists=sh(r eturnStdou t: true, s cript: 'gi t tag --li st').trim( )
  399     echo "ta g: ${tagEx ists}"
  400     MYINFO=s h(returnSt dout: true , script:  'git descr ibe --alwa ys').trim( )
  401     echo ("w e need to  parse ${MY INFO} to d etermine i f the late st tag is  the latest  commit")
  402     MYINFO
  403   }
  404  
  405   // Functio n for git  last commi t
  406   def getLas tGitCommit (){
  407     echo "ge tting last  git commi t"
  408     def LAST _COMMIT
  409     LAST_COM MIT = sh (
  410       script : 'git rev -parse HEA D',
  411       return Stdout: tr ue
  412     ).trim()
  413     echo ("t he last co mmit is ${ LAST_COMMI T[0..6]}")
  414     LAST_COM MIT[0..6]
  415   }
  416  
  417   // Functio n for git  changesets
  418   def getCha ngesets(){
  419       def ch angeLogSet s = curren tBuild.cha ngeSets
  420       echo " reviewing  changesets :"
  421       def co mmitMessag e=""
  422       for (i nt i = 0;  i < change LogSets.si ze(); i++)  {
  423           de f entries  = changeLo gSets[i].i tems
  424           fo r (int j =  0; j < en tries.leng th; j++) {
  425                def entr y = entrie s[j]
  426                commitMe ssage="${c ommitMessa ge} \n ${e ntry.commi tId} by ${ entry.auth or} on ${n ew Date(en try.timest amp)}"
  427                echo "${ entry.comm itId} by $ {entry.aut hor} on ${ new Date(e ntry.times tamp)}: ${ entry.msg} "
  428                def file s = new Ar rayList(en try.affect edFiles)
  429                for (int  k = 0; k  < files.si ze(); k++)  {
  430                    def  file = fil es[k]
  431                    echo  "  ${file .editType. name} ${fi le.path}"
  432                }
  433           }
  434       }
  435       return  "${commit Message}"
  436   }
  437  
  438   // Functio n for git  tag
  439   def gitTag Build(){
  440     withCred entials([u sernamePas sword(cred entialsId:  'jenkins_ build', pa sswordVari able: 'jen kinsPass',  usernameV ariable: ' jenkinsUse r')]) {
  441       def MY HOSTNAME=g etHostname ()
  442       def co mmit_messa ge = /"jen kins-${JOB _BASE_NAME }-${BUILD_ NUMBER}-${ MYHOSTNAME }"/
  443       sh 'gi t config - -list'
  444       echo " set the us er.name, u ser.email"
  445       def uE mail = /"m ccfsystema dmins@half aker.com"/
  446       sh """
  447         git  config use r.name "${ jenkinsUse r}"
  448         git  config use r.email ${ uEmail}
  449         git  config --g lobal push .default s imple
  450         git  config ali as.version log "notes  --ref=ver sionlog ap pend"
  451         git  config --a dd remote. origin.pus h '+refs/n otes/*:ref s/notes/*'
  452         git  config --a dd remote. origin.fet ch '+refs/ notes/*:re fs/notes/* '
  453         git  remote set -url origi n ${GIT_UR L}
  454         git  config --l ist
  455       """
  456       echo " append ver sion note  to this co mmit"
  457       addGit VersionLog ()
  458       echo " tag this c ommit ${pa ckageVersi on}${BUILD _NUMBER}"
  459       sh """
  460         git  tag -a ${p ackageVers ion}${BUIL D_NUMBER}  -m '${comm it_message }' ${lastC ommitID}
  461         echo  "push cha nges to re mote"
  462         git  push origi n --tags - -verbose
  463       """
  464     }
  465   }
  466  
  467   // Functio n for addi ng git ver sion log
  468   def addGit VersionLog (){
  469     def last BuildDate= new Date(c urrentBuil d.startTim eInMillis) .format('M MM dd, yyy y HH:mm:ss  Z')
  470     def vers ionString= "version:  ${packageV ersion}"
  471     def buil dDateStrin g="lastBui ldDate: ${ lastBuildD ate}"
  472     def dist ributionSt ring="dist ributionFi leName: <s taging_url >/${DIST_O UTPUT_FILE NAME}"
  473     sh """
  474       git ve rsionlog $ {lastCommi tID} -m "$ {versionSt ring}, ${b uildDateSt ring}, ${d istributio nString}"
  475     """
  476   }
  477   // GIT FUN CTIONS END
  478   //  helper  functions
  479  
  480   // Functio n to stage  distribut ion packag e
  481   def stageL atestArtif act(artifa ct){
  482       echo " stage the  latest bui ld artifac t(${artifa ct}) for d eployment"
  483       def ar tifact_nam e= artifac t.tokenize ('/').last ()
  484       def st aging = ST AGING_DIR. trim().toL owerCase()
  485       def la test = "${ WEB_BASEDI R}/latest_ vistalink_ dev"
  486       echo " check for  TGT_STREAM "
  487       if(env .branch_na me && env. branch_nam e?.trim(). toLowerCas e() != 'ma ster'){
  488         echo  "staging  for branch  build (${ branch_nam e})"
  489         def  link=branc h_name?.tr im().toLow erCase()
  490         late st = "${WE B_BASEDIR} /latest_vi stalink_${ link}"
  491       }
  492       else{
  493         if(e nv.TGT_STR EAM && env .TGT_STREA M?.trim()) {
  494           ec ho "TGT_ST REAM found  (${TGT_ST REAM})"
  495           de f link=TGT _STREAM.tr im().toLow erCase()
  496           la test = "${ WEB_BASEDI R}/latest_ vistalink_ ${link}"
  497         }
  498       }
  499       try {
  500           ec ho "check  ${staging}  directory  exist"
  501           sh  "[[ -d ${ staging} ] ] || sudo  mkdir -p $ {staging}"
  502           ec ho "fix di rectory pe rmissions"
  503           sh  """
  504              set -x
  505              sudo find  \$(dirname  ${STAGING _DIR}) -ty pe d -exec  chmod 075 5 {} \\;
  506           "" "
  507           ec ho "copy $ {artifact}  to ${stag ing}/"
  508           sh  "sudo cp  ${artifact } ${stagin g}/"
  509           ec ho "create  symbolic  link to st aged artif act"
  510           sh  "sudo ln  -sfn ${sta ging}/${ar tifact_nam e} ${lates t}"
  511           ec ho "verify  link crea ted"
  512           de f linkExis ts=sh (
  513                script:  "readlink  ${latest}" ,
  514                returnSt dout: true
  515                ).trim()
  516           sh  """
  517                if [[ -n  "${linkEx ists}" ]];  then
  518                    echo  "link exi sts for ${ latest}"
  519                else
  520                    echo  "link not  found ${l atest}"
  521                fi
  522           "" "
  523       } catc h(Exceptio n e){
  524           ec ho "someth ing bad ha ppened whi le staging  artifact,  throw and  fail"
  525           ec ho e.toStr ing()
  526           th row e
  527       }
  528   }
  529  
  530   // Functio n for gett ing the ho stname
  531   def getHos tname(){
  532     def THIS HOSTNAME
  533     if(isUni x()){
  534       THISHO STNAME = s h (
  535         scri pt: 'hostn ame',
  536         retu rnStdout:  true
  537       ).trim ()
  538     }
  539     else {
  540       THISHO STNAME = b at (
  541         scri pt: 'hostn ame',
  542         retu rnStdout:  true
  543       ).trim ()
  544     }
  545     THISHOST NAME
  546   }
  547  
  548   // Functio n to notif y regardin g build st atus
  549  
  550   def notify BuildStatu s(String b uildStatus  = 'STARTE D') {
  551     // build  status of  null mean s successf ul
  552     buildSta tus =  bui ldStatus ? : 'SUCCESS FUL'
  553  
  554   //recipien tProviders  (optional )
  555   //$class:  CulpritsRe cipientPro vider
  556   //Sends em ail to the  list of u sers who c ommitted a  change si nce the la st non-bro ken build  till now.
  557   //This lis t at least  always in clude peop le who mad e changes  in this bu ild, but i f the prev ious build
  558   //was a fa ilure it a lso includ es the cul prit list  from there .
  559  
  560   //$class:  Developers RecipientP rovider
  561   //Sends em ail to all  the peopl e who caus ed a chang e in the c hange set.
  562  
  563   //$class:  FailingTes tSuspectsR ecipientPr ovider
  564   //Sends em ail to the  list of u sers suspe cted of ca using a un it test to  begin fai ling.
  565   //This lis t includes  committer s and requ estors of  the build  where the  test began  to fail,
  566   //and thos e for any  consecutiv e failed b uilds prio r to the b uild in wh ich the te st began t o fail.
  567  
  568   //$class:  FirstFaili ngBuildSus pectsRecip ientProvid er
  569   //Sends em ail to the  list of u sers suspe cted of ca using the  build to b egin faili ng.
  570  
  571   //$class:  ListRecipi entProvide r
  572   //Sends em ail to the  list of r ecipients  defined in  the "Proj ect Recipi ent List."
  573  
  574   //$class:  RequesterR ecipientPr ovider
  575   //Sends em ail to the  user who  initiated  the build.
  576  
  577   //$class:  UpstreamCo mitterReci pientProvi der
  578   //Sends em ail to the  list of u sers who c ommitted c hanges in  upstream b uilds that  triggered  this buil d
  579   // Default  values            Li stRecipien tProvider
  580     def reci pients=[[$ class: 'Li stRecipien tProvider' ]]
  581     def subj ect = "${b uildStatus }: Job '${ env.JOB_NA ME} [${env .BUILD_NUM BER}]'"
  582     def repl yto = "${e nv.DEFAULT _REPLYTO}"
  583     def mime Type = "te xt/html"
  584     def send to = "${en v.DEFAULT_ RECIPIENTS }"
  585     def deta ils = """
  586       <p>Job : '${env.J OB_NAME} b uild: [${e nv.BUILD_N UMBER}]':< /p>
  587       <p>Che ck console  output at  "<a href= "${env.BUI LD_URL}">$ {env.JOB_N AME} [${en v.BUILD_NU MBER}]</a> "</p>
  588       """
  589  
  590       // Ove rride defa ult values  based on  build stat us
  591     if (buil dStatus ==  'STARTED'  || buildS tatus == ' SUCCESSFUL ' || build Status ==  'FIXED') {
  592       recipi ents = [[$ class: 'De velopersRe cipientPro vider']]
  593     }
  594  
  595     else if  (buildStat us == 'ABO RTED' || b uildStatus  == 'UNSTA BLE') {
  596       recipi ents = [[$ class: 'De velopersRe cipientPro vider']]
  597     }
  598     else {
  599       echo " unknown st atus"
  600       recipi ents = [[$ class: 'Cu lpritsReci pientProvi der'], [$c lass: 'Req uesterReci pientProvi der']]
  601     }
  602   //examples
  603   //Notify C ulprits an d Requeste r via defa ult EMail  plugin
  604   //step([$c lass: 'Mai ler', noti fyEveryUns tableBuild : true, re cipients:  emailextre cipients([ [$class: ' CulpritsRe cipientPro vider'], [ $class: 'R equesterRe cipientPro vider']])] )
  605  
  606   //Send an  email to a bc plus an y addresse s returned  by the pr oviders
  607   //emailext  body: 'A  Test EMail ',
  608   //          recipient Providers:  [[$class:  'Develope rsRecipien tProvider' ], [$class : 'Request erRecipien tProvider' ]],
  609   //          subject:  'Test',
  610   //          to: 'abc'
  611     echo "se nd email t o recipien ts (${reci pients}) f or ${build Status}"
  612     echo """
  613         subj ect: ${sub ject},
  614         body : ${detail s},
  615         reci pientProvi ders: ${re cipients},
  616         repl yTo: ${rep lyto},
  617         to:  ${sendto}
  618         """
  619     mail (
  620         body : details,
  621         cc:  'PII',
  622         mime Type: 'tex t/html',
  623         repl yTo: reply to,
  624         subj ect: subje ct,
  625         to:  sendto
  626         )
  627   }
  628  
  629   def notify MSTeams(St ring build Status = ' STARTED')  {
  630   // build s tatus of n ull means  successful
  631     buildSta tus =  bui ldStatus ? : 'SUCCESS FUL'
  632  
  633     def last Build = cu rrentBuild .getPrevio usBuild()
  634  
  635     // Defau lt values
  636     def colo rCode = 'C 50E2E'
  637     def subj ect = "${e nv.ENV} :  Job '${env .JOB_NAME}  [${env.BU ILD_NUMBER }]'"
  638     def summ ary = "${s ubject} [V iew on Jen kins](${en v.BUILD_UR L})"
  639  
  640       // Ove rride defa ult values  based on  build stat us
  641     if (buil dStatus ==  'STARTED' ) {
  642       colorC ode = 'FFF F00'
  643     }
  644     else if  (buildStat us == 'SUC CESSFUL')  {
  645       colorC ode = '05b 222'
  646       if( la stBuild &&  lastBuild .getResult ().toStrin g()=="FAIL URE" ){
  647         buil dStatus =  'FIXED'
  648       }
  649     }
  650     else if  (buildStat us == 'ABO RTED') {
  651       colorC ode = '800 080'
  652     }
  653     else if  (buildStat us == 'UNS TABLE') {
  654       colorC ode = '808 080'
  655     }
  656     else {
  657       color  = 'RED'
  658       colorC ode = '#FF 0000'
  659     }
  660  
  661     // Send  notificati ons
  662     echo "se nd notice  of ${build Status} to  MSTeams"
  663     def chan gesMessage =getChange sets()
  664     if(build Status ==  'SUCCESSFU L'){
  665       echo " only send  notice if  previous b uild was n ot success ful"
  666       if( la stBuild &&  lastBuild .getResult ().toStrin g()!="SUCC ESSFUL" ){
  667         echo  "the prev ious build  ${lastBui ld.getId() } was not  successful , send upd ate"
  668         offi ce365Conne ctorSend (
  669           me ssage: sum mary + ":  changesets :  " + cha ngesMessag e,
  670           we bhookUrl:  "${env.off iceWebhook Url}",
  671           co lor: "${co lorCode}",
  672           st atus: "${b uildStatus }"
  673         )
  674       }
  675       else {
  676         echo  "the prev ious build  was " + l astBuild.g etResult() .toString( )
  677       }
  678     }
  679     else {
  680       echo " this build  is ${buil dStatus}"
  681       office 365Connect orSend (
  682         mess age: summa ry + ": ch angesets:   " + chang esMessage,
  683         webh ookUrl: "$ {env.offic eWebhookUr l}",
  684         colo r: "${colo rCode}",
  685         stat us: "${bui ldStatus}"
  686       )
  687     }
  688   }
  689  
  690   // Functio n to save  log to wor kspace
  691   def getCon soleLog(){
  692     echo "ge tConsoleLo g: prepare  logfilena me to get  console lo g"
  693     def logF ilename="$ {JOB_URL}"
  694     def work spaceLog=" ${WORKSPAC E}/${JOB_B ASE_NAME}_ ${BUILD_NU MBER}_cons ole.log"
  695     echo "ge tConsoleLo g: console  log is ${ logFilenam e} (same a s job url) "
  696     logFilen ame=logFil ename.trim ().replace ("${JENKIN S_URL}","$ {JENKINS_H OME}/")
  697     echo "ge tConsoleLo g: console  log is ch anged to $ {logFilena me}"
  698     logFilen ame=logFil ename.trim ().replace All("job", "jobs")
  699     echo "ge tConsoleLo g: console  log is ch anged agai n to ${log Filename}"
  700     logFilen ame="${log Filename}b uilds/${BU ILD_NUMBER }/log"
  701     echo "ge tConsoleLo g: console  log is fi nally  ${l ogFilename }"
  702     echo "ge tConsoleLo g: prepare  to write  to ${works paceLog}"
  703     sh """
  704       sed -e  "s,\\x1b\ \[[0-9]*.* \\x1b\\[0m ,,g;s,\\ba ctive\\b,a ctive\\n\\ r,gm;s,\\x 08,.,gm" " ${logFilen ame}" > "t mp.log"
  705       sed -e  "s,\\x1b\ \[3[0-9][m GKA],,gm;s ,\\x1b\\[1 A,,gm;s,\\ x1b\\[2K,, gm;" "tmp. log" > "${ workspaceL og}"
  706       rm "tm p.log"
  707       echo " getConsole Log: verif y ${worksp aceLog} re ady for ar chival"
  708       if [[  -f "${work spaceLog}"  ]]
  709       then
  710         echo  "getConso leLog: loc al console  log (${wo rkspaceLog }) exists,  safe to p roceed"
  711       else
  712         echo  "getConso leLog: No  local cons ole log ($ {workspace Log}) foun d"
  713       fi
  714     """
  715   }
  716  
  717   // FUNCTIO NS SPECIFI C TO HALFA KER END
  718  
  719   // RTC FUN CTIONS BEG IN
  720   // Functio n to check -in code t o Rational  Team Conc ert
  721   def rtcChe ckin(){
  722     withCred entials([u sernamePas sword(cred entialsId:  'RTC_BUIL D', userna meVariable : 'rtcUser ', passwor dVariable:  'rtcPass' )]) {
  723     // avail able as an  env varia ble, but w ill be mas ked if you  try to pr int it out  any which  way
  724       def MY HOSTNAME=g etHostname ()
  725       def la stBuildDat e=new Date (currentBu ild.startT imeInMilli s).format( 'MMM dd, y yyy HH:mm: ss Z')
  726       def ve rsionStrin g="version : ${packag eVersion}"
  727       def bu ildDateStr ing="lastB uildDate:  ${lastBuil dDate}"
  728       def di stribution String="di stribution FileName:  <staging_u rl>/${DIST _OUTPUT_FI LENAME}"
  729       def co mmitCommen t = /"${ve rsionStrin g}, ${buil dDateStrin g}, ${dist ributionSt ring},jenk ins-${JOB_ BASE_NAME} -${BUILD_N UMBER}-${M YHOSTNAME} "/
  730       def wo rkitem = " ${RTC_WORK ITEM}"
  731       def co mponents=  ["${RTC_CO MPONENT}"]
  732  
  733       echo " show scm s tatus"
  734       sh """
  735         ${sc mtool} sho w status - u ${rtcUse r} -P ${rt cPass} -v  --all -d $ {TASWorksp ace}
  736         echo  "----- -- --- -----  ----- ---- -"
  737       """
  738  
  739       echo " prepare to  checkin c omponents"
  740       for (c omponent i n componen ts){
  741         echo  "loop thr ough each  file in $c omponent"
  742         sh " ""
  743           fi nd $compon ent -maxde pth 1 -typ e f -name  '.*' -exec  ${scmtool } checkin  -u ${rtcUs er} -P ${r tcPass} -- comment ${ commitComm ent} --wor kitem ${wo rkitem} -- delim-none  --checkin -deleted - v -d ${TAS Workspace}  ${TASWork space}/{}  \\;
  744         """
  745         echo  "${scmtoo l} checkin  $componen t/*"
  746         sh " ${scmtool}  checkin - u ${rtcUse r} -P ${rt cPass} --c omment ${c ommitComme nt} --work item ${wor kitem} --d elim-none  --checkin- deleted -v  -d ${TASW orkspace}  ${TASWorks pace}/$com ponent/*"
  747         echo  "----- -- --- -----  ----- ---- -"
  748       }
  749       // the  following  is not va lid until  rtc 6.0.4
  750       //step ([$class:  'RTCPostBu ildDeliver Publisher' , failOnEr ror: true] )
  751     }
  752   }
  753  
  754   // Functio n to deliv er code to  Rational  Team Conce rt
  755   def rtcDel iver(){
  756     withCred entials([u sernamePas sword(cred entialsId:  'RTC_BUIL D', userna meVariable : 'rtcUser ', passwor dVariable:  'rtcPass' )]) {
  757     // avail able as an  env varia ble, but w ill be mas ked if you  try to pr int it out  any which  way
  758       def wo rkitem = " ${RTC_WORK ITEM}"
  759       echo " show scm s tatus"
  760       sh """
  761         ${sc mtool} sho w status - u ${rtcUse r} -P ${rt cPass} -v  --all -d $ {TASWorksp ace}
  762         echo  "----- -- --- -----  ----- ---- -"
  763       """
  764       echo " RTC ${rtcU ser} deliv er "
  765       def de liverStatu s=sh (
  766       script : "${scmto ol} delive r -u ${rtc User} -P $ {rtcPass}  -v",
  767       return Status: tr ue
  768       )
  769       if (de liverStatu s == 0 ||  deliverSta tus == 52  || deliver Status ==  53){
  770         echo  "Deliver  succeeded"
  771         retu rn 0
  772       }
  773     else if  (deliverSt atus == 11 ) {
  774       echo " Accept inc oming chan ges"
  775       def ac ceptStatus =sh (
  776       script : "${scmto ol} accept  -u ${rtcU ser} -P ${ rtcPass} - v",
  777       return Status: tr ue
  778     )
  779       if (ac ceptStatus  == 0) {
  780         def  redoDelive rStatus=sh  (
  781       script : "${scmto ol} delive r -u ${rtc User} -P $ {rtcPass}  -v",
  782       return Status: tr ue
  783       )
  784       if (re dodeliverS tatus == 0  || delive rStatus ==  52 || del iverStatus  == 53){
  785         echo  "Accept a nd Deliver  succeeded "
  786         retu rn 0
  787       }
  788       }
  789     }
  790       else {
  791       curren tBuild.res ult='FAILE D'
  792         erro r("FAIL: S CM deliver  failed wi th ${deliv erStatus}" )
  793       }
  794       // the  following  is not va lid until  rtc 6.0.4
  795       //step ([$class:  'RTCPostBu ildDeliver Publisher' , failOnEr ror: true] )
  796     }
  797   }
  798  
  799   // Functio n to basel ine code t o Rational  Team Conc ert
  800   def rtcBas eline(){
  801     withCred entials([u sernamePas sword(cred entialsId:  'RTC_BUIL D', userna meVariable : 'rtcUser ', passwor dVariable:  'rtcPass' )]) {
  802     // avail able as an  env varia ble, but w ill be mas ked if you  try to pr int it out  any which  way
  803       echo " RTC list w orkspaces  "
  804       def wo rkspaceLis t=sh (
  805       script : "${scmto ol} list w orkspaces  -r local - v",
  806       return Stdout: tr ue
  807       ).trim ()
  808  
  809       echo " workspace:  ${workspa ceList}"
  810  
  811       echo " RTC ${rtcU ser} creat e baseline  "
  812       sh """
  813         ${sc mtool} cre ate baseli ne -u ${rt cUser} -P  ${rtcPass}  --all ${w orkspaceLi st} ${pack ageVersion }
  814       """
  815       // the  following  is not va lid until  rtc 6.0.4
  816       //step ([$class:  'RTCPostBu ildDeliver Publisher' , failOnEr ror: true] )
  817     }
  818   }
  819   // RTC FUN CTIONS END
  820  
  821   // JENKINS  SPECIFIC  FUNCTION B EGIN
  822   // Require d due to J ENKINS-274 21
  823   @NonCPS
  824   List<List< ?>> mapToL ist(Map ma p) {
  825     return m ap.collect  { it ->
  826       [it.ke y, it.valu e]
  827     }
  828   }
  829   // JENKINS  SPECIFIC  FUNCTION E ND
  830