疑点:超时错误詹金斯



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

我想做的是使用 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:Jenkinsworkspacecheckout-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

未考虑您使用的超时命令timeout(60( {//your command},并且正在使用默认值,即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']]])
    }`
    

希望对:)有所帮助

相关内容

  • 没有找到相关文章

最新更新