Skip to content

Commit

Permalink
YD-671 Use withCredentials inside getValuesYaml
Browse files Browse the repository at this point in the history
  • Loading branch information
Bert-R committed Jan 4, 2020
1 parent 88ecec5 commit b560b0b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Jenkinsfile
Expand Up @@ -62,9 +62,7 @@ pipeline {
KUBECONFIG = "/opt/ope-cloudbees/yona/k8s/admin.conf"
}
steps {
withCredentials([string( credentialsId: 'gitlab-yonabuild', variable: 'token')]) {
getValuesYaml(token, 4, "/helm/values.yaml", buildValuesYaml)
}
getValuesYaml(4, "/helm/values.yaml", buildValuesYaml)
sh 'while ! $(curl -s -q -f -o /dev/null https://jump.ops.yona.nu/helm-charts/yona-1.2.$BUILD_NUMBER_TO_DEPLOY.tgz) ;do echo Waiting for Helm chart to become available; sleep 5; done'
sh script: 'helm delete --purge yona; kubectl delete -n yona configmaps --all; kubectl delete -n yona job --all; kubectl delete -n yona secrets --all; kubectl delete pvc -n yona --all', returnStatus: true
sh script: 'echo Waiting for purge to complete; sleep 30'
Expand Down Expand Up @@ -238,9 +236,11 @@ pipeline {
}
}

void getValuesYaml(def token, def repoNumber, def srcPath, def targetPath)
void getValuesYaml(def repoNumber, def srcPath, def targetPath)
{
def encodedPath = java.net.URLEncoder.encode(srcPath, "UTF-8")
sh "mkdir --parents `dirname ${targetPath}`"
sh "curl --fail --request GET --header 'PRIVATE-TOKEN: ${token}' https://git.ops.yona.nu/api/v4/projects/${repoNumber}/repository/files/infrastructure${encodedPath}/raw?ref=master > ${targetPath}"
withCredentials([string( credentialsId: 'gitlab-yonabuild', variable: 'token')]) {
sh "curl --fail --request GET --header 'PRIVATE-TOKEN: ${token}' https://git.ops.yona.nu/api/v4/projects/${repoNumber}/repository/files/infrastructure${encodedPath}/raw?ref=master > ${targetPath}"
}
}

0 comments on commit b560b0b

Please sign in to comment.