keyrequest_monitor/jenkinsfile

83 lines
2.4 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')
// FROM_DATE="${params.FROMDATE}"
// TO_DATE="${params.TODATE}"
}
stages {
stage('install required python packages') {
steps {
sh '''
pip3 install --user -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: 'ermis.wieger@nttdata.com, Andreas.DB.Danzer@bmwgroup.com, Mohammed.Abadel@bmw.de',
//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: 'ermis.wieger@nttdata.com'
}
always {
cleanWs()
}
}
}