pipline script 填入一下内容, 修改credential的id和git的url以及存放的目录pipeline {
agent any
stages {
stage('create directory') {
steps {
sh 'sudo mkdir -p /gitlabel/test-project'
}
}
stage('git pull') {
steps {
checkout(
[
$class: 'GitSCM',
branches: [[name: '*/master']],
extensions: [
[
$class: 'CloneOption', timeout: 15
],
[
$class: 'RelativeTargetDirectory',
relativeTargetDir: '/gitlabel/test-project'
]
],
userRemoteConfigs: [[
credentialsId: 'gitlab_credential',
url: 'git@xxxxxxx/test-project.git'
]]
]
)
}
}
stage('maven build') {
steps {
sh 'cd /gitlabel/test-project && mvn clean package -DskipTests'
}
}
}