#coding=UTF-8 try: import requests except Exception as e: print("GeneratePublishReportPart1 depends on requests library. Install it with `pip install requests`") sys.exit(1) import argparse, cgi, re from os.path import exists, isdir from os import makedirs metadataChecks = { 'https://vaadin.com/download/LATEST7': '^7\..*', 'https://vaadin.com/download/VERSIONS_7': '^7\..*', 'https://vaadin.com/download/release/7.7/LATEST': '^7\..*', 'https://vaadin.com/download/LATEST': '^6\..*', 'https://vaadin.com/download/PRERELEASES': '^{ver}' } 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") args = parser.parse_args() traffic_light = "" def getTrafficLight(b): return traffic_light.format(color="green") if b else traffic_light.format(color="red") resultPath = "result" if not exists(resultPath): makedirs(resultPath) elif not isdir(resultPath): print("Result path is not a directory.") sys.exit(1) (major, minor, maintenance) = args.version.split(".", 2) prerelease = "." in maintenance if prerelease: maintenance = maintenance.split('.')[0] def checkUrlContents(url, regexp): r = requests.get(url) return re.match(regexp, r.text) != None def checkUrlStatus(url): r = requests.get(url) return r.status_code == 200 metadataOk = True for url in metadataChecks: metadataOk = metadataOk and checkUrlContents(url, metadataChecks[url].format(ver=args.version)) tagOk = checkUrlStatus("https://github.com/vaadin/framework/releases/tag/{ver}".format(ver=args.version)) if not prerelease: downloadPageOk = checkUrlStatus("https://vaadin.com/download/release/{maj}.{min}/{ver}/".format(maj=major, min=minor, ver=args.version)) else: downloadPageOk = checkUrlStatus("https://vaadin.com/download/prerelease/{maj}.{min}/{maj}.{min}.{main}/{ver}".format(maj=major, min=minor, main=maintenance, ver=args.version)) content = """
{metadataOk} | Metadata ok on vaadin.com |
{downloadPageOk} | Download folder on vaadin.com contains the version |
Check {ver} is published to maven.org (might take a while) | |
Check {ver} is published as prerelease to maven.vaadin.com | |
Create milestone for next version in GitHub | |
Verify uploaded to test.vaadin.com | |
Verify API version list updated | |
Start Post-Publish Release from dependencies tab |