-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathJenkinsfile
89 lines (62 loc) · 1.66 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
pipeline {
agent any
parameters {
string defaultValue: 'myname', description: '', name: 'test1', trim: true
}
stages {
stage ('stage1'){
steps{
echo "stage 1 step ${$env:studentname}"
}
}
stage ('stage 2')
{
steps {
powershell 'write-output "Hello, World !"'
}
}
stage ('stage3'){
steps{
echo "stage 2 step changes "
}
}
stage ('stage 4')
{
steps {
powershell 'write-output "Hello, World ! ${env:studentname}"'
}
}
stage('stage 5')
{
environment {
service = powershell(returnStatus: true, script: 'get-service -name ${env:studentname}')
}
steps {
powershell 'write-output "${service}"'
// Success!
}
}
stage ('stage 6')
{
input{
message "Press Ok to continue"
submitter "user1,user2"
parameters {
string(name:'username', defaultValue: 'user', description: 'Username of the user pressing Ok')
}
}
steps{
//echo "User: ${username} said OK"
powershell 'write-output ${env:username}'
}
}
// use full refrence
//http://jenkins3.southindia.cloudapp.azure.com:8080/pipeline-syntax/globals
//http://groovy-lang.org/semantics.html
// mail to: 'devops@acme.com',
//subject: "Job '${JOB_NAME}' (${BUILD_NUMBER}) is waiting for input",
//body: "Please go to ${BUILD_URL} and verify the build"
// ${YOUR_JENKINS_URL}/directive-generator.
//https://jenkins.io/doc/pipeline/steps/pipeline-input-step/
}
}