This Jenkins Custom Step provides parameterised set of steps which…
Checks out the specified Compliance repository
Invokes the MettleCI compliance test command test your repository's DataStage assets against your Compliance rules
Publishes the generated JUnit Compliance results back to your Jenkins Controller.
def call( def COMPLIANCE_REPO_CREDENTIALS, def COMPLIANCE_REPO_URL, def RULESDIR, def TESTSUITENAME, def CONTINUEONFAIL ) { try { // Perform a 'git checkout' of a remote repository which is NOT the repository from which this pipeline code was sourced checkout([ $class: 'GitSCM', branches: [[name: 'refs/heads/master']], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: 'compliance2']], submoduleCfg: [], userRemoteConfigs: [[ credentialsId: "${COMPLIANCE_REPO_CREDENTIALS}", url: "${COMPLIANCE_REPO_URL}" ]] ]) /* Executes the 'mettleci compliance test' command to test your repository's DataStage jobs against your Compliance rules. Note that 'mettleci compliance test' is mnot the same as 'mettleci compliance query' - See the documentation for more details. */ bat label: "Compliance Test - ${TESTSUITENAME}", script: """ %AGENTMETTLECMD% compliance test ^ -assets datastage ^ -report \"compliance_report_${TESTSUITENAME}.xml\" ^ -junit -test-suite \"${TESTSUITENAME}\" ^ ${((CONTINUEONFAIL as boolean) == true)? '-ignore-test-failures':''} ^ -rules compliance2\\${RULESDIR} ^ -project-cache \"%AGENTMETTLEHOME%\\cache\\%IISENGINENAME%\\%DATASTAGE_PROJECT%\" """ junit testResults: "compliance_report_${TESTSUITENAME}.xml", allowEmptyResults: true, skipMarkingBuildUnstable: (CONTINUEONFAIL as boolean) } catch(e) { junit testResults: "compliance_report_${TESTSUITENAME}.xml", allowEmptyResults: true, skipMarkingBuildUnstable: (CONTINUEONFAIL as boolean) throw e } }