Browse Source

Add plugin repository parameter to validation scripts

Change-Id: I94888fd19e2bf01f34ef57230bd3e9df7fb3d8eb
tags/7.7.0.alpha1
Teemu Suo-Anttila 8 years ago
parent
commit
9697eebd6f
4 changed files with 20 additions and 39 deletions
  1. 6
    9
      scripts/BuildArchetypes.py
  2. 4
    25
      scripts/BuildDemos.py
  3. 6
    5
      scripts/BuildHelpers.py
  4. 4
    0
      scripts/DeployHelpers.py

+ 6
- 9
scripts/BuildArchetypes.py View File

@@ -41,7 +41,7 @@ def generateArchetype(archetype, artifactId, repo):
cmd.append("-DarchetypeGroupId=%s" % (archetypeGroup))
cmd.append("-DarchetypeArtifactId=%s" % (archetype))
cmd.append("-DarchetypeVersion=%s" % (args.version))
if hasattr(args, "repo") and args.repo != None:
if repo is not None:
cmd.append("-DarchetypeRepository=%s" % repo)
cmd.append("-DgroupId=%s" % (group))
cmd.append("-DartifactId=%s" % (artifactId))
@@ -62,25 +62,22 @@ if __name__ == "__main__":
from BuildHelpers import mavenValidate, copyWarFiles, getLogFile, mavenCmd, updateRepositories, getArgs, removeDir, parser, resultPath
from DeployHelpers import deployWar

# Add command line arguments for staging repos
parser.add_argument("--repo", type=str, help="Staging repository URL", required=True)

archetypesFailed = False

# Parse the arguments
args = getArgs()

if hasattr(args, "artifactPath") and args.artifactPath is not None:
raise Exception("Archetype validation build does not support artifactPath")

wars = {}

for archetype in archetypes:
artifactId = "test-%s-%s" % (archetype, args.version.replace(".", "-"))
try:
log = getLogFile(archetype)
generateArchetype(archetype, artifactId, args.repo)
updateRepositories(join(resultPath, artifactId), args.repo)
generateArchetype(archetype, artifactId, args.pluginRepo)
if hasattr(args, "fwRepo") and args.fwRepo is not None:
updateRepositories(join(resultPath, artifactId), args.fwRepo)
if hasattr(args, "pluginRepo") and args.pluginRepo is not None:
updateRepositories(join(resultPath, artifactId), args.pluginRepo, postfix="plugin")
mavenValidate(artifactId, logFile=log)
warFiles = copyWarFiles(artifactId, name=archetype)
for war in warFiles:

+ 4
- 25
scripts/BuildDemos.py View File

@@ -36,32 +36,9 @@ if __name__ == "__main__":
sys.exit(1)
from BuildHelpers import updateRepositories, mavenValidate, copyWarFiles, getLogFile, removeDir, getArgs, mavenInstall, resultPath, readPomFile, parser
from DeployHelpers import deployWar

# Add command line argument for staging repos
parser.add_argument("--repo", type=str, help="Staging repository URL", default=None)

# Add command line agrument for ignoring failing demos
parser.add_argument("--ignore", type=str, help="Ignored demos", default="")

args = getArgs()
if hasattr(args, "artifactPath") and args.artifactPath is not None:
version = False
basePath = args.artifactPath
poms = []
for root, dirs, files in os.walk(basePath):
for name in files:
if fnmatch(name, "*.pom"):
poms.append(join(root, name))
for pom in poms:
jarFile = pom.replace(".pom", ".jar")
if isfile(jarFile):
mavenInstall(pom, jarFile)
else:
mavenInstall(pom)
if "vaadin-server" in pom:
pomXml, nameSpace = readPomFile(pom)
for version in pomXml.getroot().findall("./{%s}version" % (nameSpace)):
args.version = version.text
demosFailed = False
ignoredDemos = args.ignore.split(",")
@@ -75,8 +52,10 @@ if __name__ == "__main__":
checkout(demo, repo[0], repo[1])
else:
checkout(demo, repo)
if hasattr(args, "repo") and args.repo is not None:
updateRepositories(join(resultPath, demo), args.repo)
if hasattr(args, "fwRepo") and args.fwRepo is not None:
updateRepositories(join(resultPath, demo), args.fwRepo)
if hasattr(args, "pluginRepo") and args.pluginRepo is not None:
updateRepositories(join(resultPath, demo), args.pluginRepo, postfix="plugin")
mavenValidate(demo, logFile=getLogFile(demo))
wars.extend(copyWarFiles(demo))
print("%s demo validation succeeded!" % (demo))

+ 6
- 5
scripts/BuildHelpers.py View File

@@ -25,9 +25,10 @@ args = None
parser = argparse.ArgumentParser(description="Automated staging validation")
group = parser.add_mutually_exclusive_group(required=True)
group.add_argument("--version", help="Vaadin version to use")
group.add_argument("--artifactPath", help="Path to local folder with Vaadin artifacts")

parser.add_argument("--maven", help="Additional maven command line parameters", default=None)
parser.add_argument("--fwRepo", help="Framework staging repository URL", default=None)
parser.add_argument("--pluginRepo", help="Maven plugin repository URL", default=None)

# Parse command line arguments <version>
def parseArgs():
@@ -109,7 +110,7 @@ def readPomFile(pomFile):
return ElementTree.parse(pomFile), nameSpace

# Recursive pom.xml update script
def updateRepositories(path, repoUrl = None, version = None):
def updateRepositories(path, repoUrl = None, version = None, postfix = "staging"):
# If versions are not supplied, parse arguments
if version is None:
version = getArgs().version
@@ -129,7 +130,7 @@ def updateRepositories(path, repoUrl = None, version = None):
print("Add staging repositories to " + pomXml)
# Add framework staging repository
addRepo(repoNode, "repository", "vaadin-%s-staging" % (version), repoUrl)
addRepo(repoNode, "repository", "vaadin-%s-%s" % (version, postfix), repoUrl)
# Find the correct pluginRepositories node
pluginRepo = tree.getroot().find("{%s}pluginRepositories" % (nameSpace))
@@ -138,7 +139,7 @@ def updateRepositories(path, repoUrl = None, version = None):
pluginRepo = ElementTree.SubElement(tree.getroot(), "pluginRepositories")
# Add plugin staging repository
addRepo(pluginRepo, "pluginRepository", "vaadin-%s-plugin-staging" % (version), repoUrl)
addRepo(pluginRepo, "pluginRepository", "vaadin-%s-%s" % (version, postfix), repoUrl)
# Overwrite the modified pom.xml
tree.write(pomXml, encoding='UTF-8')
@@ -147,7 +148,7 @@ def updateRepositories(path, repoUrl = None, version = None):
for i in listdir(path):
file = join(path, i)
if isdir(file):
updateRepositories(join(path, i), repoUrl, version)
updateRepositories(join(path, i), repoUrl, version, postfix)

# Add a repository of repoType to given repoNode with id and URL
def addRepo(repoNode, repoType, id, url):

+ 4
- 0
scripts/DeployHelpers.py View File

@@ -25,6 +25,10 @@ def testServer():

if serverUp is not None:
return serverUp
if getUrl() is None:
print("No deploy URL provided")
serverUp = False
return serverUp

print("Checking server status")
i = 0

Loading…
Cancel
Save