keyrequest_monitor/jenkinsfile

85 lines
2.7 KiB
Plaintext

//not required right now as CN is reachable from EMEA as well
pipeline {
options {
ansiColor('xterm')
}
agent {label 'jaws-slaves'}
triggers {
cron('0 1 * * 1')
}
environment {
//ProxySettings
AUTH = credentials('proxy')
proxy_user = "${AUTH_USR}"
proxy_pw = "${AUTH_PSW}"
EUPROD_TOKEN_VAR = credentials('EUPROD_TOKEN_VAR')
EUPREPROD_TOKEN_VAR = credentials('EUPREPROD_TOKEN_VAR')
NAPROD_TOKEN_VAR = credentials('NAPROD_TOKEN_VAR')
NAPREPROD_TOKEN_VAR = credentials('NAPREPROD_TOKEN_VAR')
CNPROD_TOKEN_VAR = credentials('CNPROD_TOKEN_VAR')
CNPREPROD_TOKEN_VAR = credentials('CNPREPROD_TOKEN_VAR')
BITBUCKET_CREDS = credentials('jaws_dynatrace_bitbuket_user')
// FROM_DATE="${params.FROMDATE}"
// TO_DATE="${params.TODATE}"
}
stages {
stage('install required python packages') {
steps {
sh """
pip3 install git+https://${BITBUCKET_CREDS}@atc.bmwgroup.net/bitbucket/scm/opapm/keyrequestparser.git
pip3 install -r requirements.txt
"""
}
}
stage('Execute Reporting Script') {
steps {
script{
sh "python3 createKeyRequestReport.py"
}
}
}
stage('Send report') {
steps {
script {
try {
tmp_body = "Please find the output of the weekly KeyRequests-Report attached </br></br>"
emailext subject: env.JOB_NAME,
mimeType: 'text/html',
body: tmp_body,
to: 'omt-xibix@list.bmw.com, mohammed.abadel@bmw.de , Andreas.DB.Danzer@bmwgroup.com, Ermis.Wieger@nttdata.com',
//to: 'ermis.wieger@nttdata.com',
replyTo: 'coco-apm@bmw.de',
attachmentsPattern: '*.xlsx'
}
catch ( mailExc ){
echo "Sending Email Failed: ${mailExc}"
}
}
}
}
}
post {
failure {
emailext subject: "${env.JOB_NAME} build ${env.BUILD_ID} failed",
body: "QM report failed, see logs for details: ${env.BUILD_URL}",
to: 'ops-xibix@list.bmw.com, omo-xibix@list.bmw.com, omo@bmwgroup.com, Ermis.Wieger@nttdata.com, '
}
always {
cleanWs()
}
}
}