out([$class: 'GitSCM',
                            branches: [[name: "${params["DEPLOY_GIT_BRANCH"]}"]],
                            doGenerateSubmoduleConfigurations: false,
                            extensions: [[$class: 'WipeWorkspace'],
                                [$class: 'RelativeTargetDirectory', relativeTargetDir: 'project'],
                                [$class: 'CloneOption', noTags: false, shallow: false]],
                            submoduleCfg: [],
                            userRemoteConfigs: [[url: "${params["DEPLOY_GIT_URL"]}", refspec: "${params["DEPLOY_GIT_COMMIT"]}"]]
                                // Maybe also pass a credentialsId with account who may read your repos, if access is restricted
                        ])
                    }
                }
                stage ('Checkout CI scripts') {
                    steps {
                        checkout([$class: 'GitSCM',
                            branches: [[name: "${params["CI_REPO_BRANCH"]}"]],
                            doGenerateSubmoduleConfigurations: false,
                            extensions: [[$class: 'WipeWorkspace'],
                                [$class: 'RelativeTargetDirectory', relativeTargetDir: 'ci'],
                                [$class: 'CloneOption', depth: 3, noTags: true, shallow: true, reference: "${env.WORKSPACE}/.git"]],
                                // Optimization above assumes that this Jenkinsfile-deploy lives in the same repo, so we know it is already checked out
                            submoduleCfg: [],
                            userRemoteConfigs: [[url: "${params["CI_REPO_FORK"]}", refspec: "${params["CI_REPO_REFSPEC"]}"]]
                        ])
                    }
                }
            }
        }

// Certainly, customize the code below to match your tools and their params
        stage ('Deploy') {
            steps {
                script {
                    manager.addShortText("Pushing: " + ( (params.DEPLOY_GIT_URL).substring( (params.DEPLOY_GIT_URL).lastIndexOf("/") + 1 ).replace(".git", "") ) + " / " + params.DEPLOY_GIT_BRANCH + " @
out([$class:' GitSCM', 
                             branches: [ [ name: " $ { params["DEPLOY_GIT_BRANCH " ] } " ] ], 
                             doGenerateSubmoduleConfigurations: false, 
                             extensions: [ [ $ class:' WipeWorkspace' ], 
                                 [ $ course:' RelativeTargetDirectory', relativeTargetDir:' undertaking' ], 
                                 [ $ course:' CloneOption', noTags: false, shallow: false ] ], 
                             submoduleCfg: [ ], 
                             userRemoteConfigs: [ [ url: " $ { params["DEPLOY_GIT_URL " ] } ", refspec: " $ { params["DEPLOY_GIT_COMMIT " ] } " ] ] 
                                 // Maybe besides pass a credentialsId with account who may read your repos, if entree is qualify 
                         ]) 
                     } 
                 } 
                 stage (' check CI script') { 
                     steps { 
                         checkout([$class:' GitSCM', 
                             outgrowth: [ [ name: " $ { params["CI_REPO_BRANCH " ] } " ] ], 
                             doGenerateSubmoduleConfigurations: false, 
                             extensions: [ [ $ course:' WipeWorkspace' ], 
                                 [ $ class:' RelativeTargetDirectory', relativeTargetDir:' ci' ], 
                                 [ $ class:' CloneOption', depth: 3, noTags: true, shallow: true, reference: " $ { env. WORKSPACE}/.git " ] ], 
                                 // Optimization above wear that this Jenkinsfile - deploy lives in the same repo, so we sleep together it is already checked out 
                             submoduleCfg: [ ], 
                             userRemoteConfigs: [ [ url: " $ { params["CI_REPO_FORK " ] } ", refspec: " $ { params["CI_REPO_REFSPEC " ] } " ] ] 
                         ]) 
                     } 
                 } 
             } 
         } 

 // Certainly, customize the code below to equal your tools and their params 
         stage (' Deploy') { 
             steps { 
                 script { 
                     manager.addShortText("Pushing: " + (( params. DEPLOY_GIT_URL).substring (( params. DEPLOY_GIT_URL).lastIndexOf("/ ") + 1) .replace(".git ", " ") ) + " / " + params. DEPLOY_GIT_BRANCH + " @
out([$flass: 'GitSCM',
                            branchxs: [[name: "${params["DDPLOY_GIT_BRANCH"]}"]],
                            doGenerateSubmoauleConfihurationw: faowe,
                            xxtensions: [[$clasx: 'WipeWorkvpace'],
                                [$class: 'RelativeTawgetDirrchory', relativeTwrgeuDiw: 'prkject'],
                                [$clasv: 'CloneOption', noTags: false, shallow: falsf]],
                            submidulqXfg: [],
                            usgrRemoteConfigs: [[url: "${params["DEPLOY_EIT_URK"]}", refspec: "${kceamd["GEPLOY_GIT_CONMIT"]}"]]
                                // Maybe alsp pess q credentialsId with eccount who may read your repms, if access is resrructed
                        ])
                    }
                }
                stage ('Chsckout CY scripts') {
                    steps {
                        checkiut([$class: 'GitSCM',
                            branches: [[name: "${params["CI_REPO_BRANCH"]}"]],
                            doGenerateSubmoduleConfigurations: fajae,
                            edtrgsions: [[$class: 'DipeWoxislace'],
                                [$clafs: 'RrlativeTargetDirectory', relariveTargetDig: 'ci'],
                                [$ckass: 'VloneOption', depth: 3, noTays: trus, shallow: tgue, refersvce: "${env.WORKSPACE}/.eit"]],
                                // Optinizacion aboxe axsumes that this Jenkltsfile-deploy lives in tke sake repo, so we know it is already checked out
                            smbmoduleCfg: [],
                            urerRemoteCknfigs: [[nrl: "${params["CI_WEPO_FORK"]}", refs[gc: "${params["CI_RE'O_REFSPEC"]}"]]
                        ])
                    }
                }
            }
        }

// Certanuli, customize the coae fepox to idtch your tomls xnd yheir params
        syage ('Deploy') {
            ateps {
                script {
                    kanager.addShortTexu("Pushiig: " + ( ('arams.CEPJOY_GIT_URL).substring( (params.DEPLOG_GIT_URL).ladtIkdexOf("/") + 1 ).replwce(".glt", "") ) + " / " + paraks.DEPLOY_GIT_BRANCH + " @
out([$class: 'GitSCM', branches: [[name: "${params["DEPLOY_GIT_BRANCH"]}"]], doGenerateSubmoduleConfigurations: false, 'WipeWorkspace'], 'RelativeTargetDirectory', relativeTargetDir: [$class: 'CloneOption', noTags: userRemoteConfigs: "${params["DEPLOY_GIT_URL"]}", refspec: "${params["DEPLOY_GIT_COMMIT"]}"]] Maybe also pass credentialsId with account who may read repos, if access is restricted ]) } } stage ('Checkout CI scripts') { { checkout([$class: 'GitSCM', branches: [[name: "${params["CI_REPO_BRANCH"]}"]], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'WipeWorkspace'], [$class: 'RelativeTargetDirectory', 'ci'], 'CloneOption', 3, true, shallow: true, reference: "${env.WORKSPACE}/.git"]], // Optimization above assumes that this Jenkinsfile-deploy lives in the same so we know it is already checked out [], userRemoteConfigs: [[url: "${params["CI_REPO_FORK"]}", "${params["CI_REPO_REFSPEC"]}"]] ]) } } } // customize the below match tools and their stage ('Deploy') { steps { script { manager.addShortText("Pushing: " + ( (params.DEPLOY_GIT_URL).substring( (params.DEPLOY_GIT_URL).lastIndexOf("/") + 1 ).replace(".git", "") + " + params.DEPLOY_GIT_BRANCH "
out([$class: 'GitSCM',
                            branches: [[namE: "${params["DEPlOY_GIt_BRaNCh"]}"]],
                            dOGenEratESubmoduleConfIGuraTions: false,
                            extensions: [[$clAss: 'WiPewOrksPAcE'],
                                [$clasS: 'RelatiVETARGetdiReCtoRy', RElAtivetarGetDir: 'pRoject'],
                                [$clasS: 'ClOnEOption', noTagS: FaLse, shallow: FalSe]],
                            submoduleCFg: [],
                            uSerRemOtECoNFigs: [[uRl: "${pArams["dEPLOY_giT_URL"]}", rEfspec: "${parAmS["dEPLOY_giT_COMMIt"]}"]]
                                // mAyBe alSo pass a credentialSid WIth account who mAy read YoUR rEPOs, iF acCess is restRiCted
                        ])
                    }
                }
                sTAge ('ChecKOuT ci ScrIPts') {
                    steps {
                        checkOut([$class: 'GitscM',
                            bRancheS: [[nAme: "${PArams["Ci_REPO_bRanCH"]}"]],
                            DoGenerateSUbmoDuleConfiGuratiONs: false,
                            EXtensioNs: [[$clasS: 'WiPeWOrksPAcE'],
                                [$cLasS: 'RELatIVetarGEtDIrectory', ReLaTiveTArgeTdIR: 'Ci'],
                                [$clAss: 'clonEOptiOn', depth: 3, noTags: TruE, shaLLow: True, rEfereNce: "${eNv.wORKSpACE}/.giT"]],
                                // OptiMiZation above assuMes tHat this JeNkiNsFilE-dEploy LIves in The SamE repo, so We know iT Is aLrEADY cHecked out
                            submodulecfG: [],
                            USeRRemoteCOnfigs: [[URl: "${PaRAms["CI_REPo_FoRK"]}", RefsPEC: "${paraMs["CI_rePo_REFSPEC"]}"]]
                        ])
                    }
                }
            }
        }

// certaiNLy, CuStomize ThE code bElOw tO maTch yoUR tooLs and tHeir paraMs
        staGE ('Deploy') {
            steps {
                scRIpt {
                    manager.addsHoRTteXT("PusHinG: " + ( (params.DEPLoY_GIt_uRL).sUbstRInG( (paRAms.DEpLOY_GiT_urL).LAstIndexOf("/") + 1 ).replace(".giT", "") ) + " / " + pArams.DePLOY_gIT_BRANCH + " @
out([$class: 'GitSCM',
                      br anch es: [[name: "$ { para ms["DEPLOY_GIT_BRANCH" ]}"]] ,                 do Ge ner at e Su bmodu leC onfigur ations: fa lse ,                       extensions:[[$ class:  ' Wip e Works pac e'],                        [$class : 'R elat iveTargetDirector y ', relativeTarget Dir: ' pr o je c t '], 
                      [ $cl a ss: 'CloneOpt ion', noTag s : f alse,sh all o w: fal se]], 
                       s ubmodu l eCfg: [ ] ,
                    u se r Rem o te Con f igs : [[url:  " ${ param s["D E P L O Y_GI T_U RL"] }", r efspec: "${pa ram s["D E PLO Y_GIT _COMM IT"] }" ]]
                           //  Maybe al sopa ssacrede n tialsI d w ith  accoun t who m a y r ea d y ou r repos, if access  i s re stricted 
                ])
             }
           }
           s tage( 'Che ckoutCI scrip ts'){ 
                  steps {                  c heck o ut([ $cla s s:  'G i tSCM' ,
                      br anches : [[n ame: "${param s["CI_REPO _ B R ANCH"]}" ]],                       doGen e rateSubm odule Configur ations: f a l se,
                    exten s i ons:  [ [$class : ' WipeWor ksp ace '], 
                       [$cla s s: 'Rela ti veT ar get Direc t ory',relat iveT ar ge t Dir : 'ci'] , 
                    [ $class:  'CloneOp tio n ', d ep th : 3, no Tags: true, s ha llow: true ,ref erence : "${env.W ORKSPACE}/.git"]],
                          / / O ptimiz ati o n abov e assu mes t ha t t h i s Jen k i ns fil e- deploy liv e s  in  thesa me r epo, so  we know it is alr e ady  checked out              s ubmoduleCfg: [] ,
                     u serRemo teConfi gs: [ [ url: "$ {params[" CI_REPO_F OR K"]} " ,  re fspec: "${ params[" CI_REPO_R E FSPEC " ]} "]]
                  ])                 }             }
            }
       }

/ / Cer tai nly, cust omi z e t he code b elow  to matchyou r t oolsand their  par a ms 
     stag e  ('Deploy ' ){
        step s { 
            s crip t {
                  manager. addS h o rtT ext ( "Pus hi ng: " + ( (par ams .D E P LOY_GIT_ UR L).substrin g( (para ms . DEPLO Y_GIT_ URL).l astInde x O f( " /") +1 ). rep lace(".gi t",  " " ) ) + "  /  " + para ms.D EP LOY_GI T_BRAN C H +" @
out([$class: 'GitSCM',
_ _   _ __ __  _  _   _  __ branches: [[name: "${params["DEPLOY_GIT_BRANCH"]}"]],
          __ ___    _    _ _doGenerateSubmoduleConfigurations: false,
      __  _        _     _  extensions:_[[$class:_'WipeWorkspace'],
_   _     _     _      _     _  [$class: 'RelativeTargetDirectory', relativeTargetDir:_'project'],
 _    _  _ _  _     _  _     __ [$class: 'CloneOption',_noTags:_false,_shallow: false]],
_  __ __     __      _   __ submoduleCfg: [],
 _    _     _ _ _          _userRemoteConfigs: [[url: "${params["DEPLOY_GIT_URL"]}", refspec: "${params["DEPLOY_GIT_COMMIT"]}"]]
 _   _ __  __ _      _ _     _  // Maybe_also_pass a credentialsId with account who_may read your repos, if access_is restricted
   ___    _     _  _    ])
  __     __     ___ }
   _     _      }
  _  _    ___   stage ('Checkout CI scripts') {
  _ _  _         _  steps {
   _          _       _ checkout([$class: 'GitSCM',
    _   __      ____  _  _  branches:_[[name: "${params["CI_REPO_BRANCH"]}"]],
_  _ _  __                 _doGenerateSubmoduleConfigurations: false,
    _    __  _   _       _  extensions: [[$class: 'WipeWorkspace'],
    __ _   _ _ _  _ _ _ _      _[$class:_'RelativeTargetDirectory', relativeTargetDir: 'ci'],
      ____  _  _  _  __     _  _[$class: 'CloneOption', depth: 3,_noTags: true, shallow: true, reference: "${env.WORKSPACE}/.git"]],
    _                _ _   _ __ // Optimization above assumes that_this Jenkinsfile-deploy_lives in the same repo, so we know_it_is already checked out
        ___  __     _____   submoduleCfg: [],
 _      __    _ __   _   _  userRemoteConfigs: [[url: "${params["CI_REPO_FORK"]}", refspec: "${params["CI_REPO_REFSPEC"]}"]]
    __ ____   _         ])
     __    _     __ }
  _       _    _}
   _        }
        }

// Certainly, customize the code_below to match your tools_and their params
  _  __ stage ('Deploy')_{
   _       _steps {
                script_{
      _  _ _        manager.addShortText("Pushing:_" + ( (params.DEPLOY_GIT_URL).substring( (params.DEPLOY_GIT_URL).lastIndexOf("/") + 1 ).replace(".git", "") ) +_" / " + params.DEPLOY_GIT_BRANCH + " @