Can not generate branch job with Jenkinsfile!

31 views
Skip to first unread message

leye yi

unread,
Jan 18, 2017, 2:19:13 AM1/18/17
to Jenkins Users
Hi,

We update jenkins to 2.4.0 version ,and use Blue Ocean feature, when we create a new Multibranch Pipeline,the pipeline can not generate the branch job with Jenkinsfile,the Floder is empty

This is our Jenkinsfile:

###
#!Groovy
node {
//gloable
def workspace = '''$WORKSPACE'''

checkout scm


stage('Build') {
// Run the maven build
sh "'mvn' clean package -Ptest -Dmaven.test.skip=true -U"

}

stage('Artifacts') {
archiveArtifacts 'target/*.war'
}

stage('test&sonar'){

sh "cd ${WORKSPACE}"

//kill process
sh '''ps -ef | grep 8090 | grep -v grep | awk '{print $2}' | sed -e "s/^/kill -9 /g" | sh -'''

//excute junit
sh '''mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent install -Pcoverage-per-test'''

//update data to sonar server
sh '''mvn sonar:sonar'''

}

stage('Deploy'){

//clean env

sh '''rm -rf /data/tomcat-bi-support-8090/temp/*

rm -rf /data/tomcat-bi-support-8090/work/*

rm -rf /data/tomcat-bi-support-8090/webapps/*

'''
sh '''Pid=$(netstat -nlp | grep 8090 | awk '{print $7}' | awk -F"/" '{ print $1 }')
if [ ! $Pid ]; then
echo "PID is NONE"
else
echo $Pid
kill -9 $Pid
fi
'''
sh "cp ${workspace}/target/*.war /data/tomcat-bi-support-8090/webapps/bi-support.war"
sh '''/data/tomcat-bi-support-8090/bin/startup.sh'''

}
}
####
Reply all
Reply to author
Forward
0 new messages