Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pipeline {
agent {
label 'java'
label 'maven'
}

options {
Expand All @@ -11,12 +11,14 @@ pipeline {
stages{
stage('Build & Test'){
steps{
try {
container('java'){
script{
try {
container('java'){
sh 'mvn clean package test'
}
} catch(e) {
sh 'mvn clean package test'
}
} catch(e) {
sh 'mvn clean package test'
}
}
}
Expand All @@ -32,4 +34,10 @@ pipeline {
}
}
}

post{
always{
junit 'target/surefire-reports/**/*.xml'
}
}
}
65 changes: 65 additions & 0 deletions Jenkinsfile-input
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
pipeline {
agent any

stages{
stage('simple'){
steps{
input message: 'Please input your name!', ok: 'Confirm',
parameters: [string(defaultValue: 'rick',
description: 'This should not be your real name.', name: 'name', trim: true)]
}
}

stage('complex'){
parallel {
stage('channel-1'){
steps{
input message: 'Please input your age!', ok: 'Confirm',
parameters: [string(defaultValue: '18',
description: 'Just a joke.', name: 'age', trim: true)]
}
}
stage('channel-2'){
steps{
input message: 'Please input your weight!', ok: 'Confirm',
parameters: [string(defaultValue: '50',
description: 'Just a joke.', name: 'weight', trim: true)]
}
}
}
}

stage('use result'){
parallel {
stage('one param'){
steps{
script{
result = input message: 'Please input the git branch name!', ok: 'Confirm',
parameters: [string(defaultValue: 'master',
description: 'The branch name of git repo', name: 'branchName', trim: true)]

git branch: result, url: 'https://github.com/devops-workspace/demo-junit'
}
}
}

stage('multi-param'){
steps{
script{
result = input message: 'Please input the git branch name with debug info!', ok: 'Confirm',
parameters: [string(defaultValue: 'master',
description: 'The branch name of git repo', name: 'branchName', trim: true),
string(defaultValue: 'debug info',
description: 'Output the debug info', name: 'debugInfo', trim: true)]

git branch: result.branchName, url: 'https://github.com/devops-workspace/demo-junit'
echo result.debugInfo
}
}
}

}
}

}
}