@@ -38,6 +38,36 @@ func createDemoProject(projectID int, noneKeyID int, emptyEnvID int, store db.St
38
38
var devInv db.Inventory
39
39
var prodInv db.Inventory
40
40
41
+ var buildView db.View
42
+ var deployView db.View
43
+ var toolsView db.View
44
+
45
+ buildView , err = store .CreateView (db.View {
46
+ ProjectID : projectID ,
47
+ Title : "Build" ,
48
+ Position : 0 ,
49
+ })
50
+
51
+ if err != nil {
52
+ return
53
+ }
54
+
55
+ deployView , err = store .CreateView (db.View {
56
+ ProjectID : projectID ,
57
+ Title : "Deploy" ,
58
+ Position : 1 ,
59
+ })
60
+
61
+ if err != nil {
62
+ return
63
+ }
64
+
65
+ toolsView , err = store .CreateView (db.View {
66
+ ProjectID : projectID ,
67
+ Title : "Tools" ,
68
+ Position : 2 ,
69
+ })
70
+
41
71
if err != nil {
42
72
return
43
73
}
@@ -105,27 +135,28 @@ func createDemoProject(projectID int, noneKeyID int, emptyEnvID int, store db.St
105
135
return
106
136
}
107
137
108
- desc = "This task pings the website to provide real word example of using Semaphore."
138
+ desc = "Pings the website to provide a real-world example of using Semaphore."
109
139
_ , err = store .CreateTemplate (db.Template {
110
- Name : "Ping Site " ,
140
+ Name : "Ping google.com " ,
111
141
Playbook : "ping.yml" ,
112
142
Description : & desc ,
113
143
ProjectID : projectID ,
114
144
InventoryID : & prodInv .ID ,
115
145
EnvironmentID : & emptyEnvID ,
116
146
RepositoryID : demoRepo .ID ,
117
147
App : db .AppAnsible ,
148
+ ViewID : & toolsView .ID ,
118
149
})
119
150
120
151
if err != nil {
121
152
return
122
153
}
123
154
124
- desc = "Creates artifact and store it in the cache."
155
+ desc = "Creates a demo artifact and stores it in the cache."
125
156
126
157
var startVersion = "1.0.0"
127
158
buildTpl , err := store .CreateTemplate (db.Template {
128
- Name : "Build" ,
159
+ Name : "Build demo app " ,
129
160
Playbook : "build.yml" ,
130
161
Type : db .TemplateBuild ,
131
162
ProjectID : projectID ,
@@ -134,6 +165,7 @@ func createDemoProject(projectID int, noneKeyID int, emptyEnvID int, store db.St
134
165
RepositoryID : demoRepo .ID ,
135
166
StartVersion : & startVersion ,
136
167
App : db .AppAnsible ,
168
+ ViewID : & buildView .ID ,
137
169
})
138
170
139
171
if err != nil {
@@ -142,7 +174,7 @@ func createDemoProject(projectID int, noneKeyID int, emptyEnvID int, store db.St
142
174
143
175
var template db.Template
144
176
template , err = store .CreateTemplate (db.Template {
145
- Name : "Deploy to Dev" ,
177
+ Name : "Deploy demo app to Dev" ,
146
178
Type : db .TemplateDeploy ,
147
179
Playbook : "deploy.yml" ,
148
180
ProjectID : projectID ,
@@ -152,6 +184,7 @@ func createDemoProject(projectID int, noneKeyID int, emptyEnvID int, store db.St
152
184
BuildTemplateID : & buildTpl .ID ,
153
185
Autorun : true ,
154
186
App : db .AppAnsible ,
187
+ ViewID : & deployView .ID ,
155
188
})
156
189
157
190
if err != nil {
@@ -171,7 +204,7 @@ func createDemoProject(projectID int, noneKeyID int, emptyEnvID int, store db.St
171
204
}
172
205
173
206
template , err = store .CreateTemplate (db.Template {
174
- Name : "Deploy to Production" ,
207
+ Name : "Deploy demo app to Production" ,
175
208
Type : db .TemplateDeploy ,
176
209
Playbook : "deploy.yml" ,
177
210
ProjectID : projectID ,
@@ -180,6 +213,7 @@ func createDemoProject(projectID int, noneKeyID int, emptyEnvID int, store db.St
180
213
RepositoryID : demoRepo .ID ,
181
214
BuildTemplateID : & buildTpl .ID ,
182
215
App : db .AppAnsible ,
216
+ ViewID : & deployView .ID ,
183
217
})
184
218
185
219
if err != nil {
@@ -194,6 +228,55 @@ func createDemoProject(projectID int, noneKeyID int, emptyEnvID int, store db.St
194
228
Type : "password" ,
195
229
})
196
230
231
+ if err != nil {
232
+ return
233
+ }
234
+
235
+ template , err = store .CreateTemplate (db.Template {
236
+ Name : "Apply infrastructure" ,
237
+ Type : db .TemplateTask ,
238
+ Playbook : "" ,
239
+ ProjectID : projectID ,
240
+ EnvironmentID : & emptyEnvID ,
241
+ RepositoryID : demoRepo .ID ,
242
+ BuildTemplateID : & buildTpl .ID ,
243
+ App : db .AppTofu ,
244
+ ViewID : & buildView .ID ,
245
+ })
246
+
247
+ if err != nil {
248
+ return
249
+ }
250
+
251
+ template , err = store .CreateTemplate (db.Template {
252
+ Name : "Print system info (Bash)" ,
253
+ Type : db .TemplateTask ,
254
+ Playbook : "print_system_info.sh" ,
255
+ ProjectID : projectID ,
256
+ InventoryID : & prodInv .ID ,
257
+ EnvironmentID : & emptyEnvID ,
258
+ RepositoryID : demoRepo .ID ,
259
+ BuildTemplateID : & buildTpl .ID ,
260
+ App : db .AppBash ,
261
+ ViewID : & toolsView .ID ,
262
+ })
263
+
264
+ if err != nil {
265
+ return
266
+ }
267
+
268
+ template , err = store .CreateTemplate (db.Template {
269
+ Name : "Print system info (PowerShell)" ,
270
+ Type : db .TemplateTask ,
271
+ Playbook : "print_system_info.ps1" ,
272
+ ProjectID : projectID ,
273
+ InventoryID : & prodInv .ID ,
274
+ EnvironmentID : & emptyEnvID ,
275
+ RepositoryID : demoRepo .ID ,
276
+ BuildTemplateID : & buildTpl .ID ,
277
+ App : db .AppPowerShell ,
278
+ ViewID : & toolsView .ID ,
279
+ })
197
280
return
198
281
}
199
282
0 commit comments