[JIRA] (JENKINS-49757) Git plugin calls fetch twice for a single job

2018-10-05 Thread oliver.pere...@gmail.com (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Oliver Pereira commented on  JENKINS-49757  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Git plugin calls fetch twice for a single job   
 

  
 
 
 
 

 
 Using a reference repository doesn't fix the issue. Using the command line git clone including reference repository, it takes approx 11 seconds and the same configuration via the checkout scm option takes 1 minute 3x seconds.    
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)  
 

  
 

   





-- 
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[JIRA] (JENKINS-49757) Git plugin calls fetch twice for a single job

2018-05-10 Thread mark.earl.wa...@gmail.com (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Mark Waite commented on  JENKINS-49757  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Git plugin calls fetch twice for a single job   
 

  
 
 
 
 

 
 Kaiyuan Zhao you're welcome to propose a pull request to the plugin to improve its behavior. Alternately, you could try replacing the "depth=2" with a reference repository to see if that would reduce the fetch time.  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e)  
 
 

 
   
 

  
 

  
 

   





-- 
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[JIRA] (JENKINS-49757) Git plugin calls fetch twice for a single job

2018-05-10 Thread dogin2...@hotmail.com (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Kaiyuan Zhao commented on  JENKINS-49757  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Git plugin calls fetch twice for a single job   
 

  
 
 
 
 

 
 Mark Waite Using "${GERRIT_REFSPEC}" fix the first problem.   

 

10:38:45 Cloning the remote Git repository
10:38:45 Using shallow clone
10:38:45 shallow clone depth 2
10:38:45 Avoid fetching tags
10:38:45 Honoring refspec on initial clone
10:38:45 Cloning repository hide
10:38:45 > git init hide # timeout=10
10:38:45 Fetching upstream changes from hide
10:38:45 > git --version # timeout=10
10:38:45 using GIT_SSH to set credentials 
10:38:45 > git fetch --no-tags --progress hide refs/changes/50/4750/1 --depth=2 # timeout=10
10:39:34 > git config remote.origin.url hide # timeout=10
10:39:34 > git config --add remote.origin.fetch refs/changes/50/4750/1 # timeout=10
10:39:34 > git config remote.origin.url hide # timeout=10
10:39:34 Fetching upstream changes from hide
10:39:34 using GIT_SSH to set credentials 
10:39:34 > git fetch --no-tags --progress hide refs/changes/50/4750/1 --depth=2 # timeout=10
10:40:34 > git rev-parse 44fd5ca794ef1d4ccbfb437d94ef804626dea726^{commit} # timeout=10
10:40:34 Checking out Revision 44fd5ca794ef1d4ccbfb437d94ef804626dea726 (refs/changes/50/4750/1)
10:40:34 > git config core.sparsecheckout # timeout=10
10:40:34 > git checkout -f 44fd5ca794ef1d4ccbfb437d94ef804626dea726 # timeout=10
10:40:38 Commit message: "hide"
10:40:38 > git rev-parse FETCH_HEAD^{commit} # timeout=10
10:40:38 > git rev-list --no-walk eb696053ba8f4c94c388db0334b886879e6aaa42 # timeout=10
 

 But it's also triggering fetch twice and the second fetch is not cost free. In our case, both fetch cost about one minute.  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e)  
 
 


[JIRA] (JENKINS-49757) Git plugin calls fetch twice for a single job

2018-05-10 Thread mark.earl.wa...@gmail.com (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Mark Waite commented on  JENKINS-49757  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Git plugin calls fetch twice for a single job   
 

  
 
 
 
 

 
 Kaiyuan Zhao since you're using Pipeline, you can expand the value of GERRIT_REFSPEC without relying on the git plugin internal environment variable expansion. Use:  

 

refspec  : "${GERRIT_REFSPEC}",
 

 instead of  

 

refspec  : '$GERRIT_REFSPEC',
 

 The bug report is specific to Freestyle jobs because the variable expansion for strings is not available to Freestyle jobs.  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e)  
 
 

 
   
 

  
 

  
 

   





-- 
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[JIRA] (JENKINS-49757) Git plugin calls fetch twice for a single job

2018-05-10 Thread dogin2...@hotmail.com (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Kaiyuan Zhao commented on  JENKINS-49757  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Git plugin calls fetch twice for a single job   
 

  
 
 
 
 

 
 Mark Waite First of all, my job is using Gerrit Trigger. When my Jenkinsfile is like   

 

def scm = [
$class   : 'GitSCM',
branches : [[name: '*/master']],
doGenerateSubmoduleConfigurations: false,
extensions   : [
[$class: 'WipeWorkspace'],
[$class: 'CloneOption', depth: 2, honorRefspec: true, noTags: true, reference: '', shallow: true, timeout: 10],
[$class: 'BuildChooserSetting', buildChooser: [$class: 'GerritTriggerBuildChooser']]
],
submoduleCfg : [],
userRemoteConfigs: [
[
credentialsId: 'hide',
refspec  : '$GERRIT_REFSPEC',
url  : 'hide'
]
]
]

pipeline {
agent {
node {
label 'gerrit'
}
}
options {
skipDefaultCheckout true
}
stages {
stage('CheckOut') {
steps {
checkout(scm)
}
}
}
}
 

 The console log     

 

Wiping out workspace first.
Cloning the remote Git repository
Using shallow clone
shallow clone depth 2
Avoid fetching tags
Honoring refspec on initial clone
Cloning repository hide
> git init hide # timeout=10
Fetching upstream changes from hide
> git --version # timeout=10
using GIT_SSH to set credentials
> git fetch --no-tags --progress hide $GERRIT_REFSPEC --depth=2 # timeout=10
> git config remote.origin.url hide # timeout=10
> git config --add remote.origin.fetch $GERRIT_REFSPEC # timeout=10
> git config remote.origin.url hide # timeout=10
Fetching upstream changes from hide
using GIT_SSH to set credentials
> git fetch --no-tags --progress hide refs/changes/64/4264/7 --depth=2 # timeout=10
> git rev-parse 4b5226960edd4551bbafc058db4afc0e69bd103f^{commit} # timeout=10
Checking out Revision 4b5226960edd4551bbafc058db4afc0e69bd103f (refs/changes/64/4264/7)
> git config core.sparsecheckout # timeout=10
> git checkout -f 4b5226960edd4551bbafc058db4afc0e69bd103f
Commit message: "hide"
> git rev-parse FETCH_HEAD^{commit} # timeout=10
> git rev-list --no-walk a1323feb6fa57ce13c87a5fd6886b14aa3f75dab # timeout=10
 

 Fetch twice and the first fetch cannot recognize $GERRIT_REFSPEC Then I changed my Jenkinsfile like   

 

def scm = [
$class   : 'GitSCM',
branches : [[name: '*/master']],
doGenerateSubmoduleConfigurations: false,
extensions   : [
[$class: 'CloneOption', depth: 2, honorRefspec: true, noTags: true, reference: '', shallow: true, timeout: 10],
[$class: 

[JIRA] (JENKINS-49757) Git plugin calls fetch twice for a single job

2018-05-09 Thread mark.earl.wa...@gmail.com (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Mark Waite commented on  JENKINS-49757  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Git plugin calls fetch twice for a single job   
 

  
 
 
 
 

 
 Kaiyuan Zhao I believe you are seeing a different condition. The `sh 'git iniit'` initializes an empty git repository in the workspace. The `checkout(scm)` step likely erases the newly created empty git repository and creates a new git repository populated with the results of fetching changes from the remote server. The deleteDir() step removes the workspace contents at the end. As far as I understand declarative Pipeline, it will perform the initial checkout implicitly (unless you'v added the skipDefaultCheckout property), then it sees your `checkout scm` and does it again.  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e)  
 
 

 
   
 

  
 

  
 

   





-- 
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[JIRA] (JENKINS-49757) Git plugin calls fetch twice for a single job

2018-05-09 Thread dogin2...@hotmail.com (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Kaiyuan Zhao commented on  JENKINS-49757  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
  Re: Git plugin calls fetch twice for a single job   
 

  
 
 
 
 

 
 Facing same issue when using gerrit trigger. My solution is using pipeline job like below 

 

stage('CheckOut') {
steps {
sh "git init"
checkout(scm)
}
}

post {
cleanup {
deleteDir()
}
} 

 Init git repo first will skip clone step. Do not use WipeWorkspace in scm step, clean workspace in post closure  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e)  
 
 

 
   
 

  
 

  
 

   





-- 
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[JIRA] (JENKINS-49757) Git plugin calls fetch twice for a single job

2018-03-02 Thread mark.earl.wa...@gmail.com (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Mark Waite updated an issue  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
 Jenkins /  JENKINS-49757  
 
 
  Git plugin calls fetch twice for a single job   
 

  
 
 
 
 

 
Change By: 
 Mark Waite  
 
 
Summary: 
 Git  clone  plugin  calls fetch twice for a single job  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e)  
 
 

 
   
 

  
 

  
 

   





-- 
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.