From b85f6e4bdc49d9ea8693239fa15d1f2f239f85cf Mon Sep 17 00:00:00 2001 From: Aleksi Hietanen Date: Fri, 4 Nov 2016 15:00:31 +0200 Subject: [PATCH] Create script GeneratePostPublishReport.py Also improves GenerateBuildTestAndStagingReport and GeneratePublishReportPart1 Change-Id: Ida5a004e6d4533dc04a8e7ffc76078f970bdd2ea --- scripts/GenerateBuildTestAndStagingReport.py | 28 ++++----- scripts/GeneratePostPublishReport.py | 65 ++++++++++++++++++++ scripts/GeneratePublishReportPart1.py | 18 +++--- 3 files changed, 88 insertions(+), 23 deletions(-) create mode 100644 scripts/GeneratePostPublishReport.py diff --git a/scripts/GenerateBuildTestAndStagingReport.py b/scripts/GenerateBuildTestAndStagingReport.py index 226493ee1c..16abd340ae 100644 --- a/scripts/GenerateBuildTestAndStagingReport.py +++ b/scripts/GenerateBuildTestAndStagingReport.py @@ -4,12 +4,12 @@ import argparse, requests, json, subprocess, re, pickle 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("buildTypeId", type=str, help="The ID of this build step") 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") @@ -17,6 +17,8 @@ parser.add_argument("archetypeRepoUrl", type=str, help="URL to the archetype sta parser.add_argument("pluginRepoUrl", type=str, help="URL to the plugin staging repository") args = parser.parse_args() +buildResultUrl = "http://{}/viewLog.html?buildId={}&tab=buildResultsDiv&buildTypeId={}".format(args.teamcityUrl, args.buildId, args.buildTypeId) + def createTableRow(*columns): html = "" for column in columns: @@ -39,7 +41,7 @@ def getBuildStatusHtml(): 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)) + return createTableRow(traffic_light.format(color="red"), "Build status: there are failing build steps, check the build report".format(buildResultUrl)) def getTestStatusHtml(): test_failures_request_string = "http://{}/app/rest/testOccurrences?locator=build:{},status:FAILURE".format(args.teamcityUrl, args.buildId) @@ -51,7 +53,7 @@ def getTestStatusHtml(): 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, see report.".format(args.buildId)) + return createTableRow(traffic_light.format(color="red"), "Test status: there are " + str(test_failures_json["count"]) + " failing tests, check the build report".format(buildResultUrl)) def getDemoValidationStatusHtml(): status = pickle.load(open("result/demo_validation_status.pickle", "rb")) @@ -74,7 +76,7 @@ def getApiDiffHtml(): "compatibility-shared", "server", "shared" ] - link_list = list(map(lambda module: "
  • {}
  • ".format(args.buildId, module, module), modules)) + link_list = list(map(lambda module: "{}".format(args.teamcityUrl, args.buildTypeId, args.buildId, module, module), modules)) return apidiff_html + getHtmlList(link_list) def getDirs(url): @@ -157,28 +159,22 @@ content += createTableRow("", "

    Manual checks before publishing

    ") content += createTableRow("", getDemoLinksHtml()) # link to release notes -content += createTableRow("", "Check release notes".format(args.buildId)) +content += createTableRow("", "Check release notes".format(args.teamcityUrl, args.buildTypeId, args.buildId)) # link to api diff content += createTableRow("", getApiDiffHtml()) -# closed fixed tickets without a milestone -content += createTableRow("", "Closed fixed tickets without milestone {version}".format(version=args.version)) -# closed tickets with milestone -content += createTableRow("", "Closed tickets with milestone {version}".format(version=args.version)) -# pending release tickets with milestone -content += createTableRow("", "Pending-release tickets with milestone {version}".format(version=args.version)) +# check that trac tickets are in the correct status +content += createTableRow("", "Check that trac tickets have correct status") # pending release tickets without milestone content += createTableRow("", "Pending-release tickets without milestone") content += createTableRow("", "

    Preparations before publishing

    ") -# create milestone for next release -content += createTableRow("", "Create milestone for next release") # close trac milestone -content += createTableRow("", "Close Trac Milestone".format(version=args.version)) +content += createTableRow("", "Close Trac Milestone (deselect \"retarget tickets\")".format(version=args.version)) # verify pending release tickets still have milestone content += createTableRow("", "Verify pending release tickets still have milestone {version}".format(version=args.version)) -# add version to trac -content += createTableRow("", "Add version {version} to Trac".format(version=args.version)) +# link to build dependencies tab to initiate publish step +content += createTableRow("", "

    Start Publish Release from dependencies tab

    ".format(args.teamcityUrl, args.buildId, args.buildTypeId)) content += "" f = open("result/report.html", 'w') diff --git a/scripts/GeneratePostPublishReport.py b/scripts/GeneratePostPublishReport.py new file mode 100644 index 0000000000..782729bc92 --- /dev/null +++ b/scripts/GeneratePostPublishReport.py @@ -0,0 +1,65 @@ +import argparse, requests + +parser = argparse.ArgumentParser(description="Post-publish report generator") +parser.add_argument("version", type=str, help="Vaadin version that was just built") +parser.add_argument("teamcityUrl", type=str, help="Address to the teamcity server") +parser.add_argument("buildTypeId", type=str, help="The ID of this build step") +parser.add_argument("buildId", type=str, help="ID of the build to generate this report for") +parser.add_argument("projectId", type=str, help="The ID of this project") +args = parser.parse_args() + +buildResultUrl = "http://{}/viewLog.html?buildId={}&tab=buildResultsDiv&buildTypeId={}".format(args.teamcityUrl, args.buildId, args.buildTypeId) + +(major, minor, maintenance) = args.version.split(".", 2) +prerelease = "." in maintenance + +def createTableRow(*columns): + html = "" + for column in columns: + html += "" + column + "" + return html + "" + +traffic_light = "" + +content = "" + +# Batch update tickets in trac +content += createTableRow("", "Batch update tickets in Trac") + +# Create milestone for next release +content += createTableRow("", "Create milestone for next release") + +# Tag and pin build +content += createTableRow("", "Tag and pin build".format(url=buildResultUrl)) + +# Traffic light for archetype metadata +archetypeMetadataUrl = "" +if not prerelease: + archetypeMetadataUrl = "http://vaadin.com/download/maven-archetypes.xml" +else: + archetypeMetadataUrl ="http://vaadin.com/download/maven-archetypes-prerelease.xml" + +archetype_metadata_request = requests.get(archetypeMetadataUrl) +if archetype_metadata_request.status_code != 200: + content += createTableRow(traffic_light.format(color="black"), "Check archetype metadata: unable to retrieve metadata".format(url=archetypeMetadataUrl)) +else: + if "version=\"{version}\"".format(version=args.version) in archetype_metadata_request.content: + content += createTableRow(traffic_light.format(color="green"), "Check archetype metadata: metadata is correct".format(url=archetypeMetadataUrl)) + else: + content += createTableRow(traffic_light.format(color="red"), "Check archetype metadata: metadata is incorrect".format(url=archetypeMetadataUrl)) + +# TODO GitHub milestones + +# Inform marketing and PO +content += createTableRow("", "Inform marketing and PO about the release") + +# Link to version update in teamcity +content += createTableRow("", "Update vaadin.version.latest and vaadin.version.next parameters in TeamCity".format(args.teamcityUrl, args.projectId)) + +# Link to GH release notes +content += createTableRow("", "Write release notes in GH") + +content += "
    " + +with open("result/report.html", "wb") as f: + f.write(content) diff --git a/scripts/GeneratePublishReportPart1.py b/scripts/GeneratePublishReportPart1.py index beedcb5b82..5f69c08384 100644 --- a/scripts/GeneratePublishReportPart1.py +++ b/scripts/GeneratePublishReportPart1.py @@ -19,8 +19,9 @@ metadataChecks = { parser = argparse.ArgumentParser(description="Post-publish report generator") parser.add_argument("version", type=str, help="Vaadin version that was just built") -parser.add_argument("buildResultUrl", type=str, help="URL for the build result page") - +parser.add_argument("teamcityUrl", type=str, help="Address to the teamcity server") +parser.add_argument("buildTypeId", type=str, help="The ID of this build step") +parser.add_argument("buildId", type=str, help="ID of the build to generate this report for") args = parser.parse_args() traffic_light = "" @@ -68,11 +69,15 @@ content = """ {downloadPageOk}Download folder on vaadin.com contains the version """.format(metadataOk=getTrafficLight(metadataOk), tagOk=getTrafficLight(tagOk), downloadPageOk=getTrafficLight(downloadPageOk)) +mavenUrl = "" if not prerelease: - content += "Check {ver} is published to maven.org (might take a while)".format(ver=args.version) + mavenUrl = "http://repo1.maven.org/maven2/com/vaadin/vaadin-server/{ver}".format(ver=args.version) + content += "Check {ver} is published to maven.org (might take a while)".format(ver=args.version, mvnUrl=mavenUrl) else: - content += "Check {ver} is published as prerelease to maven.vaadin.com".format(ver=args.version) + mavenUrl = "http://maven.vaadin.com/vaadin-prereleases/com/vaadin/vaadin-server/{ver}".format(ver=args.version) + content += "Check {ver} is published as prerelease to maven.vaadin.com".format(ver=args.version, mvnUrl=mavenUrl) +content += "Add version {version} to Trac".format(version=args.version) if not prerelease: content += 'Set latest version to default' @@ -85,11 +90,10 @@ if not prerelease: content += 'Verify API version list updated' content += """ -Batch update tickets in Trac -Publish result page (See test results, pin and tag build and dependencies) +

    Start Post-Publish Release from dependencies tab -""".format(url=args.buildResultUrl, version=args.version) +""".format(teamcityUrl=args.teamcityUrl, buildTypeId=args.buildTypeId, buildId=args.buildId, version=args.version) f = open("result/report.html", 'w') f.write(content) -- 2.39.5