2017-08-17 4 views
0

Ich habe ein Problem in Bezug auf das Timeout-Problem, wo, wenn ich den Freestyle-Job erstelle ich den folgenden Fehler bekomme.Zweifel an: TimeOut Error Jenkins

Ich möchte verschiedene RTT-Tests mit dem Kommandozeilenparameter Shell-Skript ausführen.

mein Code:

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' 
       } 
      } 
     } 
    } 

Als Pipeline Script.

Was ich tun möchte, ist, mein Timeout zwischen 60-300 Minuten oder MINUTES wie in Pipeline-Syntax.

Wenn ich meinen Job bauen es zeigt, die Konsole Fehler wie folgt:

My Console Fehlerausgabe zeigt:

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 

Antwort

1

Der Timeout Befehl Timeout (60) {// your command} dass Sie verwendet haben, wird nicht berücksichtigt und der Standardwert wird verwendet und das ist .

Stattdessen gibt es zwei Möglichkeiten,

  1. Sie das Timeout von Zusätzlichen Behaviors außer Kraft setzen können unter scm Abschnitt und dort Sie das Timeout auf den gewünschten Wert festlegen. In meinem Fall löste ich das Problem auf .
  2. Sie können Hilfe Pipeline-Syntax zu Pipeline-Skript zum Auschecken des Projekts zu generieren.

    `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']]]) 
    
    }` 
    

Hoffe, es hilft :)

: Im Folgenden finden Sie Beispiel Schnipsel, die für mich gearbeitet haben, können Sie es nach Ihren Komfort einstellen