diff options
Diffstat (limited to 'yarns/deployment.yarn')
-rw-r--r-- | yarns/deployment.yarn | 158 |
1 files changed, 51 insertions, 107 deletions
diff --git a/yarns/deployment.yarn b/yarns/deployment.yarn index 85bb2c9d..a3a8a679 100644 --- a/yarns/deployment.yarn +++ b/yarns/deployment.yarn @@ -2,47 +2,42 @@ Morph Deployment Tests ====================== SCENARIO deploying a non-cluster morphology - GIVEN a workspace - AND a git server - WHEN the user checks out the system branch called master - AND the user attempts to deploy the system systems/test-system.morph in branch master + GIVEN a git server + WHEN the user clones definitions + AND the user attempts to deploy the system systems/test-system.morph in branch master THEN morph failed AND the deploy error message includes the string "morph deployment commands are only supported for cluster morphologies" FINALLY the git server is shut down SCENARIO deploying a cluster morphology as a tarfile - GIVEN a workspace - AND a git server - WHEN the user checks out the system branch called master - AND the user builds the system systems/test-system.morph in branch master + GIVEN a git server + WHEN the user clones definitions + AND the user builds the system systems/test-system.morph in branch master AND the user attempts to deploy the cluster clusters/test-cluster.morph in branch master THEN morph succeeded FINALLY the git server is shut down SCENARIO deploying a cluster using a relative path - GIVEN a workspace - AND a git server - WHEN the user checks out the system branch called master + GIVEN a git server + WHEN the user clones definitions AND the user builds the system systems/test-system.morph in branch master - AND from directory workspace/master/test/morphs/clusters the user attempts to deploy the cluster test-cluster.morph in branch master + AND from directory definitions/clusters the user attempts to deploy the cluster test-cluster.morph in branch master THEN morph succeeded FINALLY the git server is shut down SCENARIO deploying a cluster using a relative path (second variant) - GIVEN a workspace - AND a git server - WHEN the user checks out the system branch called master + GIVEN a git server + WHEN the user clones definitions AND the user builds the system systems/test-system.morph in branch master - AND from directory workspace/master/test/morphs/clusters the user attempts to deploy the cluster ../clusters/test-cluster.morph in branch master + AND from directory definitions/clusters the user attempts to deploy the cluster ../clusters/test-cluster.morph in branch master THEN morph succeeded FINALLY the git server is shut down SCENARIO deploying a cluster using an absolute path - GIVEN a workspace - AND a git server - WHEN the user checks out the system branch called master + GIVEN a git server + WHEN the user clones definitions AND the user builds the system systems/test-system.morph in branch master - AND from directory workspace/master/test/morphs/clusters the user attempts to deploy the cluster using the absolute path to test-cluster.morph in branch master + AND from directory definitions/clusters the user attempts to deploy the cluster using the absolute path to test-cluster.morph in branch master THEN morph succeeded FINALLY the git server is shut down @@ -50,9 +45,8 @@ Some deployment types support upgrades, but some do not and Morph needs to make this clear. SCENARIO attempting to upgrade a tarfile deployment - GIVEN a workspace - AND a git server - WHEN the user checks out the system branch called master + GIVEN a git server + WHEN the user clones definitions AND the user builds the system systems/test-system.morph in branch master AND the user attempts to upgrade the cluster clusters/test-cluster.morph in branch master THEN morph failed @@ -65,18 +59,17 @@ base OS as an upgrade. While pointless, this is permitted and does exercise the same code paths as a real upgrade. SCENARIO deploying a cluster morphology as rawdisk and then upgrading it - GIVEN a workspace - AND a git server - WHEN the user checks out the system branch called master - GIVEN a cluster called test-cluster.morph in system branch master - AND a system in cluster test-cluster.morph in branch master called test-system - AND system test-system in cluster test-cluster.morph in branch master builds systems/test-system.morph - AND system test-system in cluster test-cluster.morph in branch master has deployment type: rawdisk - AND system test-system in cluster test-cluster.morph in branch master has deployment location: test.tar - WHEN the user builds the system systems/test-system.morph in branch master - AND the user attempts to deploy the cluster test-cluster.morph in branch master with options test-system.DISK_SIZE=20M test-system.VERSION_LABEL=test1 + GIVEN a git server + GIVEN a cluster called clusters/test-cluster.morph in system branch master + AND a system in cluster clusters/test-cluster.morph in branch master called test-system + AND system test-system in cluster clusters/test-cluster.morph in branch master builds systems/test-system.morph + AND system test-system in cluster clusters/test-cluster.morph in branch master has deployment type: rawdisk + AND system test-system in cluster clusters/test-cluster.morph in branch master has deployment location: test.tar + WHEN the user clones definitions + AND the user builds the system systems/test-system.morph in branch master + AND the user attempts to deploy the cluster clusters/test-cluster.morph in branch master with options test-system.DISK_SIZE=20M test-system.VERSION_LABEL=test1 THEN morph succeeded - WHEN the user attempts to upgrade the cluster test-cluster.morph in branch master with options test-system.VERSION_LABEL=test2 + WHEN the user attempts to upgrade the cluster clusters/test-cluster.morph in branch master with options test-system.VERSION_LABEL=test2 THEN morph succeeded FINALLY the git server is shut down @@ -94,9 +87,7 @@ For the use-cases of: It is convenient to be able to deploy one system inside another. SCENARIO deploying a cluster morphology with nested systems - GIVEN a workspace - AND a git server - WHEN the user checks out the system branch called master + GIVEN a git server GIVEN a cluster called test-cluster.morph in system branch master AND a system in cluster test-cluster.morph in branch master called test-system AND system test-system in cluster test-cluster.morph in branch master builds systems/test-system.morph @@ -112,7 +103,8 @@ We specify the location as a file path, this is relative to the parent system's extracted rootfs, before it is configured. AND subsystem test-system.sysroot in cluster test-cluster.morph in branch master has deployment location: var/lib/sysroots/test-system - WHEN the user builds the system systems/test-system.morph in branch master + WHEN the user clones definitions + AND the user builds the system systems/test-system.morph in branch master AND the user attempts to deploy the cluster test-cluster.morph in branch master with options test-system.location="$DATADIR/test.tar" THEN morph succeeded @@ -141,9 +133,7 @@ There's a few ways of creating an initramfs. We could: SCENARIO deploying a system with an initramfs ASSUMING there is space for 5 512M disk images - GIVEN a workspace - AND a git server - WHEN the user checks out the system branch called master + GIVEN a git server GIVEN a cluster called C.morph in system branch master AND a system in cluster C.morph in branch master called S @@ -190,15 +180,16 @@ Fully testing that the system is bootable requires a lot more time, infrastructure and dependencies, so we're just going to build it and inspect the result of the deployment. - WHEN the user builds the system systems/test-system.morph in branch master + WHEN the user clones definitions + AND the user builds the system systems/test-system.morph in branch master AND the user attempts to deploy the cluster C.morph in branch master THEN morph succeeded - AND file workspace/master/test/morphs/test.img exists + AND file definitions/test.img exists If the initramfs write extension works, the rootfs image should contain `boot/initramfs.gz`. - WHEN disk image workspace/master/test/morphs/test.img is mounted at mnt + WHEN disk image definitions/test.img is mounted at mnt THEN file mnt/systems/default/run/boot/initramfs.gz exists If the `rawdisk` write extension worked, then the bootloader config file @@ -219,10 +210,7 @@ Starting from the well-defined position of having a cluster morphology with only one definition. SCENARIO partially deploying a cluster morphology - GIVEN a workspace - AND a git server - WHEN the user checks out the system branch called master - AND the user builds the system systems/test-system.morph in branch master + GIVEN a git server GIVEN a cluster called test-cluster.morph in system branch master AND a system in cluster test-cluster.morph in branch master called test-system AND system test-system in cluster test-cluster.morph in branch master builds systems/test-system.morph @@ -242,17 +230,19 @@ of the systems in the cluster are deployed. Here a successful deployment will have morph exit sucessfully and in the case of tarball deployments, the tarballs for both the systems will be created. - WHEN the user attempts to deploy the cluster test-cluster.morph in branch master + WHEN the user clones definitions + AND the user builds the system systems/test-system.morph in branch master + AND the user attempts to deploy the cluster test-cluster.morph in branch master THEN morph succeeded - AND file workspace/master/test/morphs/test-system.tar exists - AND file workspace/master/test/morphs/second-system.tar exists + AND file definitions/test-system.tar exists + AND file definitions/second-system.tar exists However, we don't need to deploy every system defined in a cluster at once. This is useful for cases such as having a cluster morphology for deploying a whole distbuild network, and re-deploying only nodes that have failed. - GIVEN the files workspace/master/test/morphs/test-system.tar and workspace/master/test/morphs/second-system.tar are removed + GIVEN the files definitions/test-system.tar and definitions/second-system.tar are removed WHEN the user attempts to deploy test-system from cluster test-cluster.morph in branch master A successful deployment will have morph exit successfully, and in the @@ -260,8 +250,8 @@ case of tarball deployments, only the tarball for the system we asked for will be created. THEN morph succeeded - AND file workspace/master/test/morphs/test-system.tar exists - AND file workspace/master/test/morphs/second-system.tar does not exist + AND file definitions/test-system.tar exists + AND file definitions/second-system.tar does not exist Cluster morphs can contain "nested systems", i.e. systems which have subsystems to deploy as part of them. @@ -280,11 +270,12 @@ system's extracted rootfs, before it is configured. The system which contains a nested system is deployed the same as before, we don't need to mention the nested deployment. - AND the file workspace/master/test/morphs/test-system.tar is removed - WHEN the user attempts to deploy test-system from cluster test-cluster.morph in branch master + AND the file definitions/test-system.tar is removed + WHEN the user pulls definitions from origin master + AND the user attempts to deploy test-system from cluster test-cluster.morph in branch master THEN morph succeeded - AND file workspace/master/test/morphs/test-system.tar exists - AND tarball workspace/master/test/morphs/test-system.tar contains var/lib/sysroots/test-system/baserock + AND file definitions/test-system.tar exists + AND tarball definitions/test-system.tar contains var/lib/sysroots/test-system/baserock Morph will abort deployment if the system to deploy that is specified on the command line is not defined in the morphology. @@ -308,9 +299,8 @@ It is possible to only deploy one or more strata or chunks from a system when deploying to a tarball or sysroot. SCENARIO partially deploying a system - GIVEN a workspace - AND a git server - WHEN the user checks out the system branch called master + GIVEN a git server + WHEN the user clones definitions AND the user builds the system systems/test-system.morph in branch master AND the user attempts to partially deploy tar from cluster clusters/partial-test-cluster.morph in branch master THEN morph succeeded @@ -322,49 +312,3 @@ something other than tarball or sysroot. WHEN the user attempts to partially deploy rawdisk from cluster clusters/partial-test-cluster.morph in branch master THEN morph failed - -Deploying branch-from-image produced systems -============================================ - -We have this nifty subcommand called branch-from-image, which can be -used to build the same thing as an existing image. - -There's no special requirements for making the image reproducible. - - SCENARIO reproducing systems - GIVEN a workspace - AND a git server - WHEN the user checks out the system branch called master - AND the user builds the system systems/test-system.morph in branch master - GIVEN a cluster called test-cluster.morph in system branch master - AND a system in cluster test-cluster.morph in branch master called test-system - AND system test-system in cluster test-cluster.morph in branch master builds systems/test-system.morph - AND system test-system in cluster test-cluster.morph in branch master has deployment type: sysroot - AND system test-system in cluster test-cluster.morph in branch master has deployment location: test-system - WHEN the user attempts to deploy the cluster test-cluster.morph in branch master - THEN morph succeeded - AND file workspace/master/test/morphs/test-system exists - -To reproduce an existing image, do a checkout with the extracted root -filesystem's /baserock directory as the `--metadata-dir` argument. - - WHEN the user attempts to check out the system branch from workspace/master/test/morphs/test-system called mybranch - THEN morph succeeded - AND the system branch mybranch is checked out - -After it is checked-out, the system can be rebuilt. - - WHEN the user attempts to build the system systems/test-system.morph in branch mybranch - THEN morph succeeded - -Once it is rebuilt, it can be deployed. - - GIVEN a cluster called test-cluster.morph in system branch mybranch - AND a system in cluster test-cluster.morph in branch mybranch called test-system - AND system test-system in cluster test-cluster.morph in branch mybranch builds systems/test-system.morph - AND system test-system in cluster test-cluster.morph in branch mybranch has deployment type: tar - AND system test-system in cluster test-cluster.morph in branch mybranch has deployment location: test-system.tar - WHEN the user attempts to deploy the cluster test-cluster.morph in branch mybranch - THEN morph succeeded - AND file workspace/mybranch/test/morphs/test-system.tar exists - FINALLY the git server is shut down |