2017-08-17 17 views
0

私はフリースタイルジョブをビルドするときに次のエラーが発生するタイムアウトの問題に関して問題があります。疑問:TimeOutエラーJenkins

私がしたいことは、シェルスクリプトコマンドラインパラメータを使用してさまざまなRTTテストを実行することです。

私のコードは次のとおりです。パイプラインスクリプトとして

pipeline { 
    agent any 

    stages { 
     stage('Checkout sws-vagrant') { 
      steps { 
       timeout(60) { 
       git branch: 'master_windows', credentialsId: '1d17027a-34b5-4157-93d8-804d0cd56c0a', url: '[email protected]: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 [email protected]:shipwire/sws-vagrant.git # timeout=10 
Fetching upstream changes from [email protected]:shipwire/sws-vagrant.git 
> git --version # timeout=10 
using GIT_SSH to set credentials Shipwire Bitbucket Private Key 2 
> git fetch --tags --progress [email protected]: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 [email protected]: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 [email protected]: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

timeoutコマンドタイムアウト(60){//あなたのコマンド}をあなたが使用していたものが考慮されておらず、デフォルト値が使用されていて、それはです。

代わりに、二つの方法、

  1. あなたは追加の動作下SCMセクションからタイムアウトを無効にすることができますし、あそこにあなたが所望の値にタイムアウトを指定することができますがあります。私の場合はに設定して問題を解決しました。
  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']]]) 

}` 
はそれが役に立てば幸い:)