diff options
Diffstat (limited to 'scripts/BuildDemos.py')
-rw-r--r-- | scripts/BuildDemos.py | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/scripts/BuildDemos.py b/scripts/BuildDemos.py index 7870e743de..01fdf4d25b 100644 --- a/scripts/BuildDemos.py +++ b/scripts/BuildDemos.py @@ -9,7 +9,7 @@ # pip install requests # Deploy depends on .deployUrl and .deployCredentials files in home folder -import sys, os +import sys, os, pickle from os.path import join, isfile from fnmatch import fnmatch from xml.etree.ElementTree import ElementTree @@ -23,6 +23,16 @@ demos = { # "my-demo" : ("my_demo_url_or_path", "my-demo-dev-branch") } +status_dump = {"messages": []} + +def dump_status(error_occurred): + status_dump["error"] = error_occurred + pickle.dump(status_dump, open("result/demo_validation_status.pickle", "wb")) + +def log_status(log_string): + status_dump["messages"].add(log_string) + print(log_string) + def checkout(folder, url, repoBranch = "master"): Repo.clone_from(url, join(resultPath, folder), branch = repoBranch) @@ -31,7 +41,8 @@ if __name__ == "__main__": try: from git import Repo except: - print("BuildDemos depends on gitpython. Install it with `pip install gitpython`") + log_status("BuildDemos depends on gitpython. Install it with `pip install gitpython`") + dump_status(True) sys.exit(1) from BuildHelpers import updateRepositories, mavenValidate, copyWarFiles, getLogFile, removeDir, getArgs, mavenInstall, resultPath, readPomFile, parser from DeployHelpers import deployWar @@ -40,7 +51,6 @@ if __name__ == "__main__": args = getArgs() demosFailed = False ignoredDemos = args.ignore.split(",") - wars = [] for demo in demos: @@ -57,13 +67,13 @@ if __name__ == "__main__": updateRepositories(join(resultPath, demo), args.pluginRepo, postfix="plugin") mavenValidate(demo, logFile=getLogFile(demo)) wars.extend(copyWarFiles(demo)) - print("%s demo validation succeeded!" % (demo)) + log_status("%s demo validation succeeded!" % (demo)) except Exception as e: - print("%s demo validation failed: %s" % (demo, e)) + log_status("%s demo validation failed: %s" % (demo, e)) if demo not in ignoredDemos: demosFailed = True except EnvironmentError as e: - print("%s demo validation failed: %s" % (demo, e)) + log_status("%s demo validation failed: %s" % (demo, e)) if demo not in ignoredDemos: demosFailed = True try: @@ -76,8 +86,11 @@ if __name__ == "__main__": try: deployWar(war) except Exception as e: - print("War %s failed to deploy: %s" % (war, e)) + log_status("War %s failed to deploy: %s" % (war, e)) demosFailed = True if demosFailed: + dump_status(True) sys.exit(1) + + dump_status(False) |