|
| 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