Skip to content

Commit

Permalink
HADOOP-17787. Refactor fetching of credentials in Jenkins (#3167)
Browse files Browse the repository at this point in the history
  • Loading branch information
GauthamBanasandra authored Aug 6, 2021
1 parent b0b867e commit 4fd97e0
Showing 1 changed file with 25 additions and 40 deletions.
65 changes: 25 additions & 40 deletions dev-support/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@
// specific language governing permissions and limitations
// under the License.

def getGithubAndJiraCreds() {
return [usernamePassword(credentialsId: 'apache-hadoop-at-github.aaakk.us.kg',
passwordVariable: 'GITHUB_TOKEN',
usernameVariable: 'GITHUB_USER'),
usernamePassword(credentialsId: 'hadoopqa-at-asf-jira',
passwordVariable: 'JIRA_PASSWORD',
usernameVariable: 'JIRA_USER')]
}

pipeline {

agent {
Expand Down Expand Up @@ -103,18 +112,12 @@ pipeline {
}

steps {
withCredentials(
[usernamePassword(credentialsId: 'apache-hadoop-at-github.aaakk.us.kg',
passwordVariable: 'GITHUB_TOKEN',
usernameVariable: 'GITHUB_USER'),
usernamePassword(credentialsId: 'hadoopqa-at-asf-jira',
passwordVariable: 'JIRA_PASSWORD',
usernameVariable: 'JIRA_USER')]) {
sh '''#!/usr/bin/env bash
withCredentials(getGithubAndJiraCreds()) {
sh '''#!/usr/bin/env bash
chmod u+x "${SOURCEDIR}/dev-support/jenkins.sh"
"${SOURCEDIR}/dev-support/jenkins.sh" run_ci
'''
chmod u+x "${SOURCEDIR}/dev-support/jenkins.sh"
"${SOURCEDIR}/dev-support/jenkins.sh" run_ci
'''
}
}

Expand Down Expand Up @@ -155,13 +158,7 @@ pipeline {
}

steps {
withCredentials(
[usernamePassword(credentialsId: 'apache-hadoop-at-github.aaakk.us.kg',
passwordVariable: 'GITHUB_TOKEN',
usernameVariable: 'GITHUB_USER'),
usernamePassword(credentialsId: 'hadoopqa-at-asf-jira',
passwordVariable: 'JIRA_PASSWORD',
usernameVariable: 'JIRA_USER')]) {
withCredentials(getGithubAndJiraCreds()) {
sh '''#!/usr/bin/env bash
chmod u+x "${SOURCEDIR}/dev-support/jenkins.sh"
Expand Down Expand Up @@ -207,18 +204,12 @@ pipeline {
}

steps {
withCredentials(
[usernamePassword(credentialsId: 'apache-hadoop-at-github.aaakk.us.kg',
passwordVariable: 'GITHUB_TOKEN',
usernameVariable: 'GITHUB_USER'),
usernamePassword(credentialsId: 'hadoopqa-at-asf-jira',
passwordVariable: 'JIRA_PASSWORD',
usernameVariable: 'JIRA_USER')]) {
sh '''#!/usr/bin/env bash
withCredentials(getGithubAndJiraCreds()) {
sh '''#!/usr/bin/env bash
chmod u+x "${SOURCEDIR}/dev-support/jenkins.sh"
"${SOURCEDIR}/dev-support/jenkins.sh" run_ci
'''
chmod u+x "${SOURCEDIR}/dev-support/jenkins.sh"
"${SOURCEDIR}/dev-support/jenkins.sh" run_ci
'''
}
}

Expand Down Expand Up @@ -256,18 +247,12 @@ pipeline {
}

steps {
withCredentials(
[usernamePassword(credentialsId: 'apache-hadoop-at-github.aaakk.us.kg',
passwordVariable: 'GITHUB_TOKEN',
usernameVariable: 'GITHUB_USER'),
usernamePassword(credentialsId: 'hadoopqa-at-asf-jira',
passwordVariable: 'JIRA_PASSWORD',
usernameVariable: 'JIRA_USER')]) {
sh '''#!/usr/bin/env bash
withCredentials(getGithubAndJiraCreds()) {
sh '''#!/usr/bin/env bash
chmod u+x "${SOURCEDIR}/dev-support/jenkins.sh"
"${SOURCEDIR}/dev-support/jenkins.sh" run_ci
'''
chmod u+x "${SOURCEDIR}/dev-support/jenkins.sh"
"${SOURCEDIR}/dev-support/jenkins.sh" run_ci
'''
}
}

Expand Down

0 comments on commit 4fd97e0

Please sign in to comment.