LYN-4745 ci_build_metrics doesnt distinguish between different repo (#1496)

* add repository to ci_build_metrics

* fixing build

* changing the job to pass the right parameters

* passing parameters that need to be expanded

* missed this, important

* fixing typo
main
Esteban Papp 5 years ago committed by GitHub
parent b88d87a590
commit 78b8daa783
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -458,6 +458,7 @@ try {
repositoryUrl = scm.getUserRemoteConfigs()[0].getUrl()
// repositoryName is the full repository name
repositoryName = (repositoryUrl =~ /https:\/\/github.com\/(.*)\.git/)[0][1]
env.REPOSITORY_NAME = repositoryName
(projectName, pipelineName) = GetRunningPipelineName(env.JOB_NAME) // env.JOB_NAME is the name of the job given by Jenkins
if(env.BRANCH_NAME) {
@ -468,7 +469,7 @@ try {
}
pipelineProperties.add(disableConcurrentBuilds())
echo "Running \"${pipelineName}\" for \"${branchName}\"..."
echo "Running repository: \"${repositoryName}\", pipeline: \"${pipelineName}\", branch: \"${branchName}\"..."
CheckoutBootstrapScripts(branchName)

@ -22,7 +22,7 @@
"COMMAND":"../Windows/python_windows.cmd",
"PARAMETERS": {
"SCRIPT_PATH":"scripts/build/ci_build_metrics.py",
"SCRIPT_PARAMETERS":"--platform Android --jobname \"!JOB_NAME!\" --jobnumber \"!BUILD_NUMBER!\" --jobnode \"!NODE_NAME!\" --changelist \"!CHANGE_ID!\""
"SCRIPT_PARAMETERS":"--platform=Android --repository=!REPOSITORY_NAME! --jobname=!JOB_NAME! --jobnumber=!BUILD_NUMBER! --jobnode=!NODE_LABEL! --changelist=!CHANGE_ID!"
}
},
"debug": {

@ -24,7 +24,7 @@
"COMMAND": "python_linux.sh",
"PARAMETERS": {
"SCRIPT_PATH": "scripts/build/ci_build_metrics.py",
"SCRIPT_PARAMETERS": "--platform Linux --jobname '${JOB_NAME}' --jobnumber '${BUILD_NUMBER}' --jobnode '${NODE_NAME}' --changelist '${CHANGE_ID}'"
"SCRIPT_PARAMETERS": "--platform=Linux --repository=${REPOSITORY_NAME} --jobname=${JOB_NAME} --jobnumber=${BUILD_NUMBER} --jobnode=${NODE_LABEL} --changelist=${CHANGE_ID}"
}
},
"debug": {

@ -12,5 +12,5 @@
set -o errexit # exit on the first failure encountered
echo [ci_build] python/python.sh -u ${SCRIPT_PATH} ${SCRIPT_PARAMETERS}
python/python.sh -u ${SCRIPT_PATH} ${SCRIPT_PARAMETERS}
echo [ci_build] python/python.sh -u ${SCRIPT_PATH} $(eval echo ${SCRIPT_PARAMETERS})
python/python.sh -u ${SCRIPT_PATH} $(eval echo ${SCRIPT_PARAMETERS})

@ -24,7 +24,7 @@
"COMMAND": "python_mac.sh",
"PARAMETERS": {
"SCRIPT_PATH": "scripts/build/ci_build_metrics.py",
"SCRIPT_PARAMETERS": "--platform Mac --jobname '${JOB_NAME}' --jobnumber '${BUILD_NUMBER}' --jobnode '${NODE_NAME}' --changelist '${CHANGE_ID}'"
"SCRIPT_PARAMETERS": "--platform=Mac --repository=${REPOSITORY_NAME} --jobname=${JOB_NAME} --jobnumber=${BUILD_NUMBER} --jobnode=${NODE_LABEL} --changelist=${CHANGE_ID}"
}
},
"debug": {

@ -12,5 +12,5 @@
set -o errexit # exit on the first failure encountered
echo [ci_build] python/python.sh -u ${SCRIPT_PATH} ${SCRIPT_PARAMETERS}
python/python.sh -u ${SCRIPT_PATH} ${SCRIPT_PARAMETERS}
echo [ci_build] python/python.sh -u ${SCRIPT_PATH} $(eval echo ${SCRIPT_PARAMETERS})
python/python.sh -u ${SCRIPT_PATH} $(eval echo ${SCRIPT_PARAMETERS})

@ -56,7 +56,7 @@
"COMMAND": "python_windows.cmd",
"PARAMETERS": {
"SCRIPT_PATH": "scripts/build/ci_build_metrics.py",
"SCRIPT_PARAMETERS": "--platform Windows --jobname \"!JOB_NAME!\" --jobnumber \"!BUILD_NUMBER!\" --jobnode \"!NODE_NAME!\" --changelist \"!CHANGE_ID!\""
"SCRIPT_PARAMETERS": "--platform=Windows --repository=!REPOSITORY_NAME! --jobname=!JOB_NAME! --jobnumber=!BUILD_NUMBER! --jobnode=!NODE_LABEL! --changelist=!CHANGE_ID!"
}
},
"windows_packaging_all": {

@ -14,7 +14,7 @@
"COMMAND": "../Mac/python_mac.sh",
"PARAMETERS": {
"SCRIPT_PATH": "scripts/build/ci_build_metrics.py",
"SCRIPT_PARAMETERS": "--platform iOS --jobname '${JOB_NAME}' --jobnumber '${BUILD_NUMBER}' --jobnode '${NODE_NAME}' --changelist '${CHANGE_ID}'"
"SCRIPT_PARAMETERS": "--platform=iOS --repository=${REPOSITORY_NAME} --jobname=${JOB_NAME} --jobnumber=${BUILD_NUMBER} --jobnode=${NODE_LABEL} --changelist=${CHANGE_ID}"
}
},
"debug": {

@ -38,6 +38,7 @@ def parse_args():
cur_dir = os.path.dirname(os.path.abspath(__file__))
parser = argparse.ArgumentParser()
parser.add_argument('-p', '--platform', dest="platform", help="Platform to gather metrics for")
parser.add_argument('-r', '--repository', dest="repository", help="Repository to gather metrics for")
parser.add_argument('-a', '--jobname', dest="jobname", default="unknown", help="Name/tag of the job in the CI system (used to track where the report comes from, constant through multiple runs)")
parser.add_argument('-u', '--jobnumber', dest="jobnumber", default=-1, help="Number of run in the CI system (used to track where the report comes from, variable through runs)")
parser.add_argument('-o', '--jobnode', dest="jobnode", default="unknown", help="Build node name (used to track where the build happened in CI systems where the same jobs run in different hosts)")
@ -211,6 +212,7 @@ def prepare_metrics(args, build_metrics):
'changelist': args.changelist,
'job': {'name': args.jobname, 'number': args.jobnumber, 'node': args.jobnode},
'platform': args.platform,
'repository': args.repository,
'build_types': build_metrics,
'timestamp': timestamp.strftime("%Y-%m-%dT%H:%M:%S")
}
@ -240,6 +242,7 @@ def submit_report_document(report_file):
'changelist': report_json['changelist'],
'job': report_json['job'],
'platform': report_json['platform'],
'repository': report_json['repository'],
'type': build_type['build_type'],
'result': int(build_type['result']) or int(build_metric['result']),
'reason': build_type['reason'],
@ -259,8 +262,9 @@ def submit_report_document(report_file):
if __name__ == "__main__":
args = parse_args()
print(f"[ci_build_metrics] Generatic build metrics for:"
print(f"[ci_build_metrics] Generating build metrics for:"
f"\n\tPlatform: {args.platform}"
f"\n\tRepository: {args.repository}"
f"\n\tJob Name: {args.jobname}"
f"\n\tJob Number: {args.jobnumber}"
f"\n\tJob Node: {args.jobnode}"

Loading…
Cancel
Save