怀疑:TimeOut错误詹金斯

时间:2017-08-17 13:16:30

标签: jenkins

我遇到了关于超时问题的问题,当我构建自由式作业时,我收到以下错误。

我想要做的是使用shell脚本命令行参数运行各种RTT测试。

我的代码是:

pipeline {
    agent any

    stages {
        stage('Checkout sws-vagrant') {
            steps {
                timeout(60) {
                git branch: 'master_windows', credentialsId: '1d17027a-34b5-4157-93d8-804d0cd56c0a', url: 'git@bitbucket.org:shipwire/sws-vagrant.git'
            }
        }
    }

        stage('Vagrant Up Environment Stage') {
            steps {
                sh 'vagrant up'
            }
        }

        stage('Vagrant SSH Stage') {
            steps {
                sh 'vagrant ssh'
            }
        }

        stage('Redirect to RestTests directory') {
            steps {
                sh 'cd /vagrant/src/shipwire/frontend/v2/tests/RestTests/'
            }
        }

        stage('Restart HTTPD Service') {
            steps {
                sh 'sudo service httpd restart'
            }
        }

        stage('Run the RTT tests') {
            steps {
                sh 'rtt -concurrency=4 test-plans/v3apis/products/products.rtt'
                }
            }
        }
    }

作为管道脚本。

我想要做的是在管道语法中将超时设置为60-300分钟或MINUTES。

当我构建我的作业时,显示控制台错误如下:

我的控制台错误输出显示:

Started by user Doga Ozer
[Pipeline] node
Running on master in C:\Jenkins\workspace\checkout-vagrant
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Checkout sws-vagrant)
[Pipeline] timeout
Timeout set to expire in 1 hr 0 min
[Pipeline] {
[Pipeline] git
 > git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
 > git config remote.origin.url git@bitbucket.org:shipwire/sws-vagrant.git # timeout=10
Fetching upstream changes from git@bitbucket.org:shipwire/sws-vagrant.git
 > git --version # timeout=10
using GIT_SSH to set credentials Shipwire Bitbucket Private Key 2
 > git fetch --tags --progress git@bitbucket.org:shipwire/sws-vagrant.git +refs/heads/*:refs/remotes/origin/*
ERROR: Timeout after 10 minutes
ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from git@bitbucket.org:shipwire/sws-vagrant.git
    at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:812)
    at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1079)
    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1110)
    at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:113)
    at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:85)
    at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:75)
    at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47)
    at hudson.security.ACL.impersonate(ACL.java:260)
    at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:44)
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: hudson.plugins.git.GitException: Command "git fetch --tags --progress git@bitbucket.org:shipwire/sws-vagrant.git +refs/heads/*:refs/remotes/origin/*" returned status code -1:
stdout: 
stderr: remote: Counting objects: 2444           
remote: Counting objects: 6663, done.        
remote: Compressing objects:   0% (1/2841)           
remote: Compressing objects:   1% (29/2841)           

Receiving objects:  97% (6498/6663), 346.40 MiB | 366.00 KiB/s   

    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1903)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1622)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:71)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:348)
    at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:810)
    ... 13 more
[Pipeline] }
[Pipeline] // timeout
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Vagrant Up Environment Stage)
Stage 'Vagrant Up Environment Stage' skipped due to earlier failure(s)
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Vagrant SSH Stage)
Stage 'Vagrant SSH Stage' skipped due to earlier failure(s)
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Redirect to RestTests directory)
Stage 'Redirect to RestTests directory' skipped due to earlier failure(s)
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Restart HTTPD Service)
Stage 'Restart HTTPD Service' skipped due to earlier failure(s)
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Run the RTT tests)
Stage 'Run the RTT tests' skipped due to earlier failure(s)
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: Error fetching remote repo 'origin'
Finished: FAILURE

1 个答案:

答案 0 :(得分:1)

您正在使用的超时命令超时(60){//您的命令} 未被考虑且默认值正在使用且 10

相反,有两种方法,

  1. 您可以在 scm 部分下覆盖附加行为的超时,然后在那里您可以指定超时到所需的值。在我的情况下,将其设置为 30 解决了问题。
  2. 您可以借助管道语法来生成用于检出项目的管道脚本。以下是适用于我的示例代码段,您可以根据自己的方便进行调整:

    `stage('Checkout sws-vagrant') {
        steps {
            checkout([$class: 'GitSCM', branches: [[name: 'BRANCH_NAME']], browser: [$class: 'GitBlitRepositoryBrowser', projectName: 'PROJECT_NAME', repoUrl: 'REPO_URL (for ex: github.com)'], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false, timeout: 30]], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'CREDENTIALS_ID', url: 'URL']]])
    
    }`
    
  3. 希望有所帮助:)