From c8623edb0fbf6a647403f2d648f1301e4f0c467c Mon Sep 17 00:00:00 2001 From: Bartosz Kuzma Date: Sat, 18 Mar 2023 03:27:27 +0100 Subject: [PATCH 01/17] Checkout release11-tools --- Jenkinsfile | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 861709e..1f577af 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,11 +1,22 @@ -node('master'){ - stage('git pull'){ - git credentialsId: '7724c11a-2509-4aa3-9862-106aa354c5b8', url: 'ssh://_git@phabricator.release11.com/diffusion/CZOPW/czopw.git' - } - stage('build & deploy'){ - sh 'cd Web/ && docker-compose --context gordon up --force-recreate --build -d' - } - +pipeline { + agent any + tools { + git 'Default' + } + parameters { + booleanParam(name: 'TERRAFORM', defaultValue: false) + } + stages { + stage('Clean workspace') { + steps { + cleanWs() + } + } + stage ('Checkout') { + steps { + checkout([$class: 'GitSCM', branches: [[name: 'master']], extensions: [], userRemoteConfigs: [[credentialsId: 'tools-deploy-key', url: '_gitea@gitea.release11.com:R11/release11-tools-web.git']]]) + } + } + } } - -- 2.51.0 From 8630a296f89ddcea682933e3b1fdc050cbcd27b2 Mon Sep 17 00:00:00 2001 From: Bartosz Kuzma Date: Sat, 18 Mar 2023 03:48:11 +0100 Subject: [PATCH 02/17] Fix repository name --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 1f577af..03b592d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -14,7 +14,7 @@ pipeline { } stage ('Checkout') { steps { - checkout([$class: 'GitSCM', branches: [[name: 'master']], extensions: [], userRemoteConfigs: [[credentialsId: 'tools-deploy-key', url: '_gitea@gitea.release11.com:R11/release11-tools-web.git']]]) + checkout([$class: 'GitSCM', branches: [[name: 'master']], extensions: [], userRemoteConfigs: [[credentialsId: 'tools-deploy-key', url: '_gitea@gitea.release11.com:R11/release11-tools.git']]]) } } } -- 2.51.0 From a57a32ef4453692e98f140daf7f2688cf601c23a Mon Sep 17 00:00:00 2001 From: Bartosz Kuzma Date: Sat, 18 Mar 2023 04:21:36 +0100 Subject: [PATCH 03/17] Prepare to run Ansible --- Jenkinsfile | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 03b592d..d95500e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -12,11 +12,22 @@ pipeline { cleanWs() } } - stage ('Checkout') { + stage('Checkout') { steps { - checkout([$class: 'GitSCM', branches: [[name: 'master']], extensions: [], userRemoteConfigs: [[credentialsId: 'tools-deploy-key', url: '_gitea@gitea.release11.com:R11/release11-tools.git']]]) + checkout([ + $class: 'GitSCM', + branches: [[name: 'master']], + extensions: [], + userRemoteConfigs: [[credentialsId: 'tools-deploy-key', url: '_gitea@gitea.release11.com:R11/release11-tools.git']] + ]) } } + stage('Run Ansible playbook') { + sh ''' + pwd + ls + ''' + } } } -- 2.51.0 From 62375fc7a82a13796fa75afc68417ae46cbbfdd1 Mon Sep 17 00:00:00 2001 From: Bartosz Kuzma Date: Sat, 18 Mar 2023 04:25:44 +0100 Subject: [PATCH 04/17] Prepare to run Ansible playbook --- Jenkinsfile | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index d95500e..81c0e5d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -23,10 +23,12 @@ pipeline { } } stage('Run Ansible playbook') { - sh ''' - pwd - ls - ''' + steps { + sh ''' + pwd + ls + ''' + } } } } -- 2.51.0 From d7e345a948495bf0b7c09e2afc36db60d015ffc0 Mon Sep 17 00:00:00 2001 From: Bartosz Kuzma Date: Sat, 18 Mar 2023 04:30:50 +0100 Subject: [PATCH 05/17] Prepare to run Ansible playbook --- Jenkinsfile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 81c0e5d..1a3ecd9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -28,6 +28,11 @@ pipeline { pwd ls ''' + ansiblePlaybook( + playbook: 'TOOLS.yml', + inventory: 'inventory/hosts', + credentialsId: 'tools-deploy-key' + ) } } } -- 2.51.0 From 76ce9ced2ddae1f212c358a0a20e523257c04bec Mon Sep 17 00:00:00 2001 From: Bartosz Kuzma Date: Sat, 18 Mar 2023 04:44:41 +0100 Subject: [PATCH 06/17] Override login --- Jenkinsfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 1a3ecd9..3f6b64d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -32,6 +32,9 @@ pipeline { playbook: 'TOOLS.yml', inventory: 'inventory/hosts', credentialsId: 'tools-deploy-key' + extraVars: [ + login: 'netadm', + ]) ) } } -- 2.51.0 From 981760eea4e3187d654f88dc4fbd107b6592c42d Mon Sep 17 00:00:00 2001 From: Bartosz Kuzma Date: Sat, 18 Mar 2023 04:45:36 +0100 Subject: [PATCH 07/17] Add missing colon --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 3f6b64d..4b22d9e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -31,7 +31,7 @@ pipeline { ansiblePlaybook( playbook: 'TOOLS.yml', inventory: 'inventory/hosts', - credentialsId: 'tools-deploy-key' + credentialsId: 'tools-deploy-key', extraVars: [ login: 'netadm', ]) -- 2.51.0 From 9be91def69aedd8c908ba95b9b96a055adc32985 Mon Sep 17 00:00:00 2001 From: Bartosz Kuzma Date: Sat, 18 Mar 2023 04:46:39 +0100 Subject: [PATCH 08/17] Remove extra bracket --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 4b22d9e..c82755f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -33,8 +33,8 @@ pipeline { inventory: 'inventory/hosts', credentialsId: 'tools-deploy-key', extraVars: [ - login: 'netadm', - ]) + login: 'netadm' + ] ) } } -- 2.51.0 From af86f911f0a7c301f303d97900a8d2d0b38da420 Mon Sep 17 00:00:00 2001 From: Bartosz Kuzma Date: Sat, 18 Mar 2023 04:56:03 +0100 Subject: [PATCH 09/17] Clean up credentials --- Jenkinsfile | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index c82755f..3127ab5 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -18,7 +18,7 @@ pipeline { $class: 'GitSCM', branches: [[name: 'master']], extensions: [], - userRemoteConfigs: [[credentialsId: 'tools-deploy-key', url: '_gitea@gitea.release11.com:R11/release11-tools.git']] + userRemoteConfigs: [[credentialsId: 'tools-deploy-key-gitea', url: '_gitea@gitea.release11.com:R11/release11-tools.git']] ]) } } @@ -31,10 +31,7 @@ pipeline { ansiblePlaybook( playbook: 'TOOLS.yml', inventory: 'inventory/hosts', - credentialsId: 'tools-deploy-key', - extraVars: [ - login: 'netadm' - ] + credentialsId: 'tools-deploy-key-netadm' ) } } -- 2.51.0 From c7ba82fa428b5c623c6946fd57e0b7c463aa4f73 Mon Sep 17 00:00:00 2001 From: Bartosz Kuzma Date: Sat, 18 Mar 2023 07:29:49 +0100 Subject: [PATCH 10/17] Move deployment logic to release11-tools-deployment repository --- Jenkinsfile | 34 +++------------------------------- 1 file changed, 3 insertions(+), 31 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 3127ab5..9947da4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,37 +1,9 @@ pipeline { agent any - tools { - git 'Default' - } - parameters { - booleanParam(name: 'TERRAFORM', defaultValue: false) - } - stages { - stage('Clean workspace') { + stage('Run Tools Deployment Job') { steps { - cleanWs() - } - } - stage('Checkout') { - steps { - checkout([ - $class: 'GitSCM', - branches: [[name: 'master']], - extensions: [], - userRemoteConfigs: [[credentialsId: 'tools-deploy-key-gitea', url: '_gitea@gitea.release11.com:R11/release11-tools.git']] - ]) - } - } - stage('Run Ansible playbook') { - steps { - sh ''' - pwd - ls - ''' - ansiblePlaybook( - playbook: 'TOOLS.yml', - inventory: 'inventory/hosts', - credentialsId: 'tools-deploy-key-netadm' + build( + job: '../tools-deployment' ) } } -- 2.51.0 From c2f5ddb9807d10cb1600ba8ad04aff9cd0ed6520 Mon Sep 17 00:00:00 2001 From: Bartosz Kuzma Date: Sat, 18 Mar 2023 07:33:08 +0100 Subject: [PATCH 11/17] Fix structure --- Jenkinsfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Jenkinsfile b/Jenkinsfile index 9947da4..29ed7a7 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,5 +1,6 @@ pipeline { agent any + stages { stage('Run Tools Deployment Job') { steps { build( -- 2.51.0 From 88b7fd1f05175bcd27a5cad59c5e76e415704440 Mon Sep 17 00:00:00 2001 From: Bartosz Kuzma Date: Sat, 18 Mar 2023 07:43:34 +0100 Subject: [PATCH 12/17] Let's check environment --- Jenkinsfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 29ed7a7..56b129e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -3,6 +3,9 @@ pipeline { stages { stage('Run Tools Deployment Job') { steps { + sh( + script: 'env' + ) build( job: '../tools-deployment' ) -- 2.51.0 From 542fe877120b15ba5a4f793d6125b01fbfbd1081 Mon Sep 17 00:00:00 2001 From: Bartosz Kuzma Date: Sat, 18 Mar 2023 07:47:20 +0100 Subject: [PATCH 13/17] Let's try to pass some parameters --- Jenkinsfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 56b129e..ef715c9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -8,6 +8,9 @@ pipeline { ) build( job: '../tools-deployment' + string: [ + 'TOOLS_BRANCH': ${GIT_BRANCH} + ] ) } } -- 2.51.0 From 6a75bb7cdcd98b55cbfee12dbbdb14270d9e99ef Mon Sep 17 00:00:00 2001 From: Bartosz Kuzma Date: Sat, 18 Mar 2023 08:05:11 +0100 Subject: [PATCH 14/17] Let's try to pass some parameters --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index ef715c9..5a09e7c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -8,8 +8,8 @@ pipeline { ) build( job: '../tools-deployment' - string: [ - 'TOOLS_BRANCH': ${GIT_BRANCH} + parameters: [ + string(name: 'TOOLS_BRANCH': value: "${GIT_BRANCH}") ] ) } -- 2.51.0 From 18ab744ab50f89f3f8e7b34db6ae6a0e94384c15 Mon Sep 17 00:00:00 2001 From: Bartosz Kuzma Date: Sat, 18 Mar 2023 08:07:07 +0100 Subject: [PATCH 15/17] Add missing colon --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 5a09e7c..d198d42 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -7,7 +7,7 @@ pipeline { script: 'env' ) build( - job: '../tools-deployment' + job: '../tools-deployment', parameters: [ string(name: 'TOOLS_BRANCH': value: "${GIT_BRANCH}") ] -- 2.51.0 From 5e58c4bbd725e60fd88597cf0f1b0e4eb8c6669b Mon Sep 17 00:00:00 2001 From: Bartosz Kuzma Date: Sat, 18 Mar 2023 08:09:45 +0100 Subject: [PATCH 16/17] Fix a typo --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index d198d42..bf226e2 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -9,7 +9,7 @@ pipeline { build( job: '../tools-deployment', parameters: [ - string(name: 'TOOLS_BRANCH': value: "${GIT_BRANCH}") + string(name: 'TOOLS_BRANCH', value: "${GIT_BRANCH}") ] ) } -- 2.51.0 From fd5d27667fc8b046b56d0fd46870b8a089f5afb9 Mon Sep 17 00:00:00 2001 From: Bartosz Kuzma Date: Sat, 18 Mar 2023 08:14:55 +0100 Subject: [PATCH 17/17] Remove debug env logging --- Jenkinsfile | 3 --- 1 file changed, 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index bf226e2..8ad8e25 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -3,9 +3,6 @@ pipeline { stages { stage('Run Tools Deployment Job') { steps { - sh( - script: 'env' - ) build( job: '../tools-deployment', parameters: [ -- 2.51.0