summaryrefslogtreecommitdiff
path: root/snippets/jenkins.snippets
blob: 2dccd40e95118183746b1a606866b8161db6af04 (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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
snippet steps
	steps {
		sh '${1:make check}'
		junit '${2:reports/**/*.xml}' 
	}
	${0}

snippet stage
	stage('${1:Test}'){
		steps {
			sh '${2:make check}'
			junit '${3:reports/**/*.xml}' 
		}
	}
	${0}

snippet pipeline
	pipeline {
		agent any 
		stages {
			stage('${1:Build}') { 
				steps { 
					sh '${2:make}' 
				}
			}
		}
	}
	${0}

snippet pipeline_sample
	pipeline {
		agent any 
		stages {
			stage('${1:Build}') { 
				steps { 
					sh '${2:make}' 
				}
			}
			stage('${3:Test}'){
				steps {
					sh '${4:make check}'
					junit '${5:reports/**/*.xml}' 
				}
			}
			stage('${6:Deploy}') {
				steps {
					sh '${7:make publish}'
				}
			}
		}
	}
	${0}

snippet d
	docker {
		image '${1:myregistry.com/node'}'
		label '${2:my-defined-label'}'
		registryUrl '${3:https://myregistry.com/'}'
		registryCredentialsId '${4:myPredefinedCredentialsInJenkins'}'
	}


snippet df
	dockerfile {
		filename '${1:Dockerfile.build}'
		dir '${2:build}'
		label '${3:my-defined-label}'
		registryUrl '${4:https://myregistry.com/}'
		registryCredentialsId '${5:myPredefinedCredentialsInJenkins}'
	}

snippet  pa
	post { 
		always { 
			${1}
		}
	}
	${0}

snippet  pc
	post { 
		changed { 
			${1}
		}
	}
	${0}

snippet  pf
	post { 
		fixed { 
			${1}
		}
	}
	${0}

snippet  pr
	post { 
		regression { 
			${1}
		}
	}
	${0}

snippet  pab
	post { 
		aborted { 
			${1}
		}
	}
	${0}

snippet pfa 
	post { 
		failure { 
			${1}
		}
	}
	${0}

snippet ps
	post { 
		success { 
			${1}
		}
	}
	${0}

snippet pu
	post { 
		unstable { 
			${1}
		}
	}
	${0}

snippet  pc
	post { 
		cleanup { 
			${1}
		}
	}
	${0}


snippet psss
	pipeline {
		agent any 
		stages {
			stage('${1:Build}') { 
				steps { 
					sh '${2:make}' 
				}
			}
	}
	${0}

snippet sss
	stages {
		stage('${1:Build}') { 
			steps { 
				sh '${2:make}' 
			}
		}
	}
	${0}



snippet parameters
	parameters{ 
		${1}
	}
	${0}

snippet paramtext
		text(name: "${1:BIOGRAPHY}" , defaultValue: "${2:default}" , description: "${3:Enter some information about the person}")
		${0}

snippet parambool
		booleanParam(name: "${1:TOGGLE}" , defaultValue: ${2:default}, description: "${3:Toggle this value}")
		${0}

snippet paramchoice
		choice(name: "${1:CHOICE}" , choices: ["${2:Choices}",] , description: "${3:Pick something}") 
		${0}

snippet parampassword
		password(name: "${1:PASSWORD}" , defaultValue: "${2:SECRET}" , description: "${3:Enter a password}")
		${0}

snippet paramfile
		file(name: "${1:FILE}" , description: "${2:Choose a file to upload}")${0}
		${0}

snippet triggers
	triggers {
		cron('${1:H */4 * * 1-5}')
	}
	${0}

snippet input
	input {
		message '${1:Should we continue?}'
		ok '${2:Yes, we should.}'
		submitter '${3:alice,bob}'
		parameters { 
			string(name: '${4:PERSON}' , defaultValue: '${5:Mr Jenkins}' , description: '${6:Who should I say hello to?}')
		}
	}
	${0}

snippet whenbranch
	when {
		branch '${1:branch}'
	}
	${0}
snippet whenbuildingTag
	when {
		buildingTag '${1:tag}'
	}
	${0}
snippet whenchangelog
	when {
		changelog '${1:changelog}'
	}
	${0}
snippet whenchangeset
	when {
		changeset '${1:changeSet}'
	}
	${0}
snippet whenchangeRequest
	when {
		changeRequest '${1:changeRequest}'
	}
	${0}
snippet whenenvironment
	when {
		environment '${1:environment}'
	}
	${0}
snippet whenequals
	when {
		equals '${1:equals}'
	}
	${0}
snippet whenexpression
	when {
		expression '${1:expression}'
	}
	${0}
snippet whentag
	when {
		tag '${1:tag}'
	}
	${0}
snippet whennot
	when {
		not '${1:not}'
	}
	${0}
snippet whenallOf
	when {
		allOf '${1:allOf}'
	}
	${0}
snippet whenanyOf
	when {
		anyOf '${1:anyOf}'
	}