From 172f28e06f9ceb90885034c224a739041c7ebbab Mon Sep 17 00:00:00 2001 From: mpavlov Date: Sun, 29 Sep 2024 14:43:48 +0300 Subject: [PATCH 1/8] changed certificates input --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index c8d20a6..f14dc1d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -11,8 +11,6 @@ pipeline { parameters { string(name: "target_host", defaultValue: "", trim: true, description: "Target host") booleanParam(name: "rproxy_install", defaultValue: true, description: "Install Rproxy") - base64File(name: "rootca", description: "RootCA (only for 'Install Rproxy')") - base64File(name: "rootca_key", description: "RootCA key (only for 'Install Rproxy')") booleanParam(name: "config_add", defaultValue: true, description: "Add config") string(name: "rproxy_service_name", defaultValue: "", trim: true, description: "Service name (for 'Add config' job only)") string(name: "rproxy_service_port", defaultValue: "", trim: true, description: "Service port (for 'Add config' job only)") @@ -26,12 +24,14 @@ pipeline { } } steps { + def ask_for_certs = input message: 'Upload RootCA certificate and key', parameters: [file(name: 'rootca'), file(name: 'rootca_key')] withFileParameter('rootca') { sh 'mv ${rootca} roles/rproxy/files/RootCA.crt' } withFileParameter('rootca_key') { sh 'mv ${rootca_key} roles/rproxy/files/RootCA.key' } + ask_for_certs.delete() } } stage('Install Rproxy') { From bb52e2ca855df0006bdfddeae4d2becde89ec2ce Mon Sep 17 00:00:00 2001 From: mpavlov Date: Sun, 29 Sep 2024 14:56:39 +0300 Subject: [PATCH 2/8] added script block --- Jenkinsfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index f14dc1d..49fe482 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -24,14 +24,15 @@ pipeline { } } steps { - def ask_for_certs = input message: 'Upload RootCA certificate and key', parameters: [file(name: 'rootca'), file(name: 'rootca_key')] + script { + def ask_for_certs = input message: 'Upload RootCA certificate and key', parameters: [file(name: 'rootca'), file(name: 'rootca_key')] + } withFileParameter('rootca') { sh 'mv ${rootca} roles/rproxy/files/RootCA.crt' } withFileParameter('rootca_key') { sh 'mv ${rootca_key} roles/rproxy/files/RootCA.key' } - ask_for_certs.delete() } } stage('Install Rproxy') { From 7b2da46eb9817bbfd828a5754ca491844364ff79 Mon Sep 17 00:00:00 2001 From: mpavlov Date: Sun, 29 Sep 2024 15:07:18 +0300 Subject: [PATCH 3/8] changed parameter name --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 49fe482..a9629f0 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -25,7 +25,7 @@ pipeline { } steps { script { - def ask_for_certs = input message: 'Upload RootCA certificate and key', parameters: [file(name: 'rootca'), file(name: 'rootca_key')] + def ask_for_certs = input message: 'Upload RootCA certificate and key', parameters: [base64File(name: 'rootca'), base64File(name: 'rootca_key')] } withFileParameter('rootca') { sh 'mv ${rootca} roles/rproxy/files/RootCA.crt' From dd25db5776f03f583d8e3c918e546b75ff82b446 Mon Sep 17 00:00:00 2001 From: mpavlov Date: Sun, 29 Sep 2024 15:12:48 +0300 Subject: [PATCH 4/8] changed logic of uploading --- Jenkinsfile | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index a9629f0..cc4866b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -26,11 +26,9 @@ pipeline { steps { script { def ask_for_certs = input message: 'Upload RootCA certificate and key', parameters: [base64File(name: 'rootca'), base64File(name: 'rootca_key')] - } - withFileParameter('rootca') { + def rootca = readFile params.rootca sh 'mv ${rootca} roles/rproxy/files/RootCA.crt' - } - withFileParameter('rootca_key') { + def rootca_key = readFile params.rootca_key sh 'mv ${rootca_key} roles/rproxy/files/RootCA.key' } } From d188b87171abe0aaba8b4aca294e2bcca8c2838c Mon Sep 17 00:00:00 2001 From: mpavlov Date: Sun, 29 Sep 2024 15:19:58 +0300 Subject: [PATCH 5/8] try another --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index cc4866b..637149e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -26,9 +26,9 @@ pipeline { steps { script { def ask_for_certs = input message: 'Upload RootCA certificate and key', parameters: [base64File(name: 'rootca'), base64File(name: 'rootca_key')] - def rootca = readFile params.rootca + def rootca = readFile ask_for_certs["rootca"] sh 'mv ${rootca} roles/rproxy/files/RootCA.crt' - def rootca_key = readFile params.rootca_key + def rootca_key = readFile ask_for_certs["rootca_key"] sh 'mv ${rootca_key} roles/rproxy/files/RootCA.key' } } From 6030b1d2e1fa0abd3225f2ed01d44fb65df77c8e Mon Sep 17 00:00:00 2001 From: mpavlov Date: Sun, 29 Sep 2024 15:23:00 +0300 Subject: [PATCH 6/8] echo try --- Jenkinsfile | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 637149e..78ca34f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -26,10 +26,8 @@ pipeline { steps { script { def ask_for_certs = input message: 'Upload RootCA certificate and key', parameters: [base64File(name: 'rootca'), base64File(name: 'rootca_key')] - def rootca = readFile ask_for_certs["rootca"] - sh 'mv ${rootca} roles/rproxy/files/RootCA.crt' - def rootca_key = readFile ask_for_certs["rootca_key"] - sh 'mv ${rootca_key} roles/rproxy/files/RootCA.key' + sh 'echo "${ask_for_certs["rootca"]}" > roles/rproxy/files/RootCA.crt' + sh 'echo "${ask_for_certs["rootca_key"]}" > roles/rproxy/files/RootCA.key' } } } From bea82cedcc7e2754cc9934a2654a1fc5414c32d0 Mon Sep 17 00:00:00 2001 From: mpavlov Date: Sun, 29 Sep 2024 15:25:44 +0300 Subject: [PATCH 7/8] test color terminal --- Jenkinsfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Jenkinsfile b/Jenkinsfile index 78ca34f..4d26215 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,6 +1,7 @@ pipeline { agent any options { + ansiColor("xterm") buildDiscarder logRotator ( numToKeepStr: '5', daysToKeepStr: '7', From bfb35db87a7e5a33d2c4ef7f44676ad5d1144f06 Mon Sep 17 00:00:00 2001 From: mpavlov Date: Sun, 29 Sep 2024 15:26:16 +0300 Subject: [PATCH 8/8] done --- Jenkinsfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 4d26215..78ca34f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,7 +1,6 @@ pipeline { agent any options { - ansiColor("xterm") buildDiscarder logRotator ( numToKeepStr: '5', daysToKeepStr: '7',