From e699b311052d369a7980903f6225a58307edc3d2 Mon Sep 17 00:00:00 2001 From: Pavlov Makar Date: Tue, 29 Jul 2025 01:26:59 +0300 Subject: [PATCH] Auto pull root certificate and key from Jenkins vault --- Jenkinsfile | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 7f6bc30..d03487c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -41,9 +41,13 @@ pipeline { } steps { script { - def userInput = input message: 'Upload RootCA certificate and key', parameters: [base64File(name: 'rootca'), base64File(name: 'rootca_key')] - writeFile(file: 'roles/rproxy/files/RootCA.crt', text: new String(userInput['rootca'].decodeBase64())) - writeFile(file: 'roles/rproxy/files/RootCA.key', text: new String(userInput['rootca_key'].decodeBase64())) + withCredentials([ + file(credentialsId: "ROOTCA_CERT", variable: "rootca"), + file(credentialsId: "ROOTCA_KEY", variable: "rootca_key") + ]) { + sh(script: "cp ${rootca} roles/gitlab/files/RootCA.crt", returnStdout: false) + sh(script: "cp ${rootca_key} roles/gitlab/files/RootCA.key", returnStdout: false) + } } } }