def deployWar(warFile, name=None): if name is None: name = basename(warFile).replace('.war', "-%s.war" % (getArgs().version.split('-')[0])) print("Deploying to context %s" % (name[:-4])) # Undeploy/Remove old version if needed if deploymentExists(name): removeDeployment(name) # Do upload war file hash = doUploadWarFile(warFile) # Do deployment under name doDeploy(hash, name)
if __name__ == "__main__": # Do imports. try: from git import Repo except: 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 # Add command line agrument for ignoring failing demos parser.add_argument("--ignore", type=str, help="Ignored demos", default="") args = getArgs() demosFailed = False ignoredDemos = args.ignore.split(",") wars = [] for demo in demos: print("Validating demo %s" % (demo)) try: repo = demos[demo] if (isinstance(repo, tuple)): checkout(demo, repo[0], repo[1]) else: checkout(demo, repo) if hasattr(args, "fwRepo") and args.fwRepo is not None: updateRepositories(join(resultPath, demo), args.fwRepo)
def getDeploymentContext(archetype, version): return "%s-%s" % (archetype.split("-", 2)[2], version) ## DO THIS IF RUN AS A SCRIPT (not import) ## 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) mavenValidate(artifactId, logFile=log) warFiles = copyWarFiles(artifactId, name=archetype) for war in warFiles:
def getUrl(): return getArgs().deployUrl
def getAuth(): args = getArgs() return HTTPDigestAuth(args.deployUser, args.deployPass)
except: print("BuildDemos depends on gitpython. Install it with `pip install gitpython`") sys.exit(1) from BuildHelpers import ( updateRepositories, mavenValidate, copyWarFiles, getLogFile, removeDir, getArgs, mavenInstall, resultPath, ) from DeployHelpers import deployWar if hasattr(getArgs(), "artifactPath") and getArgs().artifactPath is not None: basePath = getArgs().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) demosFailed = False
Repo.clone_from(url, join(resultPath, folder)) if __name__ == "__main__": # Do imports. try: from git import Repo except: print( "BuildDemos depends on gitpython. Install it with `pip install gitpython`" ) sys.exit(1) from BuildHelpers import updateRepositories, mavenValidate, copyWarFiles, getLogFile, removeDir, getArgs, mavenInstall, resultPath from DeployHelpers import deployWar if hasattr(getArgs(), "artifactPath") and getArgs().artifactPath is not None: basePath = getArgs().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) demosFailed = False