Hi,
I have very strange behavior with withCredential command in Jenkins.
I'm trying to find the reason for it already for a few days without success.
I have a shared library that parses some yaml file and after it calls my
method that downloads the helm chart from nexus.
The method look like
def
getHelmChartFileName(helmChartNexusUrl, nexusRepoCred, version,
repoName, chartName, stepName) {
def additionalCommandParameters = ''
withCredentials([usernamePassword(credentialsId:nexusRepoCred,
passwordVariable:
'helmPassword',
usernameVariable:
'helmUsername')]) {
additionalCommandParameters = " --username ${helmUsername}
--password ${helmPassword}"
}
def helmRepoName = '__' + chartName + '__'
def status = sh (script:"""
set +xe
helm repo add ${helmRepoName} ${helmChartNexusUrl}
${additionalCommandParameters}
""",
returnStdout:true).trim()
if (!status.contains('has been added to your repositories')) {
print("${stepName} Failed to run command: helm repo add ${
helmRepoName} ${helmChartNexusUrl} ${additionalCommandParameters}")
throw new Exception("${stepName}
Failed to run command: helm repo add ${helmRepoName} ${helmChartNexusUrl}
${additionalCommandParameters}")
}
print("${stepName} helm repo [${helmChartNexusUrl}
] added successfully")
}
When it run part of pipeline I recognize that it take ~ 5-6 sec to pass the
withCredential command to the first command in sh (set +xe )
In the console output I see
[Pipeline] withCredentials
*20:34:03* Masking supported pattern matches of $helmUsername or $helmPassword
[Pipeline] {
[Pipeline] }
[Pipeline] // withCredentials
[Pipeline] sh
*20:34:08* + set +xe
When I create a separate method that does only this section and run it in a
different pipeline on the same nexus, the interval is less than 1sec.
Maybe can you light me what can be the reason for this delay?
--
Thanks,
Shurik
--
You received this message because you are subscribed to the Google Groups
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-dev/CAPub6BgbArnLea-qt_e6hq_2C%2BgM8YxQYrSokDELRixXTq0EKg%40mail.gmail.com.