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)
Exemplo n.º 2
0
	def testGetPSCs(self):
		print "TestCIManifest : testGetPSCs"
		man = CIManifest("sample_properties/CIDeploys.xls")
		pscs = man.getPSCs()
		# make sure we have more than one
		assert(len(pscs) > 1, "%i is not greater than 1" % len(pscs))
		# add stuff here
		self.assertEqual(pscs[0][0], "TempBookingApplication")
		self.assertEqual(pscs[0][1], "SNAPSHOT")
		self.assertEqual(pscs[1][0], "TempBookingNotificationService")
		self.assertEqual(pscs[1][1], "SNAPSHOT")
		self.assertEqual(man.releaseId, "CIDeploy")
Exemplo n.º 3
0
	def testGetReleaseId(self):
		print "TestCIManifest : testGetReleaseId"
		man = CIManifest("sample_properties/CIDeploys.xls")
		id = man.getReleaseId()
		self.assertEqual(id, "CIDeploy")