def processCIManifest(pf):
	""" create a file system for autodeploy from some file system - probably build-system output
	the CIManifest allows the inclusion of a pattern match so that we can get the latest build
	of a particular artefact
	"""
	manifest = CIManifest(pf.get("manifest.file"))
	releaseId = manifest.getReleaseId()
	deployPackageHome = "tmp/" + releaseId
	pscs = manifest.getPSCs()
	deployables = []
	# cater for different repository types - file/ftp
	# TODO implement file for CI
	antFile = AntCopyProject("antBuildtmpFS.xml", pf.get("manifest.repository.protocol"))
	antFile.setName("createtmpfs")
	antFile.deleteDir(deployPackageHome)
	metadata = DeploymentMetadata(pf.get("manifest.metadata.source"), pf.get("manifest.metadata.file"))
	for psc in pscs:
		deployable = metadata.getMetadataForPSC(psc)
		if deployable:
			deployables.append(deployable)
			if pf.get("manifest.repository.protocol").lower() == "ftp":
				repoHome = "ftp://" + pf.get("manifest.repository.root")
			elif pf.get("manifest.repository.protocol").lower() == "file":
				repoHome = pf.get("manifest.repository.root")
			if deployable["artefact"].find("*") > 0 and pf.get("manifest.repository.protocol").lower() == "ftp":
				ftpSite = FTPSiteNav(pf.get("manifest.repository.root"))
				latest = ftpSite.getLatestFromPattern(deployable["repo-path"], deployable["artefact"])[0]
				deployable["artefact"] = latest
			artefact = deployable["artefact"]
			sourceDir = repoHome + "/" + deployable["repo-path"]
			target = deployPackageHome + "/" + deployable["name"]
			antFile.copyFile(sourceDir, artefact, target)
	createAutodeployProperties(antFile, releaseId, deployables)
예제 #2
0
	def testWriteBuildfileFTP(self):
		print "TestAntCopyProject : testWriteBuildfileFTP"
		project = AntCopyProject("sample_properties/testAntFTPProject.xml", "ftp")
		project.setName("ftp-project")
		project.copyFile("ftp://build.gateway.michaelpage.local/TempBookingParentPOM/trunk"
						, "TempBookingApplicationEar-tempbookingbuild-3.0.0-SNAPSHOT-build.279.ear"
						, "tmp/package-root/TempBookingApplication")
		project.writeBuildfile()