Skip to content

Commit a4fd68d

Browse files
authored
Merge pull request #5 from devops-workspace/master
add more use cases
2 parents 15a533e + a17f649 commit a4fd68d

2 files changed

Lines changed: 72 additions & 1 deletion

File tree

Jenkinsfile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
pipeline {
22
agent {
3-
label 'java'
3+
label 'maven'
44
}
55

66
options {
@@ -34,4 +34,10 @@ pipeline {
3434
}
3535
}
3636
}
37+
38+
post{
39+
always{
40+
junit 'target/surefire-reports/**/*.xml'
41+
}
42+
}
3743
}

Jenkinsfile-input

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
pipeline {
2+
agent any
3+
4+
stages{
5+
stage('simple'){
6+
steps{
7+
input message: 'Please input your name!', ok: 'Confirm',
8+
parameters: [string(defaultValue: 'rick',
9+
description: 'This should not be your real name.', name: 'name', trim: true)]
10+
}
11+
}
12+
13+
stage('complex'){
14+
parallel {
15+
stage('channel-1'){
16+
steps{
17+
input message: 'Please input your age!', ok: 'Confirm',
18+
parameters: [string(defaultValue: '18',
19+
description: 'Just a joke.', name: 'age', trim: true)]
20+
}
21+
}
22+
stage('channel-2'){
23+
steps{
24+
input message: 'Please input your weight!', ok: 'Confirm',
25+
parameters: [string(defaultValue: '50',
26+
description: 'Just a joke.', name: 'weight', trim: true)]
27+
}
28+
}
29+
}
30+
}
31+
32+
stage('use result'){
33+
parallel {
34+
stage('one param'){
35+
steps{
36+
script{
37+
result = input message: 'Please input the git branch name!', ok: 'Confirm',
38+
parameters: [string(defaultValue: 'master',
39+
description: 'The branch name of git repo', name: 'branchName', trim: true)]
40+
41+
git branch: result, url: 'https://github.com/devops-workspace/demo-junit'
42+
}
43+
}
44+
}
45+
46+
stage('multi-param'){
47+
steps{
48+
script{
49+
result = input message: 'Please input the git branch name with debug info!', ok: 'Confirm',
50+
parameters: [string(defaultValue: 'master',
51+
description: 'The branch name of git repo', name: 'branchName', trim: true),
52+
string(defaultValue: 'debug info',
53+
description: 'Output the debug info', name: 'debugInfo', trim: true)]
54+
55+
git branch: result.branchName, url: 'https://github.com/devops-workspace/demo-junit'
56+
echo result.debugInfo
57+
}
58+
}
59+
}
60+
61+
}
62+
}
63+
64+
}
65+
}

0 commit comments

Comments
 (0)