<p>George Joseph has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/c/testsuite/+/15846">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">CI: Add support for Security-testsuite<br><br>Add credentials to the git checkouts so the checkouts<br>don't fail when the tests are run against Security-testsuite.<br><br>Change-Id: If7d242a429e91a7121fc2cd5a9599491b64978d4<br>---<br>M CI/gates.jenkinsfile<br>M CI/unittests.jenkinsfile<br>2 files changed, 112 insertions(+), 69 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/46/15846/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/CI/gates.jenkinsfile b/CI/gates.jenkinsfile</span><br><span>index fb004e5..9ef33b5 100644</span><br><span>--- a/CI/gates.jenkinsfile</span><br><span>+++ b/CI/gates.jenkinsfile</span><br><span>@@ -82,7 +82,6 @@</span><br><span> stage ("Checkout") {</span><br><span> sh "sudo chown -R jenkins:users ."</span><br><span> env.GERRIT_PROJECT_URL = env.GIT_URL.replaceAll(/[^\/]+$/, env.GERRIT_PROJECT)</span><br><span style="color: hsl(0, 100%, 40%);">- sh "printenv -0 | sort -z | tr '\\0' '\\n'"</span><br><span> </span><br><span> /*</span><br><span> * Jenkins has already automatically checked out the base branch</span><br><span>@@ -93,32 +92,45 @@</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: env.GERRIT_NAME],</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: env.GERRIT_NAME,</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%);">- shallow: false</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: "${JENKINS_GERRIT_CREDS}",</span><br><span style="color: hsl(120, 100%, 40%);">+ passwordVariable: 'GERRIT_USER_PW', usernameVariable: 'GERRIT_USER_NAME')]) {</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+ sh "printenv -0 | sort -z | tr '\\0' '\\n'"</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: env.GERRIT_NAME],</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: env.GERRIT_NAME,</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%);">+ shallow: false</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_NAME}@")</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 CI/setupJenkinsEnvironment.sh --output-dir=CI/output"</span><br><span> }</span><br><span> </span><br><span>@@ -139,18 +151,27 @@</span><br><span> img.pull()</span><br><span> img.inside(dockerOptions) {</span><br><span> def asteriskUrl = env.GERRIT_PROJECT_URL.replaceAll(/\/(Security-)?[^\/]+$/, "/\$1asterisk")</span><br><span style="color: hsl(0, 100%, 40%);">- checkout scm: [$class: 'GitSCM',</span><br><span style="color: hsl(0, 100%, 40%);">- branches: [[name: "${BRANCH_NAME}"]],</span><br><span style="color: hsl(0, 100%, 40%);">- extensions: [</span><br><span style="color: hsl(0, 100%, 40%);">- [$class: 'RelativeTargetDirectory', relativeTargetDir: astDir],</span><br><span style="color: hsl(0, 100%, 40%);">- [$class: 'CloneOption',</span><br><span style="color: hsl(0, 100%, 40%);">- noTags: true,</span><br><span style="color: hsl(0, 100%, 40%);">- honorRefspec: true,</span><br><span style="color: hsl(0, 100%, 40%);">- shallow: false</span><br><span style="color: hsl(120, 100%, 40%);">+ withCredentials([usernamePassword(credentialsId: "${JENKINS_GERRIT_CREDS}",</span><br><span style="color: hsl(120, 100%, 40%);">+ passwordVariable: 'GERRIT_USER_PW', usernameVariable: 'GERRIT_USER_NAME')]) {</span><br><span style="color: hsl(120, 100%, 40%);">+ checkout scm: [$class: 'GitSCM',</span><br><span style="color: hsl(120, 100%, 40%);">+ branches: [[name: "${BRANCH_NAME}"]],</span><br><span style="color: hsl(120, 100%, 40%);">+ extensions: [</span><br><span style="color: hsl(120, 100%, 40%);">+ [$class: 'RelativeTargetDirectory', relativeTargetDir: astDir],</span><br><span style="color: hsl(120, 100%, 40%);">+ [$class: 'CloneOption',</span><br><span style="color: hsl(120, 100%, 40%);">+ noTags: true,</span><br><span style="color: hsl(120, 100%, 40%);">+ honorRefspec: true,</span><br><span style="color: hsl(120, 100%, 40%);">+ shallow: false</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: [[name: env.GERRIT_NAME, url: asteriskUrl]]</span><br><span style="color: hsl(0, 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%);">+ url: asteriskUrl.replaceAll("http(s)?://", "http\$1://${GERRIT_USER_NAME}@")</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> </span><br><span> stage ('Build') {</span><br><span> echo 'Building..'</span><br><span>diff --git a/CI/unittests.jenkinsfile b/CI/unittests.jenkinsfile</span><br><span>index 88bf4c7..c52aeab 100644</span><br><span>--- a/CI/unittests.jenkinsfile</span><br><span>+++ b/CI/unittests.jenkinsfile</span><br><span>@@ -84,7 +84,6 @@</span><br><span> stage ("Checkout") {</span><br><span> sh "sudo chown -R jenkins:users ."</span><br><span> env.GERRIT_PROJECT_URL = env.GIT_URL.replaceAll(/[^\/]+$/, env.GERRIT_PROJECT)</span><br><span style="color: hsl(0, 100%, 40%);">- sh "printenv -0 | sort -z | tr '\\0' '\\n'"</span><br><span> </span><br><span> /*</span><br><span> * Jenkins has already automatically checked out the base branch</span><br><span>@@ -95,31 +94,45 @@</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: env.GERRIT_NAME],</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: env.GERRIT_NAME,</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%);">- shallow: false</span><br><span style="color: hsl(120, 100%, 40%);">+ withCredentials([usernamePassword(credentialsId: "${JENKINS_GERRIT_CREDS}",</span><br><span style="color: hsl(120, 100%, 40%);">+ passwordVariable: 'GERRIT_USER_PW', usernameVariable: 'GERRIT_USER_NAME')]) {</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ sh "printenv -0 | sort -z | tr '\\0' '\\n'"</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: env.GERRIT_NAME],</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: env.GERRIT_NAME,</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%);">+ shallow: false</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_NAME}@")</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 CI/setupJenkinsEnvironment.sh --output-dir=CI/output"</span><br><span> }</span><br><span>@@ -141,18 +154,27 @@</span><br><span> img.pull()</span><br><span> img.inside(dockerOptions) {</span><br><span> def asteriskUrl = env.GERRIT_PROJECT_URL.replaceAll(/\/(Security-)?[^\/]+$/, "/\$1asterisk")</span><br><span style="color: hsl(0, 100%, 40%);">- checkout scm: [$class: 'GitSCM',</span><br><span style="color: hsl(0, 100%, 40%);">- branches: [[name: "${BRANCH_NAME}"]],</span><br><span style="color: hsl(0, 100%, 40%);">- extensions: [</span><br><span style="color: hsl(0, 100%, 40%);">- [$class: 'RelativeTargetDirectory', relativeTargetDir: astDir],</span><br><span style="color: hsl(0, 100%, 40%);">- [$class: 'CloneOption',</span><br><span style="color: hsl(0, 100%, 40%);">- noTags: true,</span><br><span style="color: hsl(0, 100%, 40%);">- honorRefspec: true,</span><br><span style="color: hsl(0, 100%, 40%);">- shallow: false</span><br><span style="color: hsl(120, 100%, 40%);">+ withCredentials([usernamePassword(credentialsId: "${JENKINS_GERRIT_CREDS}",</span><br><span style="color: hsl(120, 100%, 40%);">+ passwordVariable: 'GERRIT_USER_PW', usernameVariable: 'GERRIT_USER_NAME')]) {</span><br><span style="color: hsl(120, 100%, 40%);">+ checkout scm: [$class: 'GitSCM',</span><br><span style="color: hsl(120, 100%, 40%);">+ branches: [[name: "${BRANCH_NAME}"]],</span><br><span style="color: hsl(120, 100%, 40%);">+ extensions: [</span><br><span style="color: hsl(120, 100%, 40%);">+ [$class: 'RelativeTargetDirectory', relativeTargetDir: astDir],</span><br><span style="color: hsl(120, 100%, 40%);">+ [$class: 'CloneOption',</span><br><span style="color: hsl(120, 100%, 40%);">+ noTags: true,</span><br><span style="color: hsl(120, 100%, 40%);">+ honorRefspec: true,</span><br><span style="color: hsl(120, 100%, 40%);">+ shallow: false</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: [[name: env.GERRIT_NAME, url: asteriskUrl]]</span><br><span style="color: hsl(0, 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%);">+ url: asteriskUrl.replaceAll("http(s)?://", "http\$1://${GERRIT_USER_NAME}@")</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> </span><br><span> stage ('Build') {</span><br><span> echo 'Building..'</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/testsuite/+/15846">change 15846</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/c/testsuite/+/15846"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: testsuite </div>
<div style="display:none"> Gerrit-Branch: 13 </div>
<div style="display:none"> Gerrit-Change-Id: If7d242a429e91a7121fc2cd5a9599491b64978d4 </div>
<div style="display:none"> Gerrit-Change-Number: 15846 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>