Compare commits

..

No commits in common. "9a8e3a2032a2baaf49ebec8548cca8565c5f5842" and "8785c3bd5987210565caa3e18c09c1e3eca06264" have entirely different histories.

2 changed files with 6 additions and 26 deletions

8
Jenkinsfile vendored
View File

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

View File

@ -1,3 +1,4 @@
from html import entities
from decouple import config
import yaml
import requests
@ -55,31 +56,12 @@ 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={'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"]})
row={'Kubernetes Tag':kubernetesttagval["stringRepresentation"],'AppId':appidtagval["value"],'AppName':appnametagval["value"],'CompassId':compassidtagval["value"],'MsId':msidtagval["value"],'ServiceName':entity['displayName'],'ServiceId':entity['entityId']}
mgmt = mgmt.append(row,ignore_index=True)
mgmt.to_csv(friendlyName + '_TaggedEntities_' + strnow +'.csv',encoding='utf-8')