<p>George Joseph has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/9906">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">CI: Add https credentials to gerrit checkouts<br><br>If the review to be tested is in a project with restricted access,<br>we need to use the jenkins user's gerrit https credentials when we<br>do the checkout or the checkout will fail.<br><br>Change-Id: I9dc9994763c5ebfeb9f1cff60fb53f6902b7fd5f<br>---<br>M tests/CI/gates.jenkinsfile<br>M tests/CI/unittests.jenkinsfile<br>2 files changed, 70 insertions(+), 47 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/06/9906/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/tests/CI/gates.jenkinsfile b/tests/CI/gates.jenkinsfile</span><br><span>index ab0fd1c..c23114b 100644</span><br><span>--- a/tests/CI/gates.jenkinsfile</span><br><span>+++ b/tests/CI/gates.jenkinsfile</span><br><span>@@ -79,33 +79,44 @@</span><br><span> *</span><br><span> * The Gerrit Trigger provides all the URLs and refspecs to</span><br><span> * check out the change.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * We need to retrieve the jenkins2 gerrit https credentials</span><br><span style="color: hsl(120, 100%, 40%);">+ * in case this review is in a restricted project.</span><br><span> */</span><br><span style="color: hsl(0, 100%, 40%);">- checkout scm: [$class: 'GitSCM',</span><br><span style="color: hsl(0, 100%, 40%);">- branches: [[name: env.GERRIT_BRANCH ]],</span><br><span style="color: hsl(0, 100%, 40%);">- extensions: [</span><br><span style="color: hsl(0, 100%, 40%);">- [$class: 'ScmName', name: 'gerrit-public'],</span><br><span style="color: hsl(0, 100%, 40%);">- [$class: 'CleanBeforeCheckout'],</span><br><span style="color: hsl(0, 100%, 40%);">- [$class: 'PreBuildMerge', options: [</span><br><span style="color: hsl(0, 100%, 40%);">- mergeRemote: 'gerrit-public',</span><br><span style="color: hsl(0, 100%, 40%);">- fastForwardMode: 'NO_FF',</span><br><span style="color: hsl(0, 100%, 40%);">- mergeStrategy: 'RECURSIVE',</span><br><span style="color: hsl(0, 100%, 40%);">- mergeTarget: env.GERRIT_BRANCH]],</span><br><span style="color: hsl(0, 100%, 40%);">- [$class: 'CloneOption',</span><br><span style="color: hsl(0, 100%, 40%);">- honorRefspec: true,</span><br><span style="color: hsl(0, 100%, 40%);">- noTags: true,</span><br><span style="color: hsl(0, 100%, 40%);">- depth: 10,</span><br><span style="color: hsl(0, 100%, 40%);">- shallow: true</span><br><span style="color: hsl(0, 100%, 40%);">- ],</span><br><span style="color: hsl(0, 100%, 40%);">- [$class: 'PruneStaleBranch'],</span><br><span style="color: hsl(0, 100%, 40%);">- [$class: 'BuildChooserSetting',</span><br><span style="color: hsl(0, 100%, 40%);">- buildChooser: [$class: 'GerritTriggerBuildChooser']</span><br><span style="color: hsl(0, 100%, 40%);">- ]</span><br><span style="color: hsl(0, 100%, 40%);">- ],</span><br><span style="color: hsl(0, 100%, 40%);">- userRemoteConfigs: [</span><br><span style="color: hsl(0, 100%, 40%);">- [name: env.GERRIT_NAME, refspec: env.GERRIT_REFSPEC, url: env.GERRIT_PROJECT_URL ]</span><br><span style="color: hsl(0, 100%, 40%);">- ]</span><br><span style="color: hsl(0, 100%, 40%);">- ]</span><br><span style="color: hsl(120, 100%, 40%);">+ withCredentials([usernamePassword(credentialsId: env.JENKINS_GERRIT_CREDS,</span><br><span style="color: hsl(120, 100%, 40%);">+ usernameVariable: 'gerrit_user')]) {</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+ checkout scm: [$class: 'GitSCM',</span><br><span style="color: hsl(120, 100%, 40%);">+ branches: [[name: env.GERRIT_BRANCH ]],</span><br><span style="color: hsl(120, 100%, 40%);">+ extensions: [</span><br><span style="color: hsl(120, 100%, 40%);">+ [$class: 'ScmName', name: 'gerrit-public'],</span><br><span style="color: hsl(120, 100%, 40%);">+ [$class: 'CleanBeforeCheckout'],</span><br><span style="color: hsl(120, 100%, 40%);">+ [$class: 'PreBuildMerge', options: [</span><br><span style="color: hsl(120, 100%, 40%);">+ mergeRemote: 'gerrit-public',</span><br><span style="color: hsl(120, 100%, 40%);">+ fastForwardMode: 'NO_FF',</span><br><span style="color: hsl(120, 100%, 40%);">+ mergeStrategy: 'RECURSIVE',</span><br><span style="color: hsl(120, 100%, 40%);">+ mergeTarget: env.GERRIT_BRANCH]],</span><br><span style="color: hsl(120, 100%, 40%);">+ [$class: 'CloneOption',</span><br><span style="color: hsl(120, 100%, 40%);">+ honorRefspec: true,</span><br><span style="color: hsl(120, 100%, 40%);">+ noTags: true,</span><br><span style="color: hsl(120, 100%, 40%);">+ depth: 10,</span><br><span style="color: hsl(120, 100%, 40%);">+ shallow: true</span><br><span style="color: hsl(120, 100%, 40%);">+ ],</span><br><span style="color: hsl(120, 100%, 40%);">+ [$class: 'PruneStaleBranch'],</span><br><span style="color: hsl(120, 100%, 40%);">+ [$class: 'BuildChooserSetting',</span><br><span style="color: hsl(120, 100%, 40%);">+ buildChooser: [$class: 'GerritTriggerBuildChooser']</span><br><span style="color: hsl(120, 100%, 40%);">+ ]</span><br><span style="color: hsl(120, 100%, 40%);">+ ],</span><br><span style="color: hsl(120, 100%, 40%);">+ userRemoteConfigs: [</span><br><span style="color: hsl(120, 100%, 40%);">+ [</span><br><span style="color: hsl(120, 100%, 40%);">+ credentialsId: env.JENKINS_GERRIT_CREDS,</span><br><span style="color: hsl(120, 100%, 40%);">+ name: env.GERRIT_NAME,</span><br><span style="color: hsl(120, 100%, 40%);">+ refspec: env.GERRIT_REFSPEC,</span><br><span style="color: hsl(120, 100%, 40%);">+ url: env.GERRIT_PROJECT_URL.replaceAll("http(s)?://", "http\$1://${gerrit_user}@")</span><br><span style="color: hsl(120, 100%, 40%);">+ ]</span><br><span style="color: hsl(120, 100%, 40%);">+ ]</span><br><span style="color: hsl(120, 100%, 40%);">+ ]</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span> sh "sudo tests/CI/setupJenkinsEnvironment.sh"</span><br><span> }</span><br><span> </span><br><span>diff --git a/tests/CI/unittests.jenkinsfile b/tests/CI/unittests.jenkinsfile</span><br><span>index 82bafff..332975c 100644</span><br><span>--- a/tests/CI/unittests.jenkinsfile</span><br><span>+++ b/tests/CI/unittests.jenkinsfile</span><br><span>@@ -80,32 +80,44 @@</span><br><span> *</span><br><span> * The Gerrit Trigger provides all the URLs and refspecs to</span><br><span> * check out the change.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * We need to retrieve the jenkins2 gerrit https credentials</span><br><span style="color: hsl(120, 100%, 40%);">+ * in case this review is in a restricted project.</span><br><span> */</span><br><span style="color: hsl(0, 100%, 40%);">- checkout scm: [$class: 'GitSCM',</span><br><span style="color: hsl(0, 100%, 40%);">- branches: [[name: env.GERRIT_BRANCH ]],</span><br><span style="color: hsl(0, 100%, 40%);">- extensions: [</span><br><span style="color: hsl(0, 100%, 40%);">- [$class: 'ScmName', name: 'gerrit-public'],</span><br><span style="color: hsl(0, 100%, 40%);">- [$class: 'CleanBeforeCheckout'],</span><br><span style="color: hsl(0, 100%, 40%);">- [$class: 'PreBuildMerge', options: [</span><br><span style="color: hsl(0, 100%, 40%);">- mergeRemote: 'gerrit-public',</span><br><span style="color: hsl(0, 100%, 40%);">- fastForwardMode: 'NO_FF',</span><br><span style="color: hsl(0, 100%, 40%);">- mergeStrategy: 'RECURSIVE',</span><br><span style="color: hsl(0, 100%, 40%);">- mergeTarget: env.GERRIT_BRANCH]],</span><br><span style="color: hsl(0, 100%, 40%);">- [$class: 'CloneOption',</span><br><span style="color: hsl(0, 100%, 40%);">- honorRefspec: true,</span><br><span style="color: hsl(0, 100%, 40%);">- noTags: true,</span><br><span style="color: hsl(0, 100%, 40%);">- depth: 10,</span><br><span style="color: hsl(0, 100%, 40%);">- shallow: true</span><br><span style="color: hsl(120, 100%, 40%);">+ withCredentials([usernamePassword(credentialsId: env.JENKINS_GERRIT_CREDS,</span><br><span style="color: hsl(120, 100%, 40%);">+ usernameVariable: 'gerrit_user')]) {</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ checkout scm: [$class: 'GitSCM',</span><br><span style="color: hsl(120, 100%, 40%);">+ branches: [[name: env.GERRIT_BRANCH ]],</span><br><span style="color: hsl(120, 100%, 40%);">+ extensions: [</span><br><span style="color: hsl(120, 100%, 40%);">+ [$class: 'ScmName', name: 'gerrit-public'],</span><br><span style="color: hsl(120, 100%, 40%);">+ [$class: 'CleanBeforeCheckout'],</span><br><span style="color: hsl(120, 100%, 40%);">+ [$class: 'PreBuildMerge', options: [</span><br><span style="color: hsl(120, 100%, 40%);">+ mergeRemote: 'gerrit-public',</span><br><span style="color: hsl(120, 100%, 40%);">+ fastForwardMode: 'NO_FF',</span><br><span style="color: hsl(120, 100%, 40%);">+ mergeStrategy: 'RECURSIVE',</span><br><span style="color: hsl(120, 100%, 40%);">+ mergeTarget: env.GERRIT_BRANCH]],</span><br><span style="color: hsl(120, 100%, 40%);">+ [$class: 'CloneOption',</span><br><span style="color: hsl(120, 100%, 40%);">+ honorRefspec: true,</span><br><span style="color: hsl(120, 100%, 40%);">+ noTags: true,</span><br><span style="color: hsl(120, 100%, 40%);">+ depth: 10,</span><br><span style="color: hsl(120, 100%, 40%);">+ shallow: true</span><br><span style="color: hsl(120, 100%, 40%);">+ ],</span><br><span style="color: hsl(120, 100%, 40%);">+ [$class: 'PruneStaleBranch'],</span><br><span style="color: hsl(120, 100%, 40%);">+ [$class: 'BuildChooserSetting',</span><br><span style="color: hsl(120, 100%, 40%);">+ buildChooser: [$class: 'GerritTriggerBuildChooser']</span><br><span style="color: hsl(120, 100%, 40%);">+ ]</span><br><span> ],</span><br><span style="color: hsl(0, 100%, 40%);">- [$class: 'PruneStaleBranch'],</span><br><span style="color: hsl(0, 100%, 40%);">- [$class: 'BuildChooserSetting',</span><br><span style="color: hsl(0, 100%, 40%);">- buildChooser: [$class: 'GerritTriggerBuildChooser']</span><br><span style="color: hsl(120, 100%, 40%);">+ userRemoteConfigs: [</span><br><span style="color: hsl(120, 100%, 40%);">+ [</span><br><span style="color: hsl(120, 100%, 40%);">+ credentialsId: env.JENKINS_GERRIT_CREDS,</span><br><span style="color: hsl(120, 100%, 40%);">+ name: env.GERRIT_NAME,</span><br><span style="color: hsl(120, 100%, 40%);">+ refspec: env.GERRIT_REFSPEC,</span><br><span style="color: hsl(120, 100%, 40%);">+ url: env.GERRIT_PROJECT_URL.replaceAll("http(s)?://", "http\$1://${gerrit_user}@")</span><br><span style="color: hsl(120, 100%, 40%);">+ ]</span><br><span> ]</span><br><span style="color: hsl(0, 100%, 40%);">- ],</span><br><span style="color: hsl(0, 100%, 40%);">- userRemoteConfigs: [</span><br><span style="color: hsl(0, 100%, 40%);">- [name: env.GERRIT_NAME, refspec: env.GERRIT_REFSPEC, url: env.GERRIT_PROJECT_URL ]</span><br><span> ]</span><br><span style="color: hsl(0, 100%, 40%);">- ]</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span> </span><br><span> sh "sudo tests/CI/setupJenkinsEnvironment.sh"</span><br><span> }</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/9906">change 9906</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/9906"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 15 </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I9dc9994763c5ebfeb9f1cff60fb53f6902b7fd5f </div>
<div style="display:none"> Gerrit-Change-Number: 9906 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: George Joseph <gjoseph@digium.com> </div>