summaryrefslogtreecommitdiff
path: root/yarns/deployment.yarn
blob: b51645c64bdb54951a0b6b925bb81036139805f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
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 test-system in branch master
    THEN morph failed
    AND the deploy error message includes the string "morph deploy is only supported for cluster morphologies"

    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
    GIVEN a cluster called test-cluster in system branch master
    AND a system in cluster test-cluster in branch master called test-system
    AND system test-system in cluster test-cluster in branch master builds test-system
    AND system test-system in cluster test-cluster in branch master has deployment type: tar
    AND system test-system in cluster test-cluster in branch master has deployment location: test.tar
    WHEN the user builds the system test-system in branch master
    AND the user attempts to deploy the cluster test-cluster in branch master
    THEN morph succeeded

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 cluster called test-cluster in system branch master
    AND a system in cluster test-cluster in branch master called test-system
    AND system test-system in cluster test-cluster in branch master builds test-system
    AND system test-system in cluster test-cluster in branch master has deployment type: tar
    AND system test-system in cluster test-cluster in branch master has deployment location: test.tar
    WHEN the user builds the system test-system in branch master
    AND the user attempts to upgrade the cluster test-cluster in branch master
    THEN morph failed

The rawdisk write extension supports both initial deployment and subsequent
upgrades. Note that the rawdisk upgrade code needs bringing up to date to use
the new Baserock OS version manager tool. Also, the test deploys an identical
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 in system branch master
    AND a system in cluster test-cluster in branch master called test-system
    AND system test-system in cluster test-cluster in branch master builds test-system
    AND system test-system in cluster test-cluster in branch master has deployment type: rawdisk
    AND system test-system in cluster test-cluster in branch master has deployment location: test.tar
    WHEN the user builds the system test-system in branch master
    AND the user attempts to deploy the cluster test-cluster 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 in branch master with options test-system.VERSION_LABEL=test2
    THEN morph succeeded

Nested deployments
==================

For the use-cases of:

1.  Installer CD/USB
2.  NFS/VM host
3.  System with multiple containerised applications
4.  System with a toolchain targetting the sysroot of another target
5.  Any nested combination of the above

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 cluster called test-cluster in system branch master
    AND a system in cluster test-cluster in branch master called test-system
    AND system test-system in cluster test-cluster in branch master builds test-system
    AND system test-system in cluster test-cluster in branch master has deployment type: tar

After the usual setup, we also add a subsystem to the cluster.

    GIVEN a subsystem in cluster test-cluster in branch master called test-system.sysroot
    AND subsystem test-system.sysroot in cluster test-cluster in branch master builds test-system
    AND subsystem test-system.sysroot in cluster test-cluster in branch master has deployment type: sysroot

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 in branch master has deployment location: var/lib/sysroots/test-system
    WHEN the user builds the system test-system in branch master
    AND the user attempts to deploy the cluster test-cluster in branch master with options test-system.location="$DATADIR/test.tar"
    THEN morph succeeded

Morph succeeding alone is not sufficient to check whether it actually
worked, since if it ignored the subsystems field, or got the location
wrong for the subsystem. To actually test it, we have to check that our
deployed system contains the other. Since the baserock directory is in
every system, we can check for that.

    AND tarball test.tar contains var/lib/sysroots/test-system/baserock

Partial deployments
===================

Deploy part of a cluster
------------------------

We may not always want to deploy every system in a cluster, for example
if we only want to deploy a distbuild controller but we have a cluster
for a full network.

    SCENARIO partially deploying a cluster morphology
    GIVEN a workspace
    AND a git server
    WHEN the user checks out the system branch called master
    GIVEN a cluster called test-cluster in system branch master
    AND a system in cluster test-cluster in branch master called test-system
    AND system test-system in cluster test-cluster in branch master builds test-system
    AND system test-system in cluster test-cluster in branch master has deployment type: tar

We now want to add a second system to the cluster, so we can choose
which one to deploy.

    GIVEN a system in cluster test-cluster in branch master called second-system
    AND system second-system in cluster test-cluster in branch master builds second-system
    AND system second-system in cluster test-cluster in branch master has deployment type: tar

    WHEN the user builds the system test-system in branch master
    AND the user attempts to deploy the cluster test-cluster in branch master with options test-system test-system.location="$DATADIR/test-system.tar" second-system.location="$DATADIR/second-system.tar"
    THEN morph succeeded

Morph succeeding alone does not satisfy the requirements of this test.
It may have deployed both systems, or the wrong system, so we need to
make sure only the correct tarball exists.

    THEN file test-system.tar exists
    AND file second-system.tar does not exist

Deploy all of a multi-system cluster
------------------------------------

We should also test that not specifying a system deploys both systems.

    SCENARIO deploying a cluster morphology that contains multiple systems
    GIVEN a workspace
    AND a git server
    WHEN the user checks out the system branch called master
    GIVEN a cluster called test-cluster in system branch master
    AND a system in cluster test-cluster in branch master called test-system
    AND system test-system in cluster test-cluster in branch master builds test-system
    AND system test-system in cluster test-cluster in branch master has deployment type: tar

We now want to add a second system deployment to the cluster, so we can
choose which one to deploy.

    GIVEN a system in cluster test-cluster in branch master called second-system
    AND system second-system in cluster test-cluster in branch master builds test-system
    AND system second-system in cluster test-cluster in branch master has deployment type: tar

    WHEN the user builds the system test-system in branch master
    AND the user attempts to deploy the cluster test-cluster in branch master with options test-system.location="$DATADIR/test-system.tar" second-system.location="$DATADIR/second-system.tar"
    THEN morph succeeded

We should also check that both systems were deployed as expected.

    THEN file test-system.tar exists
    AND file second-system.tar exists