From b7fa9901240870f2e39ce4b9cbdfb9b60866b541 Mon Sep 17 00:00:00 2001 From: Maciej Prill Date: Mon, 24 Oct 2022 08:02:17 +0200 Subject: [PATCH 01/24] Added Jenkinsfile. --- Jenkinsfile | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..0d5a2b1 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,22 @@ +pipeline { + agent { + docker { + image 'node:19-bullseye-slim' + args '-p 3000:3000' + } + } + environment { + CI = 'true' + NODE_ENV = 'production' + } + stages { + stage('Build') { + steps { + sh 'npm install' + sh 'npm install react-scripts@3.4.1 -g' + sh 'npm clean-install --only=production' + } + } + } +} + From 5b50945649e6f0eba2557d1967f833811ab0e4c5 Mon Sep 17 00:00:00 2001 From: Maciej Prill Date: Mon, 24 Oct 2022 08:07:13 +0200 Subject: [PATCH 02/24] Jenkinsfile. --- Jenkinsfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 0d5a2b1..62fbf12 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -2,7 +2,6 @@ pipeline { agent { docker { image 'node:19-bullseye-slim' - args '-p 3000:3000' } } environment { From 4b6cd9e504746a129085df01930cccaf83d78526 Mon Sep 17 00:00:00 2001 From: Maciej Prill Date: Mon, 24 Oct 2022 08:08:42 +0200 Subject: [PATCH 03/24] Jenkinsfile. --- Jenkinsfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 62fbf12..f948f33 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -11,7 +11,8 @@ pipeline { stages { stage('Build') { steps { - sh 'npm install' + sh 'uname -a' + sh 'npm install --loglevel=verbose' sh 'npm install react-scripts@3.4.1 -g' sh 'npm clean-install --only=production' } From 81a746eac9f36fa8b77358652678938c3153fccd Mon Sep 17 00:00:00 2001 From: Maciej Prill Date: Mon, 24 Oct 2022 08:11:09 +0200 Subject: [PATCH 04/24] Jenkinsfile. --- Jenkinsfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index f948f33..2b0ef24 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -7,6 +7,8 @@ pipeline { environment { CI = 'true' NODE_ENV = 'production' + HOME = '.' + npm_config_cache = 'npm_cache' } stages { stage('Build') { From 001f048cc8eaee51f3f43d3011e78a997d4a0f8d Mon Sep 17 00:00:00 2001 From: Maciej Prill Date: Mon, 24 Oct 2022 08:14:04 +0200 Subject: [PATCH 05/24] Jenkinsfile. --- Jenkinsfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 2b0ef24..1b4bc61 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -15,8 +15,10 @@ pipeline { steps { sh 'uname -a' sh 'npm install --loglevel=verbose' - sh 'npm install react-scripts@3.4.1 -g' + sh 'npm install react-scripts@3.4.1' sh 'npm clean-install --only=production' + sh 'pwd' + sh 'ls -alrth' } } } From a099cf05c0392f2530a7c580f216ad4c39dd908c Mon Sep 17 00:00:00 2001 From: Maciej Prill Date: Mon, 24 Oct 2022 08:22:25 +0200 Subject: [PATCH 06/24] Jenkinsfile. --- Jenkinsfile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 1b4bc61..dd8a658 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -15,10 +15,8 @@ pipeline { steps { sh 'uname -a' sh 'npm install --loglevel=verbose' - sh 'npm install react-scripts@3.4.1' + //sh 'npm install react-scripts@3.4.1' sh 'npm clean-install --only=production' - sh 'pwd' - sh 'ls -alrth' } } } From 497134c1f5cfb81dddb406e3d46e9974dc4fbf88 Mon Sep 17 00:00:00 2001 From: Maciej Prill Date: Mon, 24 Oct 2022 08:25:01 +0200 Subject: [PATCH 07/24] Jenkinsfile. --- Jenkinsfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Jenkinsfile b/Jenkinsfile index dd8a658..8593daa 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -17,6 +17,7 @@ pipeline { sh 'npm install --loglevel=verbose' //sh 'npm install react-scripts@3.4.1' sh 'npm clean-install --only=production' + sh 'npm run build' } } } From 4c487ff95a57e1a84a97bd1c246e9d70f3331c95 Mon Sep 17 00:00:00 2001 From: Maciej Prill Date: Mon, 24 Oct 2022 08:37:32 +0200 Subject: [PATCH 08/24] Jenkinsfile. --- Jenkinsfile | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 8593daa..bded008 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -13,13 +13,30 @@ pipeline { stages { stage('Build') { steps { - sh 'uname -a' - sh 'npm install --loglevel=verbose' - //sh 'npm install react-scripts@3.4.1' + //sh 'npm install --loglevel=verbose' + sh 'npm install' sh 'npm clean-install --only=production' sh 'npm run build' } } } + stage('SSH-publish') { + steps { + sshPublisher( + continueOnError: false, + failOnError: true, + publishers: [ + sshPublisherDesc( + configName: "mprill-gonito-front-dev", + transfers: [sshTransfer( + sourceFiles: 'build/*', + remoteDirectory: 'public_html' + )], + verbose: true + ) + ] + ) + } + } } From e143aff9448f8fc2b7b461c9eae4680812075949 Mon Sep 17 00:00:00 2001 From: Maciej Prill Date: Mon, 24 Oct 2022 08:38:09 +0200 Subject: [PATCH 09/24] Jenkinsfile. --- Jenkinsfile | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index bded008..34a3688 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -19,23 +19,23 @@ pipeline { sh 'npm run build' } } - } - stage('SSH-publish') { - steps { - sshPublisher( - continueOnError: false, - failOnError: true, - publishers: [ - sshPublisherDesc( - configName: "mprill-gonito-front-dev", - transfers: [sshTransfer( - sourceFiles: 'build/*', - remoteDirectory: 'public_html' - )], - verbose: true - ) - ] - ) + stage('SSH-publish') { + steps { + sshPublisher( + continueOnError: false, + failOnError: true, + publishers: [ + sshPublisherDesc( + configName: "mprill-gonito-front-dev", + transfers: [sshTransfer( + sourceFiles: 'build/*', + remoteDirectory: 'public_html' + )], + verbose: true + ) + ] + ) + } } } } From 7ea51f6dedb09c1c7666b62553c9b29fcb8e6465 Mon Sep 17 00:00:00 2001 From: Maciej Prill Date: Mon, 24 Oct 2022 08:39:49 +0200 Subject: [PATCH 10/24] Jenkinsfile. --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 34a3688..4b4930a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -28,7 +28,7 @@ pipeline { sshPublisherDesc( configName: "mprill-gonito-front-dev", transfers: [sshTransfer( - sourceFiles: 'build/*', + sourceFiles: 'build/**', remoteDirectory: 'public_html' )], verbose: true From c3751d1ba25d1e34b0152cccbb66d9222859577f Mon Sep 17 00:00:00 2001 From: Maciej Prill Date: Mon, 24 Oct 2022 08:46:26 +0200 Subject: [PATCH 11/24] Jenkinsfile. --- Jenkinsfile | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 4b4930a..eddbf24 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -19,7 +19,7 @@ pipeline { sh 'npm run build' } } - stage('SSH-publish') { + stage('SSH-publish-transfer') { steps { sshPublisher( continueOnError: false, @@ -37,6 +37,21 @@ pipeline { ) } } + stage('SSH-publish-permissions') { + steps { + sshPublisher( + continueOnError: false, + failOnError: true, + publishers: [ + sshPublisherDesc( + configName: "mprill-gonito-front-dev", + transfers: [sshTransfer(execCommand: 'chmod o+rX public_html')], + verbose: true + ) + ] + ) + } + } } } From dd6796e6b301adc3e0fe642788df89ffa8c271f7 Mon Sep 17 00:00:00 2001 From: Maciej Prill Date: Mon, 24 Oct 2022 08:54:05 +0200 Subject: [PATCH 12/24] Jenkinsfile. --- Jenkinsfile | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index eddbf24..48ecb29 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -18,6 +18,11 @@ pipeline { sh 'npm clean-install --only=production' sh 'npm run build' } + } + stage('Package') { + steps { + sh 'tar zcf build.tar.gz build/*' + } } stage('SSH-publish-transfer') { steps { @@ -28,8 +33,8 @@ pipeline { sshPublisherDesc( configName: "mprill-gonito-front-dev", transfers: [sshTransfer( - sourceFiles: 'build/**', - remoteDirectory: 'public_html' + sourceFiles: build.tar.gz', + execCommand: 'tar zxf build.tar.gz -O public_html' )], verbose: true ) From 86c89ce7f2a60d0924284a8249e984c82d985848 Mon Sep 17 00:00:00 2001 From: Maciej Prill Date: Mon, 24 Oct 2022 08:54:34 +0200 Subject: [PATCH 13/24] Jenkinsfile. --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 48ecb29..f5f212a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -33,7 +33,7 @@ pipeline { sshPublisherDesc( configName: "mprill-gonito-front-dev", transfers: [sshTransfer( - sourceFiles: build.tar.gz', + sourceFiles: 'build.tar.gz', execCommand: 'tar zxf build.tar.gz -O public_html' )], verbose: true From 09f1507c06651d9e1c0c1bba918be6bac411552a Mon Sep 17 00:00:00 2001 From: Maciej Prill Date: Mon, 24 Oct 2022 09:11:28 +0200 Subject: [PATCH 14/24] Jenkinsfile. --- Jenkinsfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index f5f212a..0f90ef3 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -21,7 +21,7 @@ pipeline { } stage('Package') { steps { - sh 'tar zcf build.tar.gz build/*' + sh 'cd build && tar zcf ../build.tar.gz .' } } stage('SSH-publish-transfer') { @@ -33,8 +33,10 @@ pipeline { sshPublisherDesc( configName: "mprill-gonito-front-dev", transfers: [sshTransfer( + cleanRemote: true, sourceFiles: 'build.tar.gz', - execCommand: 'tar zxf build.tar.gz -O public_html' + remoteDirectory: 'public_html', + execCommand: 'tar zxf public_html/build.tar.gz -C public_html && rm public_html/build.tar.gz' )], verbose: true ) From 9b56faa5ad08f660875ff6b52172e14b3fc85d9d Mon Sep 17 00:00:00 2001 From: Maciej Prill Date: Mon, 24 Oct 2022 09:14:07 +0200 Subject: [PATCH 15/24] Jenkinsfile. --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 0f90ef3..3c60027 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -52,7 +52,7 @@ pipeline { publishers: [ sshPublisherDesc( configName: "mprill-gonito-front-dev", - transfers: [sshTransfer(execCommand: 'chmod o+rX public_html')], + transfers: [sshTransfer(execCommand: 'chmod -R o+rX public_html')], verbose: true ) ] From aaae26c9ee32c7eccd1eb445c92b3e67dbe52b47 Mon Sep 17 00:00:00 2001 From: Maciej Prill Date: Mon, 24 Oct 2022 09:15:50 +0200 Subject: [PATCH 16/24] Jenkinsfile. --- Jenkinsfile | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 3c60027..19bee5a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -21,7 +21,7 @@ pipeline { } stage('Package') { steps { - sh 'cd build && tar zcf ../build.tar.gz .' + sh 'cd build && tar cf ../build.tar.xz .' } } stage('SSH-publish-transfer') { @@ -34,9 +34,9 @@ pipeline { configName: "mprill-gonito-front-dev", transfers: [sshTransfer( cleanRemote: true, - sourceFiles: 'build.tar.gz', + sourceFiles: 'build.tar.xz', remoteDirectory: 'public_html', - execCommand: 'tar zxf public_html/build.tar.gz -C public_html && rm public_html/build.tar.gz' + execCommand: 'tar xf public_html/build.tar.xz -C public_html && rm public_html/build.tar.xz' )], verbose: true ) @@ -52,7 +52,9 @@ pipeline { publishers: [ sshPublisherDesc( configName: "mprill-gonito-front-dev", - transfers: [sshTransfer(execCommand: 'chmod -R o+rX public_html')], + transfers: [sshTransfer( + execCommand: 'chmod -R o+rX public_html' + )], verbose: true ) ] From e1c4911f5337d18a42eec238a318dd77c14244e8 Mon Sep 17 00:00:00 2001 From: Maciej Prill Date: Mon, 24 Oct 2022 09:18:35 +0200 Subject: [PATCH 17/24] Jenkinsfile. --- Jenkinsfile | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 19bee5a..9cbae80 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -5,10 +5,12 @@ pipeline { } } environment { + // ensure production environmental variable are present CI = 'true' NODE_ENV = 'production' + // set NPM parameters HOME = '.' - npm_config_cache = 'npm_cache' + NPM_CONFIG_CACHE = 'npm_cache' } stages { stage('Build') { @@ -21,6 +23,7 @@ pipeline { } stage('Package') { steps { + // due to involved path processing of sshPublisher it's easier to pack everything into an archive sh 'cd build && tar cf ../build.tar.xz .' } } @@ -33,9 +36,12 @@ pipeline { sshPublisherDesc( configName: "mprill-gonito-front-dev", transfers: [sshTransfer( - cleanRemote: true, - sourceFiles: 'build.tar.xz', remoteDirectory: 'public_html', + // ensure clean deployment by deleting everything in remote directory + cleanRemote: true, + // transfer archive + sourceFiles: 'build.tar.xz', + // unpack archive and clean up execCommand: 'tar xf public_html/build.tar.xz -C public_html && rm public_html/build.tar.xz' )], verbose: true @@ -53,6 +59,7 @@ pipeline { sshPublisherDesc( configName: "mprill-gonito-front-dev", transfers: [sshTransfer( + // set proper permissions required for hosting execCommand: 'chmod -R o+rX public_html' )], verbose: true From 5ac8ca279868a671fe89a8bddc95a0989c8ed882 Mon Sep 17 00:00:00 2001 From: Maciej Prill Date: Mon, 24 Oct 2022 09:24:32 +0200 Subject: [PATCH 18/24] Jenkinsfile. --- Jenkinsfile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 9cbae80..dce1eee 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -11,6 +11,10 @@ pipeline { // set NPM parameters HOME = '.' NPM_CONFIG_CACHE = 'npm_cache' + // set application configuration + REACT_APP_KC_URL = 'https://auth.csi.wmi.amu.edu.pl/' + REACT_APP_KC_REALM = 'csi-gonito' + REACT_APP_KC_CLIENT_ID = 'gonito-front-dev' } stages { stage('Build') { From b9e4a17a0fef363a16826ea5f6ac4c0d0a99c6e2 Mon Sep 17 00:00:00 2001 From: Maciej Prill Date: Mon, 24 Oct 2022 09:32:54 +0200 Subject: [PATCH 19/24] Jenkinsfile. --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index dce1eee..d640694 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -12,8 +12,8 @@ pipeline { HOME = '.' NPM_CONFIG_CACHE = 'npm_cache' // set application configuration - REACT_APP_KC_URL = 'https://auth.csi.wmi.amu.edu.pl/' - REACT_APP_KC_REALM = 'csi-gonito' + REACT_APP_KC_URL = 'https://auth-dev.csi.wmi.amu.edu.pl/' + REACT_APP_KC_REALM = 'gonito-dev' REACT_APP_KC_CLIENT_ID = 'gonito-front-dev' } stages { From ae2b6399de116f8e9b26e2987f868d95c588c6bf Mon Sep 17 00:00:00 2001 From: Maciej Prill Date: Mon, 24 Oct 2022 13:01:32 +0200 Subject: [PATCH 20/24] Jenkinsfile. --- jenkins/Jenkinsfile-dev | 77 +++++++++++++++++++++++++ Jenkinsfile => jenkins/Jenkinsfile-prod | 0 2 files changed, 77 insertions(+) create mode 100644 jenkins/Jenkinsfile-dev rename Jenkinsfile => jenkins/Jenkinsfile-prod (100%) diff --git a/jenkins/Jenkinsfile-dev b/jenkins/Jenkinsfile-dev new file mode 100644 index 0000000..e7871bf --- /dev/null +++ b/jenkins/Jenkinsfile-dev @@ -0,0 +1,77 @@ +pipeline { + agent { + docker { + image 'node:lts-bullseye-slim' + } + } + environment { + // ensure production environmental variable are present + CI = 'true' + NODE_ENV = 'production' + // set NPM parameters + HOME = '.' + NPM_CONFIG_CACHE = 'npm_cache' + // set application configuration + REACT_APP_KC_URL = 'https://auth-dev.csi.wmi.amu.edu.pl/' + REACT_APP_KC_REALM = 'gonito-dev' + REACT_APP_KC_CLIENT_ID = 'gonito-front-dev' + } + stages { + stage('Build') { + steps { + //sh 'npm install --loglevel=verbose' + sh 'npm install' + sh 'npm clean-install --only=production' + sh 'npm run build' + } + } + stage('Package') { + steps { + // due to involved path processing of sshPublisher it's easier to pack everything into an archive + sh 'cd build && tar cf ../build.tar.xz .' + } + } + stage('SSH-publish-transfer') { + steps { + sshPublisher( + continueOnError: false, + failOnError: true, + publishers: [ + sshPublisherDesc( + configName: "mprill-gonito-front-dev", + transfers: [sshTransfer( + remoteDirectory: 'public_html', + // ensure clean deployment by deleting everything in remote directory + cleanRemote: true, + // transfer archive + sourceFiles: 'build.tar.xz', + // unpack archive and clean up + execCommand: 'tar xf public_html/build.tar.xz -C public_html && rm public_html/build.tar.xz' + )], + verbose: true + ) + ] + ) + } + } + stage('SSH-publish-permissions') { + steps { + sshPublisher( + continueOnError: false, + failOnError: true, + publishers: [ + sshPublisherDesc( + configName: "mprill-gonito-front-dev", + transfers: [sshTransfer( + // set proper permissions required for hosting + execCommand: 'chmod -R o+rX public_html' + )], + verbose: true + ) + ] + ) + } + } + } +} + diff --git a/Jenkinsfile b/jenkins/Jenkinsfile-prod similarity index 100% rename from Jenkinsfile rename to jenkins/Jenkinsfile-prod From 38c5df8a1d52618aab4d0c28fe40f26fa1b81ac2 Mon Sep 17 00:00:00 2001 From: Maciej Prill Date: Mon, 24 Oct 2022 13:03:22 +0200 Subject: [PATCH 21/24] Jenkinsfile. --- jenkins/Jenkinsfile-dev | 1 + 1 file changed, 1 insertion(+) diff --git a/jenkins/Jenkinsfile-dev b/jenkins/Jenkinsfile-dev index e7871bf..e6eb780 100644 --- a/jenkins/Jenkinsfile-dev +++ b/jenkins/Jenkinsfile-dev @@ -21,6 +21,7 @@ pipeline { steps { //sh 'npm install --loglevel=verbose' sh 'npm install' + sh 'npm audit fix' sh 'npm clean-install --only=production' sh 'npm run build' } From 6e9c2832c729c274de81eb9fb8b197ce73276cd7 Mon Sep 17 00:00:00 2001 From: Maciej Prill Date: Mon, 24 Oct 2022 13:04:45 +0200 Subject: [PATCH 22/24] Jenkinsfile. --- jenkins/Jenkinsfile-dev | 1 - 1 file changed, 1 deletion(-) diff --git a/jenkins/Jenkinsfile-dev b/jenkins/Jenkinsfile-dev index e6eb780..e7871bf 100644 --- a/jenkins/Jenkinsfile-dev +++ b/jenkins/Jenkinsfile-dev @@ -21,7 +21,6 @@ pipeline { steps { //sh 'npm install --loglevel=verbose' sh 'npm install' - sh 'npm audit fix' sh 'npm clean-install --only=production' sh 'npm run build' } From 896abe30b274bd4b44b33f9b00a3fe2067cec2b3 Mon Sep 17 00:00:00 2001 From: Maciej Prill Date: Mon, 24 Oct 2022 13:10:17 +0200 Subject: [PATCH 23/24] Jenkinsfile. --- jenkins/Jenkinsfile-prod | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/jenkins/Jenkinsfile-prod b/jenkins/Jenkinsfile-prod index d640694..867316c 100644 --- a/jenkins/Jenkinsfile-prod +++ b/jenkins/Jenkinsfile-prod @@ -1,7 +1,7 @@ pipeline { agent { docker { - image 'node:19-bullseye-slim' + image 'node:lts-bullseye-slim' } } environment { @@ -12,9 +12,9 @@ pipeline { HOME = '.' NPM_CONFIG_CACHE = 'npm_cache' // set application configuration - REACT_APP_KC_URL = 'https://auth-dev.csi.wmi.amu.edu.pl/' - REACT_APP_KC_REALM = 'gonito-dev' - REACT_APP_KC_CLIENT_ID = 'gonito-front-dev' + REACT_APP_KC_URL = 'https://auth.csi.wmi.amu.edu.pl/' + REACT_APP_KC_REALM = 'csi-gonito' + REACT_APP_KC_CLIENT_ID = 'gonito-frontend' } stages { stage('Build') { @@ -38,7 +38,7 @@ pipeline { failOnError: true, publishers: [ sshPublisherDesc( - configName: "mprill-gonito-front-dev", + configName: "mprill-gonito-front-prod", transfers: [sshTransfer( remoteDirectory: 'public_html', // ensure clean deployment by deleting everything in remote directory @@ -61,7 +61,7 @@ pipeline { failOnError: true, publishers: [ sshPublisherDesc( - configName: "mprill-gonito-front-dev", + configName: "mprill-gonito-front-prod", transfers: [sshTransfer( // set proper permissions required for hosting execCommand: 'chmod -R o+rX public_html' From 3edf739b983f8aa5d63ef2c2304f6082f953ef10 Mon Sep 17 00:00:00 2001 From: Maciej Prill Date: Mon, 24 Oct 2022 14:53:32 +0200 Subject: [PATCH 24/24] Normalized indentation in Jenkinsfiles. --- jenkins/Jenkinsfile-dev | 114 +++++++++++++++++++-------------------- jenkins/Jenkinsfile-prod | 114 +++++++++++++++++++-------------------- 2 files changed, 114 insertions(+), 114 deletions(-) diff --git a/jenkins/Jenkinsfile-dev b/jenkins/Jenkinsfile-dev index e7871bf..d5e3401 100644 --- a/jenkins/Jenkinsfile-dev +++ b/jenkins/Jenkinsfile-dev @@ -4,74 +4,74 @@ pipeline { image 'node:lts-bullseye-slim' } } - environment { - // ensure production environmental variable are present + environment { + // ensure production environmental variable are present CI = 'true' - NODE_ENV = 'production' - // set NPM parameters - HOME = '.' - NPM_CONFIG_CACHE = 'npm_cache' - // set application configuration - REACT_APP_KC_URL = 'https://auth-dev.csi.wmi.amu.edu.pl/' - REACT_APP_KC_REALM = 'gonito-dev' - REACT_APP_KC_CLIENT_ID = 'gonito-front-dev' + NODE_ENV = 'production' + // set NPM parameters + HOME = '.' + NPM_CONFIG_CACHE = 'npm_cache' + // set application configuration + REACT_APP_KC_URL = 'https://auth-dev.csi.wmi.amu.edu.pl/' + REACT_APP_KC_REALM = 'gonito-dev' + REACT_APP_KC_CLIENT_ID = 'gonito-front-dev' } stages { stage('Build') { steps { //sh 'npm install --loglevel=verbose' - sh 'npm install' - sh 'npm clean-install --only=production' - sh 'npm run build' + sh 'npm install' + sh 'npm clean-install --only=production' + sh 'npm run build' } } - stage('Package') { + stage('Package') { steps { - // due to involved path processing of sshPublisher it's easier to pack everything into an archive + // due to involved path processing of sshPublisher it's easier to pack everything into an archive sh 'cd build && tar cf ../build.tar.xz .' } } - stage('SSH-publish-transfer') { - steps { - sshPublisher( - continueOnError: false, - failOnError: true, - publishers: [ - sshPublisherDesc( - configName: "mprill-gonito-front-dev", - transfers: [sshTransfer( - remoteDirectory: 'public_html', - // ensure clean deployment by deleting everything in remote directory - cleanRemote: true, - // transfer archive - sourceFiles: 'build.tar.xz', - // unpack archive and clean up - execCommand: 'tar xf public_html/build.tar.xz -C public_html && rm public_html/build.tar.xz' - )], - verbose: true - ) - ] - ) - } - } - stage('SSH-publish-permissions') { - steps { - sshPublisher( - continueOnError: false, - failOnError: true, - publishers: [ - sshPublisherDesc( - configName: "mprill-gonito-front-dev", - transfers: [sshTransfer( - // set proper permissions required for hosting - execCommand: 'chmod -R o+rX public_html' - )], - verbose: true - ) - ] - ) - } - } - } + stage('SSH-publish-transfer') { + steps { + sshPublisher( + continueOnError: false, + failOnError: true, + publishers: [ + sshPublisherDesc( + configName: "mprill-gonito-front-dev", + transfers: [sshTransfer( + remoteDirectory: 'public_html', + // ensure clean deployment by deleting everything in remote directory + cleanRemote: true, + // transfer archive + sourceFiles: 'build.tar.xz', + // unpack archive and clean up + execCommand: 'tar xf public_html/build.tar.xz -C public_html && rm public_html/build.tar.xz' + )], + verbose: true + ) + ] + ) + } + } + stage('SSH-publish-permissions') { + steps { + sshPublisher( + continueOnError: false, + failOnError: true, + publishers: [ + sshPublisherDesc( + configName: "mprill-gonito-front-dev", + transfers: [sshTransfer( + // set proper permissions required for hosting + execCommand: 'chmod -R o+rX public_html' + )], + verbose: true + ) + ] + ) + } + } + } } diff --git a/jenkins/Jenkinsfile-prod b/jenkins/Jenkinsfile-prod index 867316c..5da4188 100644 --- a/jenkins/Jenkinsfile-prod +++ b/jenkins/Jenkinsfile-prod @@ -4,74 +4,74 @@ pipeline { image 'node:lts-bullseye-slim' } } - environment { - // ensure production environmental variable are present + environment { + // ensure production environmental variable are present CI = 'true' - NODE_ENV = 'production' - // set NPM parameters - HOME = '.' - NPM_CONFIG_CACHE = 'npm_cache' - // set application configuration - REACT_APP_KC_URL = 'https://auth.csi.wmi.amu.edu.pl/' - REACT_APP_KC_REALM = 'csi-gonito' - REACT_APP_KC_CLIENT_ID = 'gonito-frontend' + NODE_ENV = 'production' + // set NPM parameters + HOME = '.' + NPM_CONFIG_CACHE = 'npm_cache' + // set application configuration + REACT_APP_KC_URL = 'https://auth.csi.wmi.amu.edu.pl/' + REACT_APP_KC_REALM = 'csi-gonito' + REACT_APP_KC_CLIENT_ID = 'gonito-frontend' } stages { stage('Build') { steps { //sh 'npm install --loglevel=verbose' - sh 'npm install' - sh 'npm clean-install --only=production' - sh 'npm run build' + sh 'npm install' + sh 'npm clean-install --only=production' + sh 'npm run build' } } - stage('Package') { + stage('Package') { steps { - // due to involved path processing of sshPublisher it's easier to pack everything into an archive + // due to involved path processing of sshPublisher it's easier to pack everything into an archive sh 'cd build && tar cf ../build.tar.xz .' } } - stage('SSH-publish-transfer') { - steps { - sshPublisher( - continueOnError: false, - failOnError: true, - publishers: [ - sshPublisherDesc( - configName: "mprill-gonito-front-prod", - transfers: [sshTransfer( - remoteDirectory: 'public_html', - // ensure clean deployment by deleting everything in remote directory - cleanRemote: true, - // transfer archive - sourceFiles: 'build.tar.xz', - // unpack archive and clean up - execCommand: 'tar xf public_html/build.tar.xz -C public_html && rm public_html/build.tar.xz' - )], - verbose: true - ) - ] - ) - } - } - stage('SSH-publish-permissions') { - steps { - sshPublisher( - continueOnError: false, - failOnError: true, - publishers: [ - sshPublisherDesc( - configName: "mprill-gonito-front-prod", - transfers: [sshTransfer( - // set proper permissions required for hosting - execCommand: 'chmod -R o+rX public_html' - )], - verbose: true - ) - ] - ) - } - } - } + stage('SSH-publish-transfer') { + steps { + sshPublisher( + continueOnError: false, + failOnError: true, + publishers: [ + sshPublisherDesc( + configName: "mprill-gonito-front-prod", + transfers: [sshTransfer( + remoteDirectory: 'public_html', + // ensure clean deployment by deleting everything in remote directory + cleanRemote: true, + // transfer archive + sourceFiles: 'build.tar.xz', + // unpack archive and clean up + execCommand: 'tar xf public_html/build.tar.xz -C public_html && rm public_html/build.tar.xz' + )], + verbose: true + ) + ] + ) + } + } + stage('SSH-publish-permissions') { + steps { + sshPublisher( + continueOnError: false, + failOnError: true, + publishers: [ + sshPublisherDesc( + configName: "mprill-gonito-front-prod", + transfers: [sshTransfer( + // set proper permissions required for hosting + execCommand: 'chmod -R o+rX public_html' + )], + verbose: true + ) + ] + ) + } + } + } }