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
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.deployment;
import com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType;
import java.util.Collections;
import java.util.EnumSet;
import java.util.Set;
import static com.yahoo.vespa.hosted.controller.deployment.Step.copyVespaLogs;
import static com.yahoo.vespa.hosted.controller.deployment.Step.deactivateReal;
import static com.yahoo.vespa.hosted.controller.deployment.Step.deactivateTester;
import static com.yahoo.vespa.hosted.controller.deployment.Step.deployInitialReal;
import static com.yahoo.vespa.hosted.controller.deployment.Step.deployReal;
import static com.yahoo.vespa.hosted.controller.deployment.Step.deployTester;
import static com.yahoo.vespa.hosted.controller.deployment.Step.endStagingSetup;
import static com.yahoo.vespa.hosted.controller.deployment.Step.endTests;
import static com.yahoo.vespa.hosted.controller.deployment.Step.installInitialReal;
import static com.yahoo.vespa.hosted.controller.deployment.Step.installReal;
import static com.yahoo.vespa.hosted.controller.deployment.Step.installTester;
import static com.yahoo.vespa.hosted.controller.deployment.Step.report;
import static com.yahoo.vespa.hosted.controller.deployment.Step.startStagingSetup;
import static com.yahoo.vespa.hosted.controller.deployment.Step.startTests;
/**
* Static profiles defining the {@link Step}s of a deployment job.
*
* @author jonmv
*/
public enum JobProfile {
systemTest(EnumSet.of(deployReal,
installReal,
deployTester,
installTester,
startTests,
endTests,
copyVespaLogs,
deactivateTester,
deactivateReal,
report)),
stagingTest(EnumSet.of(deployInitialReal,
deployTester,
installTester,
installInitialReal,
startStagingSetup,
endStagingSetup,
deployReal,
installReal,
startTests,
endTests,
copyVespaLogs,
deactivateTester,
deactivateReal,
report)),
production(EnumSet.of(deployReal,
installReal,
report)),
productionTest(EnumSet.of(deployTester,
installTester,
startTests,
endTests,
copyVespaLogs,
deactivateTester,
report)),
development(EnumSet.of(deployReal,
installReal,
copyVespaLogs)),
developmentDryRun(EnumSet.of(deployReal));
private final Set<Step> steps;
JobProfile(Set<Step> steps) {
this.steps = Collections.unmodifiableSet(steps);
}
// TODO jonmv: Let caller decide profile, and store with run?
public static JobProfile of(JobType type) {
switch (type.environment()) {
case test: return systemTest;
case staging: return stagingTest;
case prod: return type.isTest() ? productionTest : production;
case perf:
case dev: return development;
default: throw new AssertionError("Unexpected environment '" + type.environment() + "'!");
}
}
/** Returns all steps in this profile, the default for which is to run only when all prerequisites are successes. */
public Set<Step> steps() { return steps; }
}
|