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)
def testGetReleaseId(self): print "TestCIManifest : testGetReleaseId" man = CIManifest("sample_properties/CIDeploys.xls") id = man.getReleaseId() self.assertEqual(id, "CIDeploy")