-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
142 lines (133 loc) · 3.8 KB
/
Jenkinsfile
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
pipeline {
agent any
// this section configures Jenkins options
options {
// only keep 10 logs for no more than 10 days
// Es werden nur 10 Logs für höchstens 10 Tage beibehalten.
buildDiscarder(logRotator(daysToKeepStr: '10', numToKeepStr: '10'))
// add timestamps to the log
timestamps()
}
// the pipeline section we all know and love: stages! :D
stages {
stage('Requirements') {
steps {
echo 'Installing requirements...'
}
}
stage('Build') {
steps {
echo 'Building..'
}
}
stage('Test') {
steps {
echo 'Testing..'
}
}
stage('Report') {
steps {
echo 'Reporting....'
}
}
}
// the post section is a special collection of stages
// that are run after all other stages have completed
// Post-Abschnitt wird ausgeführt , nachdem alle anderen Stages abgeschlossen sind.
post {
// the always stage will always be run
// always wird immer ausgeführt.
always {
// a "steps{...}" section is not needed.
echo "This step will run after all other steps have finished. It will always run, even in the status of the build is not SUCCESS"
}
failure {
echo 'failure ...'
}
success {
echo ' yoohooo'
}
}
}
/////////////////////////////////////condition///////////////////////////////////////////////////
// pipeline {
// agent any
// stages {
// stage('install') {
// when {
// expression {
// env.BRANCH_NAME == 'dev' || env.BRANCH_NAME == 'master'
// }
// }
// steps {
// echo 'Installing requirements...'
// }
// }
// stage('Build') {
// steps {
// echo 'Building..'
// }
// }
// }
// }
///////////////////////////////////environment///////////////////////////////////////////////////
// pipeline {
// agent any
// environment {
// TEST_SERVER = 'www.url.com'
// BOOLEAN_VAR = 'true' //boolean value as string
// }
// stages {
// stage('install') {
// when {
// expression {
// env.BOOLEAN_VAR.toBoolean()
// }
// }
// steps {
// echo 'Installing requirements...'
// }
// }
// stage('Build') {
// steps {
// echo 'Building..'
// }
// }
// }
// }
////////////////////////////////credentials//////////////////////////////////////////////////////
// pipeline {
// agent any
// environment {
// TEST_SERVER = credentials('test-server')
// TEST_SERVER_URL = 'www.url.com'
// }
// stages {
// stage('install') {
// steps {
// echo 'Installing requirements...'
// }
// }
// stage('deploy') {
// steps {
// echo 'deploying the app ...'
// // Jenkins always adds _USR and _PSW endings to the names of the variables.
// //sh "docker login '${TEST_SERVER_URL}' --password '${TEST_SERVER_PSW}' --username '${TEST_SERVER_USR}'"
// }
// }
// }
// }
/////////////////////////////TOOLS//////////////////////////////////////////////////////
// pipeline {
// agent any
// tools {
// nodejs "node-22.2"
// }
// stages {
// stage('install') {
// steps {
// sh 'npm -v'
// }
// }
// }
// }