From 57d77ff761e4b0cf89b161776ab33611533965d3 Mon Sep 17 00:00:00 2001 From: Richard Maw Date: Fri, 8 Aug 2014 15:14:59 +0100 Subject: Rename MorphologyFrobber -> MorphologyHelper It was a sucky placeholder name that wasn't replaced by anything better. --- scripts/release-test | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/scripts/release-test b/scripts/release-test index ddfe6bbd..445eda9c 100755 --- a/scripts/release-test +++ b/scripts/release-test @@ -35,7 +35,7 @@ import uuid import morphlib -class MorphologyFrobber(object): +class MorphologyHelper(object): def __init__(self): self.sb = sb = morphlib.sysbranchdir.open_from_within('.') defs_repo_path = sb.get_git_directory_name(sb.root_repository_url) @@ -280,7 +280,7 @@ class ReleaseApp(cliapp.Application): @staticmethod def _run_tests(instance, system_path, system_morph, (trove_host, trove_id, build_ref_prefix), - morph_frobber, systems): + morph_helper, systems): instance.wait_online() tests = [] @@ -301,17 +301,17 @@ class ReleaseApp(cliapp.Application): argv.extend(args) instance.runcmd(argv, **kwargs) - repo = morph_frobber.sb.root_repository_url - ref = morph_frobber.defs_repo.HEAD - sha1 = morph_frobber.defs_repo.resolve_ref_to_commit(ref) + repo = morph_helper.sb.root_repository_url + ref = morph_helper.defs_repo.HEAD + sha1 = morph_helper.defs_repo.resolve_ref_to_commit(ref) morph_cmd('init', '/src/ws') chdir = '/src/ws' morph_cmd('checkout', repo, ref, chdir=chdir) # TODO: Add a morph subcommand that gives the path to the root repository. repo_path = os.path.relpath( - morph_frobber.sb.get_git_directory_name(repo), - morph_frobber.sb.root_directory) + morph_helper.sb.get_git_directory_name(repo), + morph_helper.sb.root_directory) chdir = os.path.join(chdir, ref, repo_path) instance.runcmd(['git', 'reset', '--hard', sha1], chdir=chdir) @@ -339,15 +339,14 @@ class ReleaseApp(cliapp.Application): deployment_hosts, build_test_config): """Run the deployments and tests""" - image_path = '/opt/ci/' version = 'release-test' - morph_frobber = MorphologyFrobber() - cluster_morph = morph_frobber.load_morphology(cluster_path) - systems = dict(morph_frobber.load_cluster_systems(cluster_morph)) + morph_helper = MorphologyHelper() + cluster_morph = morph_helper.load_morphology(cluster_path) + systems = dict(morph_helper.load_cluster_systems(cluster_morph)) for system_path, deployment_name, deployment_config in \ - morph_frobber.iterate_cluster_deployments(cluster_morph): + morph_helper.iterate_cluster_deployments(cluster_morph): system_morph = systems[system_path] # We can only test systems in KVM that have a BSP @@ -364,7 +363,7 @@ class ReleaseApp(cliapp.Application): instance = deployment.deploy() try: self._run_tests(instance, system_path, system_morph, - build_test_config, morph_frobber, systems) + build_test_config, morph_helper, systems) finally: instance.delete() -- cgit v1.2.1 From 75c580e7d25cf90631bf2ecca3457b4bf7d4fdb9 Mon Sep 17 00:00:00 2001 From: Richard Maw Date: Fri, 8 Aug 2014 15:15:00 +0100 Subject: Implement load_cluster_systems in terms of load_morphology --- scripts/release-test | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/release-test b/scripts/release-test index 445eda9c..ec171d52 100755 --- a/scripts/release-test +++ b/scripts/release-test @@ -66,8 +66,7 @@ class MorphologyHelper(object): def load_cluster_systems(self, cluster_morph): for system_path in set(self.iterate_systems(cluster_morph['systems'])): - system_text = self.finder.read_morphology(system_path) - system_morph = self.loader.load_from_string(system_text) + system_morph = self.load_morphology(system_path) yield system_path, system_morph -- cgit v1.2.1 From 823575a89085aedcb20b95d31005d19edb10e776 Mon Sep 17 00:00:00 2001 From: Richard Maw Date: Fri, 8 Aug 2014 15:15:01 +0100 Subject: Various style fixes to release-test --- scripts/release-test | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/scripts/release-test b/scripts/release-test index ec171d52..1939a0d4 100755 --- a/scripts/release-test +++ b/scripts/release-test @@ -36,6 +36,7 @@ import morphlib class MorphologyHelper(object): + def __init__(self): self.sb = sb = morphlib.sysbranchdir.open_from_within('.') defs_repo_path = sb.get_git_directory_name(sb.root_repository_url) @@ -79,6 +80,7 @@ class TimeoutError(cliapp.AppException): class VMHost(object): + def __init__(self, user, address, disk_path): self.user = user self.address = address @@ -96,6 +98,7 @@ class VMHost(object): class Instance(object): + def __init__(self, deployment, config, host_machine, vm_id, rootfs_path): self.deployment = deployment self.config = config @@ -119,11 +122,11 @@ class Instance(object): return cliapp.runcmd(ssh_cmd, **kwargs) def _wait_for_dhcp(self, timeout): - ''' - Block until given hostname resolves successfully. + '''Block until given hostname resolves successfully. Raises TimeoutError if the hostname has not appeared in 'timeout' seconds. + ''' start_time = time.time() while True: @@ -177,8 +180,8 @@ class Instance(object): class Deployment(object): - def __init__(self, cluster_path, name, - deployment_config, host_machine): + + def __init__(self, cluster_path, name, deployment_config, host_machine): self.cluster_path = cluster_path self.name = name self.deployment_config = deployment_config -- cgit v1.2.1 From 3e0f8d32ffaec34fddc7feedd7ec1ea2fe1bac94 Mon Sep 17 00:00:00 2001 From: Richard Maw Date: Fri, 8 Aug 2014 15:15:02 +0100 Subject: Rename Instance -> DeployedSystemInstance This name requires less context to understand its use. --- scripts/release-test | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/release-test b/scripts/release-test index 1939a0d4..5ea82fa3 100755 --- a/scripts/release-test +++ b/scripts/release-test @@ -97,7 +97,7 @@ class VMHost(object): self.runcmd(['virsh', '-c', 'qemu:///system'] + list(args), **kwargs) -class Instance(object): +class DeployedSystemInstance(object): def __init__(self, deployment, config, host_machine, vm_id, rootfs_path): self.deployment = deployment @@ -250,7 +250,8 @@ class Deployment(object): config = dict(self.deployment_config) config.update(options) - return Instance(self, config, self.host_machine, vm_id, rootpath) + return DeployedSystemInstance(self, config, self.host_machine, + vm_id, rootpath) finally: shutil.rmtree(tempdir) -- cgit v1.2.1 From 9fc790f4a776e9d57b509b607b3a048b467e4cab Mon Sep 17 00:00:00 2001 From: Richard Maw Date: Fri, 8 Aug 2014 15:15:04 +0100 Subject: Rename wait_online to wait_until_online --- scripts/release-test | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/release-test b/scripts/release-test index 5ea82fa3..97e4a45a 100755 --- a/scripts/release-test +++ b/scripts/release-test @@ -154,7 +154,7 @@ class DeployedSystemInstance(object): % (self.ip_address, timeout)) time.sleep(0.5) - def wait_online(self, timeout=10): + def wait_until_online(self, timeout=10): self._wait_for_dhcp(timeout) self._wait_for_ssh(timeout) @@ -284,7 +284,7 @@ class ReleaseApp(cliapp.Application): def _run_tests(instance, system_path, system_morph, (trove_host, trove_id, build_ref_prefix), morph_helper, systems): - instance.wait_online() + instance.wait_until_online() tests = [] def baserock_build_test(instance): -- cgit v1.2.1 From 1cda941e95c7a8dfd7183d7307c84d0d1d2a2a91 Mon Sep 17 00:00:00 2001 From: Richard Maw Date: Fri, 8 Aug 2014 15:15:05 +0100 Subject: Never remember hosts when running ssh commands on instances The rest of the ssh commands are to the VM host, which we can't change all of, since some are run as part of the deployment extension. --- scripts/release-test | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/scripts/release-test b/scripts/release-test index 97e4a45a..fd71fdc3 100755 --- a/scripts/release-test +++ b/scripts/release-test @@ -115,7 +115,8 @@ class DeployedSystemInstance(object): return 'root@{host}'.format(host=self.ip_address) def runcmd(self, argv, chdir='.', **kwargs): - ssh_cmd = ['ssh', '-o', 'StrictHostKeyChecking=no', self.ssh_host] + ssh_cmd = ['ssh', '-o', 'StrictHostKeyChecking=no', + '-o', 'UserKnownHostsFile=/dev/null', self.ssh_host] cmd = ['sh', '-c', 'cd "$1" && shift && exec "$@"', '-', chdir] cmd += argv ssh_cmd.append(' '.join(map(pipes.quote, cmd))) @@ -159,9 +160,6 @@ class DeployedSystemInstance(object): self._wait_for_ssh(timeout) def delete(self): - # Forget config of deployed system as if it ever reappears it - # will have different host keys - cliapp.runcmd(['ssh-keygen', '-R', self.config['HOSTNAME']]) # Stop and remove VM try: self.host_machine.virsh('destroy', self.vm_id) -- cgit v1.2.1 From 2e69fdc0db5c100222b3f8085d871c0a89444c8c Mon Sep 17 00:00:00 2001 From: Richard Maw Date: Fri, 8 Aug 2014 15:15:06 +0100 Subject: Remove all VM storage together in one command --- scripts/release-test | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/scripts/release-test b/scripts/release-test index fd71fdc3..b2bca58d 100755 --- a/scripts/release-test +++ b/scripts/release-test @@ -167,14 +167,11 @@ class DeployedSystemInstance(object): # TODO: Stop assuming that destroy failed because it wasn't running pass try: - self.host_machine.virsh('undefine', self.vm_id) + self.host_machine.virsh('undefine', self.vm_id, '--remove-all-storage') except cliapp.AppException as e: # TODO: Stop assuming that undefine failed because it was # already removed pass - # TODO: Remove all attached disks, rather than just assuming it - # only has one - self.host_machine.runcmd(['rm', self.rootfs_path]) class Deployment(object): -- cgit v1.2.1 From e599bf132869c16ec9ebf17d45120b8915941692 Mon Sep 17 00:00:00 2001 From: Richard Maw Date: Tue, 19 Aug 2014 09:59:44 +0000 Subject: Use file: URI for list-artifacts in release-upload This requires the script be run in the top of the definitions repository, but will actually try to upload the changes that were tested, rather than the current HEAD. --- scripts/release-upload | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/release-upload b/scripts/release-upload index d7ba8705..273f9ed5 100755 --- a/scripts/release-upload +++ b/scripts/release-upload @@ -227,7 +227,7 @@ class BuildArtifactPublisher(object): # FIXME: These are hardcoded for simplicity. They would be # possible to deduce automatically from the workspace, but # that can happen later. - repo = 'baserock:baserock/definitions' + repo = 'file://%s' % os.path.abspath('.') ref = 'HEAD' argv = [self.settings['morph-cmd'], 'list-artifacts', '--quiet', repo, ref] -- cgit v1.2.1 From 2859c97778cb211a53d5a38a687b5f93ec7fa5ac Mon Sep 17 00:00:00 2001 From: Richard Maw Date: Tue, 19 Aug 2014 15:03:39 +0000 Subject: mason: Include build logs in output when builds fail --- mason/mason.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/mason/mason.sh b/mason/mason.sh index 2dca7d84..240cc347 100755 --- a/mason/mason.sh +++ b/mason/mason.sh @@ -40,10 +40,15 @@ rm -f "$HOME/success" echo INFO: Mason building: $DEFINITIONS_REF at $SHA1 -"scripts/release-build" --no-default-configs \ +if ! "scripts/release-build" --no-default-configs \ --trove-host "$DISTBUILD_TROVE_ADDRESS" \ --controllers "$DISTBUILD_ARCH:$DISTBUILD_CONTROLLER_ADDRESS" \ - "$BUILD_CLUSTER_MORPHOLOGY" + "$BUILD_CLUSTER_MORPHOLOGY"; then + echo ERROR: Failed to build release images + echo Build logs for chunks: + find builds -type f -exec echo {} \; -exec cat {} \; + exit 1 +fi releases_made="$(cd release && ls | wc -l)" if [ "$releases_made" = 0 ]; then -- cgit v1.2.1