Browse Source

Jenkinsfile added

master
Thomas Papendieck 6 years ago
parent
commit
7bb1ede2df
  1. 3
      src/main/script/Jenkinsfile-2.groovy
  2. 31
      src/main/script/Jenkinsfile.groovy
  3. 5
      src/main/script/PipelineStep.groovy
  4. 5
      vars/PipeLineStepTest.groovy
  5. 6
      vars/testBuildFileName.groovy

3
src/main/script/Jenkinsfile-2.groovy

@ -0,0 +1,3 @@
library identifier:'jenkinsfileExample@current', retriever:legacySCM(scm)
testBuildFileName()

31
src/main/script/Jenkinsfile.groovy

@ -0,0 +1,31 @@
pipeline {
agent any
tools {
maven 'maven-3.6.0'
}
stages {
stage("SCM checkout"){
steps{
echo "BRANCH_NAME: ${env.BRANCH_NAME}"
checkout scm
}
}
stage("branch processing"){
steps{
echo "BRANCH_NAME: ${env.BRANCH_NAME}"
script {
if (env.BRANCH_NAME.startsWith("feature")) {
echo "rebase ${env.BRANCH_NAME} on develop"
}
}
}
}
stage("maven build"){
steps{
sh '''mvn clean install'''
}
}
}
}

5
src/main/script/PipelineStep.groovy

@ -0,0 +1,5 @@
class PipelineStep{
def run(script){
println( "inside class")
}
}

5
vars/PipeLineStepTest.groovy

@ -0,0 +1,5 @@
class PipeLineStepTest{
def run(script, env){
script.echo "second test"
}
}

6
vars/testBuildFileName.groovy

@ -0,0 +1,6 @@
def call(){
node {
echo "test"
new PipeLineStepTest().run(this, env)
}
}
Loading…
Cancel
Save