Compare commits

...

10 Commits

Author SHA1 Message Date
Doris Ruppert (ext.) 541659b470 don't start cron job as this branch is currently not used 2023-02-01 09:32:15 +00:00
PATRYK GUDALEWICZ (ext.) fd85d1b125 TZ and "evaluate" fix 2022-11-15 11:16:41 +00:00
Doris Ruppert (ext.) adb5a5f598 OPMAAS-2594 2022-11-15 10:04:28 +00:00
Andreas Danzer (DE-701) d17e4d5ef5 Jenkinsfile online editiert mit Bitbucket
Added my Email
2022-08-05 10:19:47 +02:00
Rene Forstner (ext.) 7c227b2280 Jenkinsfile edited online with Bitbucket 2022-04-29 12:48:41 +02:00
Rene Forstner (ext.) b238d41526 Jenkinsfile edited online with Bitbucket 2022-02-04 09:07:26 +01:00
rforstner fda5ab5a80 adaptions due to faulty jenkins slave 2022-01-31 09:02:18 +01:00
rforstner 7f1f8624a3 adaptions due to faulty jenkins slave 2022-01-31 09:01:09 +01:00
rforstner cbf2c687d1 adaptions due to faulty jenkins slave 2022-01-31 08:37:01 +01:00
rforstner 31a40bc595 adapted script 2022-01-26 12:31:38 +01:00
3 changed files with 35 additions and 18 deletions

38
Jenkinsfile vendored
View File

@ -22,7 +22,7 @@
ansiColor('xterm')
}
//label libraryBuild is available in CN JAWS and ROW JAWS, therefore this one was used; no additional intents
agent {label 'libraryBuild'}
agent {label 'jaws-slaves'}
parameters {
string(name: 'FROMDATE', defaultValue: '', description: 'Enter from date in format YYYY-MM-DD e.g. 2021-11-01')
@ -32,13 +32,14 @@
//here comes the trigger according to crontabs - jenkins is in UTC
triggers {
//every 1st of every month at 00:00
//cron('0 0 1 * *')
// currently this branch is not used, so dont start it at all
// cron('0 0 1 * *')
//every day at 08:00
//cron('0 8 * * *')
//every monday at 08:00
cron('0 8 * * 1')
//cron('0 8 * * 1')
}
@ -47,12 +48,12 @@
AUTH = credentials('proxy')
proxy_user = "${AUTH_USR}"
proxy_pw = "${AUTH_PSW}"
http_proxy="http://${proxy_user}:${proxy_pw}@proxy.muc:8080"
https_proxy="http://${proxy_user}:${proxy_pw}@proxy.muc:8080"
no_proxy="localhost,127.0.0.1,.muc,.bmwgroup.net"
HTTP_PROXY="${http_proxy}"
HTTPS_PROXY="${https_proxy}"
NO_PROXY="${no_proxy}"
//http_proxy="http://${proxy_user}:${proxy_pw}@proxy.muc:8080"
//https_proxy="http://${proxy_user}:${proxy_pw}@proxy.muc:8080"
//no_proxy="localhost,127.0.0.1,.muc,.bmwgroup.net"
//HTTP_PROXY="${http_proxy}"
//HTTPS_PROXY="${https_proxy}"
//NO_PROXY="${no_proxy}"
EUPROD_TOKEN_VAR = credentials('EUPROD_TOKEN_VAR')
EUPREPROD_TOKEN_VAR = credentials('EUPREPROD_TOKEN_VAR')
@ -76,7 +77,7 @@
stage('Execute Reporting Script') {
steps {
sh 'python createReport.py -p week'
sh 'python createReport.py -p month'
//Only required once CN is not reachable from EMEA
@ -90,8 +91,9 @@
try {
emailext subject: env.JOB_NAME,
body: 'Please find the output of the weekly QM-Report attached',
to: 'rene.forstner@nttdata.com',
//to: 'rene.forstner@nttdata.com, stephan.oertelt@bmw.de, Mohammed.Abadel@bmw.de, OOC-Support@bmwgroup.com, Sonja.Yildizoglu@bmw.de, Andreas.DA.Danzer@partner.bmw.de',
//to: 'rene.forstner@nttdata.com',
//to: 'rene.forstner@nttdata.com, stephan.oertelt@bmw.de, Mohammed.Abadel@bmw.de, OOC-Support@bmwgroup.com, Sonja.Yildizoglu@bmw.de, Andreas.DA.Danzer@partner.bmw.de',
to: 'rene.forstner@nttdata.com, stephan.oertelt@bmw.de, Mohammed.Abadel@bmw.de, andreas.db.danzer@bmwgroup.com',
replyTo: 'coco-apm@bmw.de',
attachmentsPattern: '*.xlsx'
@ -105,8 +107,18 @@
}
post {
failure {
emailext subject: "${env.JOB_NAME} build ${env.BUILD_ID} failed",
body: "QM report failed, see logs for details: ${env.BUILD_URL}",
to: 'BMW.CoCo.Dynatrace@nttdata.com, ermis.wieger@nttdata.com, Andreas.DB.Danzer@bmwgroup.com'
// to post to the teams channel "0 - APM Service Desk" just uncomment the following command:
// office365ConnectorSend webhookUrl: "https://bmwgroup.webhook.office.com/webhookb2/483edc00-c925-4672-8088-8299a0139fca@ce849bab-cc1c-465b-b62e-18f07c9ac198/JenkinsCI/9aca6923685b40f794134853fcbe88f1/ff31bcee-96b3-4481-9bd8-4f74180b263b",
// message: "QM report failed, see logs for details: ${env.BUILD_URL}",
// status: 'Failure',
// color: "d00000"
}
always {
cleanWs()
}
}
}
}

View File

@ -7,7 +7,10 @@ import pandas as pd
import requests
import openpyxl
import argparse
import os
os.environ['TZ'] = 'Europe/Berlin' # set new timezone
time.tzset()
def make_request(url, headers,verify,parameters):
try:
response = requests.get(url, headers=headers,verify=verify,params=parameters)
@ -40,6 +43,8 @@ def getSLO(DTAPIToken, DTENV, fromDate, toDate):
if (DTENV.find('dynatracemgd') != -1):
verify=False
if (DTENV.find('dyna-synt') != -1):
verify=False
else:
verify=True
@ -54,7 +59,7 @@ def getSLO(DTAPIToken, DTENV, fromDate, toDate):
"from": int(fromDate),
"to": int(toDate),
"timeFrame": "GTF",
"evaluate": True,
"evaluate": "true",
"sloSelector": "text(\"CoCo-QM-Report\")"
}
r = make_request(DTAPIURL,headers=headers,parameters=parameters,verify=verify)
@ -69,7 +74,7 @@ def getSLO(DTAPIToken, DTENV, fromDate, toDate):
print(e)
print("No SLO json returned")
print(parameters)
print(r.content)
print(r)
df = pd.DataFrame()
@ -225,11 +230,11 @@ def main():
dailyall = dailyall[dailyall['Touchpoint'].isin(touchpoints)]
totalall = totalall[totalall['Touchpoint'].isin(touchpoints)]
writer = pd.ExcelWriter("./QM_Report.xlsx")
writer = pd.ExcelWriter("./QM_Report_" + str(fromDate.isocalendar()[1]) + ".xlsx")
totalall.to_excel(writer, sheet_name='total')
dailyall.to_excel(writer, sheet_name='daily')
writer.save()
writer.close()
if __name__ == "__main__":
main()
main()

View File

@ -20,7 +20,7 @@ naprod:
- jenkins: "https://jaws.bmwgroup.net/opapm/"
cnprod:
- name: "cnprod"
- env-url: "https://dynatracemgd-tsp.bmwgroup.net/e/b921f1b9-c00e-4031-b9d1-f5a0d530757b"
- env-url: "https://dyna-synth-cn.bmwgroup.com.cn/e/b921f1b9-c00e-4031-b9d1-f5a0d530757b"
- env-token-name: "CNPROD_TOKEN_VAR"
- jenkins: "https://jaws-china.bmwgroup.net/opmaas/"
#cnpreprod: