From 7e0e21c85502244173dc4362b247f0112c0585da Mon Sep 17 00:00:00 2001 From: Aleksi Hietanen Date: Wed, 2 Nov 2016 14:25:11 +0200 Subject: [PATCH] Improve script GenerateBuildTestAndStagingReport Change-Id: I3107f7fbbaf8cc17020b8e2cc9cf6a5f7f328c50 --- scripts/GenerateBuildTestAndStagingReport.py | 131 ++++++++++--------- 1 file changed, 66 insertions(+), 65 deletions(-) diff --git a/scripts/GenerateBuildTestAndStagingReport.py b/scripts/GenerateBuildTestAndStagingReport.py index 7b69b9825b..dadc4d0ac0 100644 --- a/scripts/GenerateBuildTestAndStagingReport.py +++ b/scripts/GenerateBuildTestAndStagingReport.py @@ -1,47 +1,61 @@ +from BuildDemos import demos import argparse, requests, json, subprocess, re -def createTableRow(*columns): - html = "" - for column in columns: - html += "" + column + "" - return html + "" +parser = argparse.ArgumentParser() +parser.add_argument("version", type=str, help="Vaadin version that was just built") +parser.add_argument("deployUrl", type=str, help="Base url of the deployment server") +parser.add_argument("buildResultUrl", type=str, help="URL for the build result page") +parser.add_argument("teamcityUser", type=str, help="Teamcity username to use") +parser.add_argument("teamcityPassword", type=str, help="Password for given teamcity username") + +parser.add_argument("teamcityUrl", type=str, help="Address to the teamcity server") +parser.add_argument("buildId", type=str, help="ID of the build to generate this report for") + +parser.add_argument("frameworkRepoUrl", type=str, help="URL to the framework staging repository") +parser.add_argument("archetypeRepoUrl", type=str, help="URL to the archetype staging repository") +parser.add_argument("pluginRepoUrl", type=str, help="URL to the plugin staging repository") +args = parser.parse_args() + +def createTableRow(*columns): + html = "" + for column in columns: + html += "" + column + "" + return html + "" def getBuildStatusHtml(): - build_steps_request_string = "http://{}/app/rest/problemOccurrences?locator=build:{}".format(args.teamcityUrl, args.buildId) - build_steps_request = requests.get(build_steps_request_string, auth=(args.teamcityUser, args.teamcityPassword), headers={'Accept':'application/json'}) - if build_steps_request.status_code != 200: - return createTableRow(traffic_light.format(color="black"), "Build status: unable to retrieve status of build") - else: - build_steps_json = build_steps_request.json() - if build_steps_json["count"] == 0: - return createTableRow(traffic_light.format(color="green"), "Build status: all build steps successful") - else: - return createTableRow(traffic_light.format(color="red"), "Build status: there are failing build steps, check the build report".format(args.buildResultUrl)) + build_steps_request_string = "http://{}/app/rest/problemOccurrences?locator=build:{}".format(args.teamcityUrl, args.buildId) + build_steps_request = requests.get(build_steps_request_string, auth=(args.teamcityUser, args.teamcityPassword), headers={'Accept':'application/json'}) + if build_steps_request.status_code != 200: + return createTableRow(traffic_light.format(color="black"), "Build status: unable to retrieve status of build") + else: + build_steps_json = build_steps_request.json() + if build_steps_json["count"] == 0: + return createTableRow(traffic_light.format(color="green"), "Build status: all build steps successful") + else: + return createTableRow(traffic_light.format(color="red"), "Build status: there are failing build steps, check the build report".format(args.buildResultUrl)) def getTestStatusHtml(): - test_failures_request_string = "http://{}/app/rest/testOccurrences?locator=build:{},status:FAILURE".format(args.teamcityUrl, args.buildId) - test_failures_request = requests.get(test_failures_request_string, auth=(args.teamcityUser, args.teamcityPassword), headers={'Accept':'application/json'}) - if test_failures_request.status_code != 200: - return createTableRow(traffic_light.format(color="black"), "Test status: unable to retrieve status of tests") - else: - test_failures_json = test_failures_request.json() - if test_failures_json["count"] == 0: - return createTableRow(traffic_light.format(color="green"), "Test status: all tests passing") - else: - return createTableRow(traffic_light.format(color="red"), "Test status: there are " + str(test_failures_json["count"]) + " failing tests") -""" - if "testOccurrence" in test_failures_json: - ret += "

Failures:" - ret += "