首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Jenkinsfile管道未检出git

Jenkinsfile管道未检出git
EN

Stack Overflow用户
提问于 2018-11-07 21:29:39
回答 1查看 576关注 0票数 0

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

代码语言:javascript
复制
#!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"
                }
            }
        }

    }

}
EN

回答 1

Stack Overflow用户

发布于 2018-11-07 21:49:38

尝试:

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

而不是:

代码语言:javascript
复制
git url: 'git@bitbucket.org:automation-web.git', branch: 'feature/WebAutomation'

Solution2:

代码语言:javascript
复制
 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"
             }
         }
         }

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

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/53190437

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档