From b7fa9901240870f2e39ce4b9cbdfb9b60866b541 Mon Sep 17 00:00:00 2001 From: Maciej Prill Date: Mon, 24 Oct 2022 08:02:17 +0200 Subject: [PATCH 01/32] 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/32] 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/32] 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/32] 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/32] 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/32] 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/32] 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/32] 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/32] 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/32] 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/32] 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/32] 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/32] 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/32] 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/32] 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/32] 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/32] 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/32] 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/32] 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/32] 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/32] 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/32] 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/32] 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/32] 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 + ) + ] + ) + } + } + } } From 9158c5030ff6adeb471f3eeac88dd21276bb2bc7 Mon Sep 17 00:00:00 2001 From: Maciej Prill Date: Thu, 12 Jan 2023 18:17:50 +0100 Subject: [PATCH 25/32] Switch node Docker image to long term support. --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 8242a89..63b78f4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # pull official base image -FROM node:13.12.0-alpine +FROM node:lts # set working directory WORKDIR /app From ebe0a5c02cf0a3f2a48d41d356818d42986968e2 Mon Sep 17 00:00:00 2001 From: Maciej Prill Date: Thu, 12 Jan 2023 18:22:09 +0100 Subject: [PATCH 26/32] Switch node Docker image to long term support. --- Dockerfile | 2 +- jenkins/Jenkinsfile-dev | 2 +- jenkins/Jenkinsfile-prod | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 63b78f4..b1c6621 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # pull official base image -FROM node:lts +FROM node:lts-bullseye # set working directory WORKDIR /app diff --git a/jenkins/Jenkinsfile-dev b/jenkins/Jenkinsfile-dev index d5e3401..a73fbf0 100644 --- a/jenkins/Jenkinsfile-dev +++ b/jenkins/Jenkinsfile-dev @@ -1,7 +1,7 @@ pipeline { agent { docker { - image 'node:lts-bullseye-slim' + image 'node:lts-bullseye' } } environment { diff --git a/jenkins/Jenkinsfile-prod b/jenkins/Jenkinsfile-prod index 5da4188..e1a8212 100644 --- a/jenkins/Jenkinsfile-prod +++ b/jenkins/Jenkinsfile-prod @@ -1,7 +1,7 @@ pipeline { agent { docker { - image 'node:lts-bullseye-slim' + image 'node:lts-bullseye' } } environment { From e55892f5a378f36be6d2eb6285612dffddcff7c0 Mon Sep 17 00:00:00 2001 From: Maciej Prill Date: Thu, 12 Jan 2023 18:28:03 +0100 Subject: [PATCH 27/32] Fix no-template-curly-in-string. --- src/pages/PolicyPrivacy.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/pages/PolicyPrivacy.js b/src/pages/PolicyPrivacy.js index 3556aa3..e34bf49 100644 --- a/src/pages/PolicyPrivacy.js +++ b/src/pages/PolicyPrivacy.js @@ -41,13 +41,13 @@ const PolicyPrivacyStyle = styled(FlexColumn)` const PolicyPrivacy = () => { const listItemsContent = [ - 'prawo dostępu do danych osobowych, w tym prawo do uzyskania kopii tych danych przysługuje w ramach przesłanek i na warunkach określonych w art. 15 RODO,', - 'prawo do żądania sprostowania (poprawienia) danych osobowych przysługuje w ramach przesłanek i na warunkach określonych w art. 16 RODO,', - 'prawo do usunięcia danych - przysługuje w ram${POLICY_PRIVACY_PAGE}ach przesłanek i na warunkach określonych w art. 17 RODO,', - 'prawo ograniczenia przetwarzania - przysługuje w ramach przesłanek i na warunkach określonych w art. 18 RODO,', - 'prawo wniesienia sprzeciwu wobec przetwarzania - przysługuje w ramach przesłanek i na warunkach określonych w art. 21 RODO,', - 'prawo do przenoszenia danych osobowych - przysługuje w ramach przesłanek i na warunkach określonych w art. 20 RODO,', - 'prawo wniesienia skargi do organu nadzorczego (Prezes Urzędu Ochrony Danych Osobowych),', + `prawo dostępu do danych osobowych, w tym prawo do uzyskania kopii tych danych przysługuje w ramach przesłanek i na warunkach określonych w art. 15 RODO,`, + `prawo do żądania sprostowania (poprawienia) danych osobowych przysługuje w ramach przesłanek i na warunkach określonych w art. 16 RODO,`, + `prawo do usunięcia danych - przysługuje w ram${POLICY_PRIVACY_PAGE}ach przesłanek i na warunkach określonych w art. 17 RODO,`, + `prawo ograniczenia przetwarzania - przysługuje w ramach przesłanek i na warunkach określonych w art. 18 RODO,`, + `prawo wniesienia sprzeciwu wobec przetwarzania - przysługuje w ramach przesłanek i na warunkach określonych w art. 21 RODO,`, + `prawo do przenoszenia danych osobowych - przysługuje w ramach przesłanek i na warunkach określonych w art. 20 RODO,`, + `prawo wniesienia skargi do organu nadzorczego (Prezes Urzędu Ochrony Danych Osobowych),`, ]; const renderButtons = () => { From 01de0aa49cba1ef8199d6cd8af660f038b95dc33 Mon Sep 17 00:00:00 2001 From: Maciej Prill Date: Thu, 12 Jan 2023 18:40:30 +0100 Subject: [PATCH 28/32] Revert fix no-template-curly-in-string, modify ESlint config. --- .eslintrc.json | 5 ++++- src/pages/PolicyPrivacy.js | 14 +++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 7e0ae11..28463db 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -18,7 +18,10 @@ "quotes": [ 2, "single", - "avoid-escape" + { + "avoid-escape": true, + "allowTemplateLiterals": true + } ] } } \ No newline at end of file diff --git a/src/pages/PolicyPrivacy.js b/src/pages/PolicyPrivacy.js index e34bf49..3556aa3 100644 --- a/src/pages/PolicyPrivacy.js +++ b/src/pages/PolicyPrivacy.js @@ -41,13 +41,13 @@ const PolicyPrivacyStyle = styled(FlexColumn)` const PolicyPrivacy = () => { const listItemsContent = [ - `prawo dostępu do danych osobowych, w tym prawo do uzyskania kopii tych danych przysługuje w ramach przesłanek i na warunkach określonych w art. 15 RODO,`, - `prawo do żądania sprostowania (poprawienia) danych osobowych przysługuje w ramach przesłanek i na warunkach określonych w art. 16 RODO,`, - `prawo do usunięcia danych - przysługuje w ram${POLICY_PRIVACY_PAGE}ach przesłanek i na warunkach określonych w art. 17 RODO,`, - `prawo ograniczenia przetwarzania - przysługuje w ramach przesłanek i na warunkach określonych w art. 18 RODO,`, - `prawo wniesienia sprzeciwu wobec przetwarzania - przysługuje w ramach przesłanek i na warunkach określonych w art. 21 RODO,`, - `prawo do przenoszenia danych osobowych - przysługuje w ramach przesłanek i na warunkach określonych w art. 20 RODO,`, - `prawo wniesienia skargi do organu nadzorczego (Prezes Urzędu Ochrony Danych Osobowych),`, + 'prawo dostępu do danych osobowych, w tym prawo do uzyskania kopii tych danych przysługuje w ramach przesłanek i na warunkach określonych w art. 15 RODO,', + 'prawo do żądania sprostowania (poprawienia) danych osobowych przysługuje w ramach przesłanek i na warunkach określonych w art. 16 RODO,', + 'prawo do usunięcia danych - przysługuje w ram${POLICY_PRIVACY_PAGE}ach przesłanek i na warunkach określonych w art. 17 RODO,', + 'prawo ograniczenia przetwarzania - przysługuje w ramach przesłanek i na warunkach określonych w art. 18 RODO,', + 'prawo wniesienia sprzeciwu wobec przetwarzania - przysługuje w ramach przesłanek i na warunkach określonych w art. 21 RODO,', + 'prawo do przenoszenia danych osobowych - przysługuje w ramach przesłanek i na warunkach określonych w art. 20 RODO,', + 'prawo wniesienia skargi do organu nadzorczego (Prezes Urzędu Ochrony Danych Osobowych),', ]; const renderButtons = () => { From 6ed6bacfbb0f60a9be2ee9b886968c99332bf3d7 Mon Sep 17 00:00:00 2001 From: Maciej Prill Date: Thu, 12 Jan 2023 18:44:47 +0100 Subject: [PATCH 29/32] Tune ESLint. --- .eslintrc.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.eslintrc.json b/.eslintrc.json index 28463db..c001007 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -19,7 +19,7 @@ 2, "single", { - "avoid-escape": true, + "avoidEscape": true, "allowTemplateLiterals": true } ] From b1cd33bc41a77a628d135eefb339816d69ff0f64 Mon Sep 17 00:00:00 2001 From: Maciej Prill Date: Thu, 12 Jan 2023 18:51:36 +0100 Subject: [PATCH 30/32] Tune ESLint, remove unnecessary template from string. --- .eslintrc.json | 3 +-- src/pages/PolicyPrivacy.js | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index c001007..119b474 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -19,8 +19,7 @@ 2, "single", { - "avoidEscape": true, - "allowTemplateLiterals": true + "avoidEscape": true } ] } diff --git a/src/pages/PolicyPrivacy.js b/src/pages/PolicyPrivacy.js index 3556aa3..cc9bc86 100644 --- a/src/pages/PolicyPrivacy.js +++ b/src/pages/PolicyPrivacy.js @@ -43,7 +43,7 @@ const PolicyPrivacy = () => { const listItemsContent = [ 'prawo dostępu do danych osobowych, w tym prawo do uzyskania kopii tych danych przysługuje w ramach przesłanek i na warunkach określonych w art. 15 RODO,', 'prawo do żądania sprostowania (poprawienia) danych osobowych przysługuje w ramach przesłanek i na warunkach określonych w art. 16 RODO,', - 'prawo do usunięcia danych - przysługuje w ram${POLICY_PRIVACY_PAGE}ach przesłanek i na warunkach określonych w art. 17 RODO,', + 'prawo do usunięcia danych - przysługuje w ramach przesłanek i na warunkach określonych w art. 17 RODO,', 'prawo ograniczenia przetwarzania - przysługuje w ramach przesłanek i na warunkach określonych w art. 18 RODO,', 'prawo wniesienia sprzeciwu wobec przetwarzania - przysługuje w ramach przesłanek i na warunkach określonych w art. 21 RODO,', 'prawo do przenoszenia danych osobowych - przysługuje w ramach przesłanek i na warunkach określonych w art. 20 RODO,', From bbf1d3a285e3810541e5be8f10b67f5349541bc7 Mon Sep 17 00:00:00 2001 From: Maciej Prill Date: Sun, 15 Jan 2023 13:15:28 +0100 Subject: [PATCH 31/32] Implement API address specification in Jenkinsfile. --- jenkins/Jenkinsfile-dev | 1 + jenkins/Jenkinsfile-prod | 1 + 2 files changed, 2 insertions(+) diff --git a/jenkins/Jenkinsfile-dev b/jenkins/Jenkinsfile-dev index a73fbf0..4baa830 100644 --- a/jenkins/Jenkinsfile-dev +++ b/jenkins/Jenkinsfile-dev @@ -15,6 +15,7 @@ pipeline { 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_API = 'https://gonito-back-dev.csi.wmi.amu.edu.pl/api' } stages { stage('Build') { diff --git a/jenkins/Jenkinsfile-prod b/jenkins/Jenkinsfile-prod index e1a8212..9616728 100644 --- a/jenkins/Jenkinsfile-prod +++ b/jenkins/Jenkinsfile-prod @@ -15,6 +15,7 @@ pipeline { REACT_APP_KC_URL = 'https://auth.csi.wmi.amu.edu.pl/' REACT_APP_KC_REALM = 'csi-gonito' REACT_APP_KC_CLIENT_ID = 'gonito-frontend' + REACT_APP_API = 'https://gonito.net/api' } stages { stage('Build') { From 97b9fb5d61248c550331d973c7a9fe1dd7f93895 Mon Sep 17 00:00:00 2001 From: Maciej Prill Date: Mon, 16 Jan 2023 07:53:41 +0100 Subject: [PATCH 32/32] Replaced tabs with spaces. --- jenkins/Jenkinsfile-dev | 2 +- jenkins/Jenkinsfile-prod | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/jenkins/Jenkinsfile-dev b/jenkins/Jenkinsfile-dev index 4baa830..9299f24 100644 --- a/jenkins/Jenkinsfile-dev +++ b/jenkins/Jenkinsfile-dev @@ -15,7 +15,7 @@ pipeline { 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_API = 'https://gonito-back-dev.csi.wmi.amu.edu.pl/api' + REACT_APP_API = 'https://gonito-back-dev.csi.wmi.amu.edu.pl/api' } stages { stage('Build') { diff --git a/jenkins/Jenkinsfile-prod b/jenkins/Jenkinsfile-prod index 9616728..912560a 100644 --- a/jenkins/Jenkinsfile-prod +++ b/jenkins/Jenkinsfile-prod @@ -15,7 +15,7 @@ pipeline { REACT_APP_KC_URL = 'https://auth.csi.wmi.amu.edu.pl/' REACT_APP_KC_REALM = 'csi-gonito' REACT_APP_KC_CLIENT_ID = 'gonito-frontend' - REACT_APP_API = 'https://gonito.net/api' + REACT_APP_API = 'https://gonito.net/api' } stages { stage('Build') {