From 0ad896ece6ce1d1fe78b9f8e35acfccaadb18a1f Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Wed, 30 Jul 2014 15:01:50 +0100 Subject: Allow release scripts to be configured to only handle a subset of architectures We currently build all architectures at once during the release process, however for our CD pipeline we operate with one CD pipeline per architecture. This is not just useful for the CD pipeline work though, as it allows one organisation to handle releases for x86, where the infrastructure may be located in the cloud, and one organisation to handle ARM systems, which may be located in an office. --- scripts/release-build | 5 +++++ scripts/release-upload | 29 ++++++++++++++++++++++++++++- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/scripts/release-build b/scripts/release-build index 34305c67..fe10ba3b 100755 --- a/scripts/release-build +++ b/scripts/release-build @@ -121,6 +121,8 @@ class ReleaseApp(cliapp.Application): builds = [] for system_name in systems: system, _ = self.load_morphology(system_name) + if system['arch'] not in self.controllers: + continue builds.append(Build(system_name, system['arch'], self)) return builds @@ -130,6 +132,9 @@ class ReleaseApp(cliapp.Application): for system in cluster['systems']: name = system['morph'] + morphology = self.load_morphology(name)[0] + if morphology['arch'] not in self.controllers: + continue if name not in system['deploy']: raise cliapp.AppException( 'In %s: system %s ID should be "%s"' % diff --git a/scripts/release-upload b/scripts/release-upload index e7367f13..f97e7e98 100755 --- a/scripts/release-upload +++ b/scripts/release-upload @@ -49,6 +49,7 @@ import urlparse import cliapp import yaml +import morphlib class ReleaseUploader(cliapp.Application): @@ -134,6 +135,13 @@ class ReleaseUploader(cliapp.Application): default='morph', group=group) + self.settings.string_list( + ['arch'], + 'Upload files from morphologies of ARCH', + metavar='ARCH', + default=[], + group=group) + def get_local_username(self): uid = os.getuid() return pwd.getpwuid(uid)[0] @@ -210,14 +218,33 @@ class BuildArtifactPublisher(object): argv += self.find_system_morphologies() output = cliapp.runcmd(argv) basenames = output.splitlines() + for basename in basenames: + logging.debug(' {0}'.format(basename)) return basenames def find_system_morphologies(self): cluster_morphology_pathname = 'release.morph' + systems = [] + sb = morphlib.sysbranchdir.open_from_within('.') + definitions = sb.get_git_directory_name(sb.root_repository_url) + defs_repo = morphlib.gitdir.GitDirectory(definitions) + loader = morphlib.morphloader.MorphologyLoader() + finder = morphlib.morphologyfinder.MorphologyFinder(defs_repo) with open(cluster_morphology_pathname) as f: obj = yaml.load(f) - return [system_dict['morph'] for system_dict in obj['systems']] + for system_dict in obj['systems']: + system_path = system_dict['morph'] + if self.settings['arch']: + path = morphlib.util.sanitise_morphology_path(system_path) + morph = loader.load_from_string( + finder.read_morphology(path)) + if morph['arch'] in self.settings['arch']: + systems.append(system_path) + else: + systems.append(system_path) + + return systems def filter_away_build_artifacts_on_public_trove(self, basenames): result = [] -- cgit v1.2.1