#
import subprocess
-from BuildHelpers import mavenValidate, copyWarFiles, repo, getLogFile, mavenCmd, updateRepositories, getArgs, removeDir
+from BuildHelpers import mavenValidate, copyWarFiles, repo, getLogFile, mavenCmd, updateRepositories, getArgs, removeDir, parser
from DeployHelpers import deployWar
## DEFAULT VARIABLES ##
cmd.append("-DartifactId=%s" % (artifactId))
cmd.append("-Dversion=1.0-SNAPSHOT")
cmd.append("-DinteractiveMode=false")
+ if hasattr(args, "maven") and args.maven is not None:
+ cmd.extends(args.maven.split(" "))
# Generate pom.xml
print("Generating pom.xml for archetype %s" % (archetype))
## DO THIS IF RUN AS A SCRIPT (not import) ##
if __name__ == "__main__":
+ # Add command line arguments for staging repos
+ parser.add_argument("framework", type=int, help="Framework repo id (comvaadin-XXXX)", nargs='?')
+ parser.add_argument("archetype", type=int, help="Archetype repo id (comvaadin-XXXX)", nargs='?')
+ parser.add_argument("plugin", type=int, help="Maven Plugin repo id (comvaadin-XXXX)", nargs='?')
+
+ archetypesFailed = False
+
+ # Parse the arguments
args = getArgs()
for archetype in archetypes:
try:
deployWar(war, "%s.war" % (archetype.split("-", 2)[2]))
except Exception as e:
print("War %s failed to deploy: %s" % (war, e))
+ archetypesFailed = True
except:
print("Archetype %s build failed" % (archetype))
+ archetypesFailed = True
removeDir(artifactId)
print("")
+ if archetypesFailed:
+ sys.exit(1)
except:
print("BuildDemos depends on gitpython. Install it with `pip install gitpython`")
sys.exit(1)
-from BuildHelpers import updateRepositories, mavenValidate, copyWarFiles, getLogFile, removeDir
+from BuildHelpers import updateRepositories, mavenValidate, copyWarFiles, getLogFile, removeDir, getArgs
from DeployHelpers import deployWar
# Validated demos. name -> git url
"dashboard" : "https://github.com/vaadin/dashboard-demo.git",
"parking" : "https://github.com/vaadin/parking-demo.git",
"addressbook" : "https://github.com/vaadin/addressbook.git",
- "confirmdialog" : "https://github.com/samie/Vaadin-ConfirmDialog.git",
"grid-gwt" : "https://github.com/vaadin/grid-gwt.git"
}
Repo.clone_from(url, folder)
if __name__ == "__main__":
+ if getArgs().teamcity:
+ print("Add dependency jars from TeamCity here")
+
+ demosFailed = False
+
for demo in demos:
print("Validating demo %s" % (demo))
try:
deployWar(war)
except Exception as e:
print("War %s failed to deploy: %s" % (war, e))
+ demosFailed = True
print("%s demo validation succeeded!" % (demo))
- except:
- print("%s demo validation failed" % (demo))
+ except Exception as e:
+ print("%s demo validation failed: %s" % (demo, e))
+ demosFailed = True
removeDir(demo)
print("")
+ if demosFailed:
+ sys.exit(1)
args = None
-# Parse command line arguments <version> <framework-repo-id> <archetype-repo-id> <plugin-repo-id>
+# Default argument parser
+parser = argparse.ArgumentParser(description="Automated staging validation")
+parser.add_argument("version", type=str, help="Vaadin version to use")
+parser.add_argument("--maven", help="Additional maven command line parameters", default=None)
+parser.add_argument("--teamcity", help="Use vaadin jars provided by teamcity", action="store_const", const=True, default=False)
+
+# Parse command line arguments <version>
def parseArgs():
- # Command line arguments for this script
- parser = argparse.ArgumentParser(description="Automated staging validation")
- parser.add_argument("version", type=str, help="Vaadin version to use")
- parser.add_argument("framework", type=int, help="Framework repo id (comvaadin-XXXX)", nargs='?')
- parser.add_argument("archetype", type=int, help="Archetype repo id (comvaadin-XXXX)", nargs='?')
- parser.add_argument("plugin", type=int, help="Maven Plugin repo id (comvaadin-XXXX)", nargs='?')
-
# If no args, give help
if len(sys.argv) == 1:
args = parser.parse_args(["-h"])
else:
args = parser.parse_args()
-
return args
# Function for determining the path for maven executable
cmd = [mvnCmd]
if hasattr(repoIds, "version") and repoIds.version is not None:
cmd.append("-Dvaadin.version=%s" % (repoIds.version))
+ if hasattr(repoIds, "maven") and repoIds.maven is not None:
+ cmd.extend(repoIds.maven.split(" "))
cmd.extend(["clean", "package", "validate"])
print("executing: %s" % (" ".join(cmd)))
subprocess.check_call(cmd, cwd=join(getcwd(), artifactId), stdout=logFile)
sys.exit(1)
from requests.auth import HTTPDigestAuth
from os.path import join, expanduser, basename
+from BuildHelpers import parser, getArgs
-# .deploy-url in home folder
-deployUrlFile = join(expanduser("~"), ".deploy-url")
-
-# .deploy-credentials in home folder
-deployCredFile = join(expanduser("~"), ".deploy-credentials")
+parser.add_argument("--deployUrl", help="Wildfly management URL")
+parser.add_argument("--deployUser", help="Deployment user", default=None)
+parser.add_argument("--deployPass", help="Deployment password", default=None)
# Helper for handling the full deployment
# name should end with .war
# Helper for adding Content-Type to headers
def doPostJson(**kwargs):
- return requests.post(headers={"Content-Type" : "application/json"}, **kwargs)
+ r = requests.post(headers={"Content-Type" : "application/json"}, **kwargs)
+ # Wildfly gives code 500 when asking for a non-existent deployment
+ if r.status_code == requests.codes.ok or r.status_code == 500:
+ return r
+ r.raise_for_status()
def doUploadWarFile(warFile):
# Upload request, just see the outcome
# Read credentials file and return a HTTPDigestAuth object
def getAuth():
- (deployUser, deployPass) = open(deployCredFile).read().strip().split(",")
- return HTTPDigestAuth(deployUser, deployPass)
+ args = getArgs()
+ return HTTPDigestAuth(args.deployUser, args.deployPass)
# Read the deploy url file and return the url
def getUrl():
- return open(deployUrlFile).read().strip()
-
+ return getArgs().deployUrl
+