Restore withCredential step for cookiecutter job
PROD-37197
Change-Id: I9c9143e99ffc978de2e9719fd6559118fdbd2506
diff --git a/jobs/pipelines/cookied-model-generator.groovy b/jobs/pipelines/cookied-model-generator.groovy
index 3a82388..765d24e 100644
--- a/jobs/pipelines/cookied-model-generator.groovy
+++ b/jobs/pipelines/cookied-model-generator.groovy
@@ -27,23 +27,27 @@
]
withEnv(inject_env_vars) {
- try {
- checkout scm
- sshagent(credentials: ['f4fb9dd6-ba63-4085-82f7-3fa601334d95']) {
- sh "/bin/bash ./jobs/pipelines/cookied-model-generator.sh"
- }
- } finally {
- dir("${env.slave_workdir }") {
- archiveArtifacts artifacts: 'tcp_tests/*.log,tcp_tests/*.tar.gz,tcp_tests/*.xml'
- venv_cmd = "source ${VENV_PATH}/bin/activate"
- if (env.SHUTDOWN_ENV_ON_TEARDOWN.toBoolean()){
- sh "${venv_cmd} && dos.py destroy ${ENV_NAME}"
+ withCredentials([[$class: 'SSHUserPrivateKeyBinding',
+ credentialsId : 'f4fb9dd6-ba63-4085-82f7-3fa601334d95',
+ keyFileVariable: "COOKIECUTTER_TEMPLATES_REPOSITORY_KEY_PATH"]]) {
+ try {
+ checkout scm
+ sshagent(credentials: ['f4fb9dd6-ba63-4085-82f7-3fa601334d95']) {
+ sh "/bin/bash ./jobs/pipelines/cookied-model-generator.sh"
}
- if (env.ERASE_ENVIRONMENT_AFTER_BUILD.toBoolean()){
- sh = "${venv_cmd} && dos.py erase ${ENV_NAME}"
+ } finally {
+ dir("${env.slave_workdir }") {
+ archiveArtifacts artifacts: 'tcp_tests/*.log,tcp_tests/*.tar.gz,tcp_tests/*.xml'
+ venv_cmd = "source ${VENV_PATH}/bin/activate"
+ if (env.SHUTDOWN_ENV_ON_TEARDOWN.toBoolean()){
+ sh "${venv_cmd} && dos.py destroy ${ENV_NAME}"
+ }
+ if (env.ERASE_ENVIRONMENT_AFTER_BUILD.toBoolean()){
+ sh = "${venv_cmd} && dos.py erase ${ENV_NAME}"
+ }
}
- }
- } //try
+ } //try
+ } // withCredentials
} // withEnv
} // node
} // timeout