Skip to content

Commit 3c896d0

Browse files
committed
Replaced hardcoded username/password with jenkins credential.
1 parent 7aff19a commit 3c896d0

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

docker/jenkins/casc_configs/dsl/jobs/jenkins-sanity-check-pipeline.yml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,19 @@ jobs:
9696
}
9797
9898
// Fetch installed plugins from Jenkins API
99-
def pluginList = sh(
100-
// TODO: CI_USER_PASSWORD doesn't exist anymore, read from file...
101-
script: '''
102-
curl -s -u "ci_user:cI_User@123" "http://jenkins:8080/pluginManager/api/json?depth=1"
103-
''',
104-
returnStdout: true
105-
).trim()
99+
def pluginList = ''
100+
withCredentials([usernamePassword(
101+
credentialsId: 'ci_user_creds',
102+
usernameVariable: 'CI_USER',
103+
passwordVariable: 'CI_PASS'
104+
)]) {
105+
pluginList = sh(
106+
script: '''
107+
curl -s -u "\$CI_USER:\$CI_PASS" "http://jenkins:8080/pluginManager/api/json?depth=1"
108+
''',
109+
returnStdout: true
110+
).trim()
111+
}
106112
107113
// Parse JSON response
108114
def json = new groovy.json.JsonSlurper().parseText(pluginList)

0 commit comments

Comments
 (0)