Compare commits

..

10 Commits

Author SHA1 Message Date
Patryk Gudalewicz 9a8e3a2032 Fixed empty tag handling 2022-07-29 09:32:18 +02:00
Patryk Gudalewicz 324522e35d Changed cron 2022-07-29 09:25:57 +02:00
Patryk Gudalewicz 8aa612efaa Adding Patryk to recipients 2022-07-29 09:24:24 +02:00
Patryk Gudalewicz 54702310dc Cron expressions are now Branch related 2022-07-11 14:02:28 +02:00
Patryk Gudalewicz edb38e9a80 Updated recipients 2022-07-11 12:49:06 +02:00
Patryk Gudalewicz 1f4c9b7ed5 Added multiple Archetype tags support 2022-07-11 12:40:16 +02:00
Patryk Gudalewicz 99a9785c9b Added multiple Archetype tags support 2022-07-11 12:35:24 +02:00
Patryk Gudalewicz 341b3fd729 Added multiple Archetype tags support 2022-07-11 12:32:11 +02:00
Patryk Gudalewicz ca9ac774f6 Removed html import 2022-07-11 12:18:59 +02:00
Patryk Gudalewicz bd24c94834 Cron expression fixed 2022-07-11 12:16:13 +02:00
2 changed files with 26 additions and 6 deletions

8
Jenkinsfile vendored
View File

@ -34,7 +34,9 @@
//cron('0 8 * * *')
//every monday at 08:00
cron('0 8 * * MON')
//cron('0 8 * * 1')
//Branch related
cron(env.BRANCH_NAME == 'master' ? '0 8 * * 1' : '')
}
@ -85,8 +87,8 @@
try {
emailext subject: env.JOB_NAME,
body: 'Please find the output of your reports attached',
to: 'patryk.gudalewicz.bp@nttdata.com',
replyTo: 'patryk.gudalewicz.bp@nttdata.com',
to: 'peter.hh.huber@bmw.de, patryk.gudalewicz.bp@nttdata.com',
replyTo: 'coco-apm@bmw.de',
attachmentsPattern: '*.csv'
}

View File

@ -1,4 +1,3 @@
from html import entities
from decouple import config
import yaml
import requests
@ -56,12 +55,31 @@ def GatherReportingInfo(DTAPIToken, DTENV,friendlyName):
strnow = now.strftime("%Y%m%d_%H%M")
for entity in entityList:
if any(tag["stringRepresentation"].startswith('[Kubernetes]app.bmwgroup.com/') for tag in entity["tags"]):
kubernetesttagval = next((tag for tag in entity["tags"] if tag["stringRepresentation"].startswith('[Kubernetes]app.bmwgroup.com/')), None)
appidtagval = next((tag for tag in entity["tags"] if tag["stringRepresentation"].startswith('[Kubernetes]app-id')), None)
appnametagval = next((tag for tag in entity["tags"] if tag["stringRepresentation"].startswith('app-name')), None)
compassidtagval = next((tag for tag in entity["tags"] if tag["stringRepresentation"].startswith('compass-id')), None)
msidtagval = next((tag for tag in entity["tags"] if tag["stringRepresentation"].startswith('[Kubernetes]ms-id')), None)
row={'Kubernetes Tag':kubernetesttagval["stringRepresentation"],'AppId':appidtagval["value"],'AppName':appnametagval["value"],'CompassId':compassidtagval["value"],'MsId':msidtagval["value"],'ServiceName':entity['displayName'],'ServiceId':entity['entityId']}
row={'ServiceName':entity['displayName'],'ServiceId':entity['entityId']}
if appidtagval:
row.update({'AppId':appidtagval["value"]})
else:
row.update({'AppId':''})
if appnametagval:
row.update({'AppName':appnametagval["value"]})
else:
row.update({'AppName':''})
if compassidtagval:
row.update({'CompassId':compassidtagval["value"]})
else:
row.update({'CompassId':''})
if msidtagval:
row.update({'MsId':msidtagval["value"]})
else:
row.update({'MsId':''})
for kubetag in entity["tags"]:
if(kubetag["key"].startswith("app.bmwgroup.com/")):
row.update({kubetag["key"]:kubetag["value"]})
mgmt = mgmt.append(row,ignore_index=True)
mgmt.to_csv(friendlyName + '_TaggedEntities_' + strnow +'.csv',encoding='utf-8')