forked from electric-cloud-community/DSL-Samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
example60Pipeline.groovy
executable file
·120 lines (93 loc) · 2.84 KB
/
example60Pipeline.groovy
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
/*
Format: Electric Flow DSL
File: example60Pipeline.groovy
Description: Example Pipeline model using the new 6.0 pipeline feature
Run basicDeployModel first:
ectool --format json evalDsl --dslFile basicDeployModel.groovy
Then this model:
ectool evalDsl --dslFile example60Pipeline.groovy
Kick off the pipeline form the user interface
*/
// Settings
def proj = "Default"
def pipe = "Example Pipeline"
def app = "Sample Deploy Application"
// Environment names ["env1", "env2" ...]
def envs = [dev: "sample-dev", qa: "sample-qa"]
def stages = [dev: "Development", qa: "Testing"]
project proj, {
// Procedure to create a development snapshot
procedure "Create Snapshot", {
formalParameter "environment",
required: "1",
expansionDeferred: "1"
step "Delete the snapshot",
command: "ectool deleteSnapshot Default \"$app\" \"$app-1.0\" "
step "createSnapshot",
command: "ectool createSnapshot Default \"$app\" \"$app-1.0\" --environmentName \"$envs.dev\" "
}
// Dummy system tests
procedure "System Tests", {
step "Tests",
command: "echo Testing..."
step "Collect Test Results",
command: "ectool setProperty /myPipelineStageRuntime/ec_summary/testResults " +
// Dummy location...
"\'" + '<html><a href=\"TestResultsSummary.html\">Test Results</a></html>' + "\'"
}
pipeline pipe, {
// Pipeline parameters
formalParameter "app",
type: "entry",
required: "1",
defaultValue: "Example Pipeline",
label: "Application Name",
orderIndex: 1
// Development State
stage stages.dev, {
task "Deploy",
taskType: "PROCESS",
subapplication: app,
subproject: proj,
subprocess: "Deploy",
taskProcessType: "APPLICATION",
environmentName: envs.dev,
clearActualParameters: "true",
actualParameter: [ ec_smartDeployOption: "true" ],
errorHandling: "ignore"
task "Create Snapshot",
taskType: 'PROCEDURE',
subproject: projectName,
subprocedure: 'Create Snapshot',
expansionDeferred: "1",
actualParameter: [
environment: envs.dev
],
errorHandling: "ignore"
} // Dev Stage
stage stages.qa, {
// Entry gate to QA
task "Entry gate approval",
taskType: 'APPROVAL',
approver: ['admin'],
gateType: 'PRE',
notificationTemplate: 'ec_default_pipeline_notification_template'
task "Deploy",
subapplication: app,
subproject: projectName,
subprocess: "Deploy",
taskProcessType: "APPLICATION",
environmentName: envs.qa,
advancedMode: "1", // allow for variable snapshotName
snapshotName: "$app-1.0",
clearActualParameters: true,
taskType: "PROCESS",
actualParameter: [ ec_smartDeployOption: "true" ],
errorHandling: "ignore"
task "System Tests",
taskType: 'PROCEDURE',
subproject: projectName,
subprocedure: 'System Tests'
} // Stage QA
} // Pipeline
} // Project