Jenkinsfile管道未检出git



Jenkinsfile未能提取我的selenium代码来运行自动测试,我尝试了不同的方法,但仍然未能实现我所需要的。我认为我走错了方向。如果错误,请纠正我

#!groovy
pipeline {
agent any
stages {
stage('Checkout') {
steps {
echo 'Checkout'
}
}
stage('Build') {
steps {
echo 'Clean Build'
}
}
stage('Deploy') {
when { branch 'develop' }
steps {
echo 'Deploying'
}
}
stage('Integration Test') {
steps {
node("Android-Build") {
def mvnHome = tool 'Maven'
stage 'Integration Test'
git url: 'git@bitbucket.org:automation-web.git', branch: 'feature/WebAutomation'
sh "${mvnHome}/bin/mvn compile"
stage 'Test'
sh "${mvnHome}/bin/mvn test"
}
}
}
}
}

尝试:

checkout([
$class: 'GitSCM', 
branches: [[name: 'feature/WebAutomation']], 
doGenerateSubmoduleConfigurations: false, 
extensions: [], 
submoduleCfg: [], 
userRemoteConfigs: [[
credentialsId: 'xxx', 
url: 'git@bitbucket.org:automation-web.git'
]]
])

而不是:

git url: 'git@bitbucket.org:automation-web.git', branch: 'feature/WebAutomation'

解决方案2:

stage('Integration Test') {
steps {
script {
def mvnHome = tool 'Maven'
checkout([$class: 'GitSCM', branches: [[name: 'master']], doGenerateSubmoduleConfigurations: false, extensions: [],submoduleCfg: [], userRemoteConfigs: [[url:'git@bitbucket.org:automation-web.git']]])
sh "${mvnHome}/bin/mvn compile"
sh "${mvnHome}/bin/mvn test"
}
}
}

你不能把舞台放在舞台上。检查图声明性管道:图

最新更新