From 69a938b3b8a21d5a99957db7b9c2d75fd6f3429d Mon Sep 17 00:00:00 2001 From: egelhaus <156946629+egelhaus@users.noreply.github.com> Date: Wed, 9 Apr 2025 16:30:36 +0200 Subject: [PATCH 01/17] Update Jenkinsfile --- Jenkinsfile | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index d8a1fcc4..6b51ce66 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -5,6 +5,18 @@ pipeline { NODE_VERSION = '20.17.0' } + options { + cache(caches: [ + arbitraryFileCache( + cacheName: 'NPM', + cacheValidityDecidingFile: '', + excludes: '', + includes: '**/*', + path: '~/.npm' + ) + ], defaultBranch: 'dev', maxCacheSize: 256000) + } + stages { stage('Checkout Repository') { steps { From 46f0f270ca2a96b01c708c1165c1f9d4982acff8 Mon Sep 17 00:00:00 2001 From: egelhaus <156946629+egelhaus@users.noreply.github.com> Date: Wed, 9 Apr 2025 16:40:37 +0200 Subject: [PATCH 02/17] Update Jenkinsfile --- Jenkinsfile | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 6b51ce66..fe5c5099 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -8,15 +8,23 @@ pipeline { options { cache(caches: [ arbitraryFileCache( - cacheName: 'NPM', - cacheValidityDecidingFile: '', - excludes: '', - includes: '**/*', - path: '~/.npm' + cacheName: 'Next', + cacheValidityDecidingFile: '', + excludes: '', + includes: '**/*', + path: "${WORKSPACE}/.next/cache" + ), + arbitraryFileCache( + cacheName: 'NPM', // Added a cache name for better clarity + cacheValidityDecidingFile: '', + excludes: '', + includes: '**/*', + path: "${HOME}/.npm" // Use the HOME environment variable for home directory ) ], defaultBranch: 'dev', maxCacheSize: 256000) } + stages { stage('Checkout Repository') { steps { From 1dec2b8c2a42dc268dc8af99846e364200b32332 Mon Sep 17 00:00:00 2001 From: egelhaus <156946629+egelhaus@users.noreply.github.com> Date: Wed, 9 Apr 2025 16:42:39 +0200 Subject: [PATCH 03/17] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index fe5c5099..01b84071 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -19,7 +19,7 @@ pipeline { cacheValidityDecidingFile: '', excludes: '', includes: '**/*', - path: "${HOME}/.npm" // Use the HOME environment variable for home directory + path: "${JENKINS_HOME}/.npm" // Use the HOME environment variable for home directory ) ], defaultBranch: 'dev', maxCacheSize: 256000) } From 6446361b46ea41720e6186ef54a5e66909381211 Mon Sep 17 00:00:00 2001 From: egelhaus <156946629+egelhaus@users.noreply.github.com> Date: Wed, 9 Apr 2025 16:44:52 +0200 Subject: [PATCH 04/17] Update Jenkinsfile --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 01b84071..567408c7 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -12,14 +12,14 @@ pipeline { cacheValidityDecidingFile: '', excludes: '', includes: '**/*', - path: "${WORKSPACE}/.next/cache" + path: "$WORKSPACE/.next/cache" ), arbitraryFileCache( cacheName: 'NPM', // Added a cache name for better clarity cacheValidityDecidingFile: '', excludes: '', includes: '**/*', - path: "${JENKINS_HOME}/.npm" // Use the HOME environment variable for home directory + path: "$JENKINS_HOME/.npm" // Use the HOME environment variable for home directory ) ], defaultBranch: 'dev', maxCacheSize: 256000) } From 3dacc5771112781c23061a6ac7683fab74d649a8 Mon Sep 17 00:00:00 2001 From: egelhaus <156946629+egelhaus@users.noreply.github.com> Date: Wed, 9 Apr 2025 16:46:59 +0200 Subject: [PATCH 05/17] Update Jenkinsfile --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 567408c7..a6c2d192 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -12,14 +12,14 @@ pipeline { cacheValidityDecidingFile: '', excludes: '', includes: '**/*', - path: "$WORKSPACE/.next/cache" + path: ${$WORKSPACE}"/.next/cache" ), arbitraryFileCache( cacheName: 'NPM', // Added a cache name for better clarity cacheValidityDecidingFile: '', excludes: '', includes: '**/*', - path: "$JENKINS_HOME/.npm" // Use the HOME environment variable for home directory + path: ${JENKINS_HOME}"/.npm" // Use the HOME environment variable for home directory ) ], defaultBranch: 'dev', maxCacheSize: 256000) } From 38e2813380f633d9fac58f3085f5d815af9bcede Mon Sep 17 00:00:00 2001 From: egelhaus <156946629+egelhaus@users.noreply.github.com> Date: Wed, 9 Apr 2025 16:47:10 +0200 Subject: [PATCH 06/17] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index a6c2d192..66d12d64 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -12,7 +12,7 @@ pipeline { cacheValidityDecidingFile: '', excludes: '', includes: '**/*', - path: ${$WORKSPACE}"/.next/cache" + path: ${WORKSPACE}"/.next/cache" ), arbitraryFileCache( cacheName: 'NPM', // Added a cache name for better clarity From 181fba1736648890ffd716169a2adbd53667f35c Mon Sep 17 00:00:00 2001 From: egelhaus <156946629+egelhaus@users.noreply.github.com> Date: Wed, 9 Apr 2025 16:48:31 +0200 Subject: [PATCH 07/17] Update Jenkinsfile --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 66d12d64..ffda1750 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -12,14 +12,14 @@ pipeline { cacheValidityDecidingFile: '', excludes: '', includes: '**/*', - path: ${WORKSPACE}"/.next/cache" + path: "./.next/cache" ), arbitraryFileCache( cacheName: 'NPM', // Added a cache name for better clarity cacheValidityDecidingFile: '', excludes: '', includes: '**/*', - path: ${JENKINS_HOME}"/.npm" // Use the HOME environment variable for home directory + path: "~/.npm" // Use the HOME environment variable for home directory ) ], defaultBranch: 'dev', maxCacheSize: 256000) } From 6271e2c06d98a101ef4ba823ae6ef1e4e6f36028 Mon Sep 17 00:00:00 2001 From: egelhaus <156946629+egelhaus@users.noreply.github.com> Date: Wed, 9 Apr 2025 17:05:20 +0200 Subject: [PATCH 08/17] Update Jenkinsfile --- Jenkinsfile | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index ffda1750..2cfc09cf 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -21,7 +21,7 @@ pipeline { includes: '**/*', path: "~/.npm" // Use the HOME environment variable for home directory ) - ], defaultBranch: 'dev', maxCacheSize: 256000) + ], defaultBranch: 'dev', maxCacheSize: 256000, skipSave: true) } @@ -69,6 +69,23 @@ pipeline { } success { echo 'Build completed successfully!' + cache(caches: [ + arbitraryFileCache( + cacheName: 'Next', + cacheValidityDecidingFile: '', + excludes: '', + includes: '**/*', + path: "./.next/cache" + ), + arbitraryFileCache( + cacheName: 'NPM', // Added a cache name for better clarity + cacheValidityDecidingFile: '', + excludes: '', + includes: '**/*', + path: "~/.npm" // Use the HOME environment variable for home directory + ) + ], defaultBranch: 'dev', maxCacheSize: 256000, skipRestore: true) + } } failure { echo 'Build failed!' From 96420f4b5de14e89d8d0932429b3cab3c5f7b2b1 Mon Sep 17 00:00:00 2001 From: egelhaus <156946629+egelhaus@users.noreply.github.com> Date: Wed, 9 Apr 2025 17:08:17 +0200 Subject: [PATCH 09/17] Update Jenkinsfile --- Jenkinsfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 2cfc09cf..71f2519c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -86,7 +86,6 @@ pipeline { ) ], defaultBranch: 'dev', maxCacheSize: 256000, skipRestore: true) } - } failure { echo 'Build failed!' } From 798e4af50fd90408db007a3516d64c450d12a402 Mon Sep 17 00:00:00 2001 From: egelhaus <156946629+egelhaus@users.noreply.github.com> Date: Wed, 9 Apr 2025 17:19:25 +0200 Subject: [PATCH 10/17] Update Jenkinsfile --- Jenkinsfile | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 71f2519c..6acff059 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -65,10 +65,7 @@ pipeline { junit '**/reports/junit.xml' archiveArtifacts artifacts: 'reports/**', fingerprint: true archiveArtifacts artifacts: 'build_report.log', fingerprint: true - cleanWs(cleanWhenNotBuilt: false, notFailBuild: true) - } - success { - echo 'Build completed successfully!' + // Cache after cleanup in 'always' cache(caches: [ arbitraryFileCache( cacheName: 'Next', @@ -85,6 +82,11 @@ pipeline { path: "~/.npm" // Use the HOME environment variable for home directory ) ], defaultBranch: 'dev', maxCacheSize: 256000, skipRestore: true) + + cleanWs(cleanWhenNotBuilt: false, notFailBuild: true) + } + success { + echo 'Build completed successfully!' } failure { echo 'Build failed!' From a12dcadbf2e2a105cdaa6acef57b92776f525790 Mon Sep 17 00:00:00 2001 From: egelhaus <156946629+egelhaus@users.noreply.github.com> Date: Wed, 9 Apr 2025 17:28:05 +0200 Subject: [PATCH 11/17] Update Jenkinsfile --- Jenkinsfile | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 6acff059..b51059fd 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -21,7 +21,7 @@ pipeline { includes: '**/*', path: "~/.npm" // Use the HOME environment variable for home directory ) - ], defaultBranch: 'dev', maxCacheSize: 256000, skipSave: true) + ], defaultBranch: 'dev', maxCacheSize: 256000) } @@ -65,31 +65,14 @@ pipeline { junit '**/reports/junit.xml' archiveArtifacts artifacts: 'reports/**', fingerprint: true archiveArtifacts artifacts: 'build_report.log', fingerprint: true - // Cache after cleanup in 'always' - cache(caches: [ - arbitraryFileCache( - cacheName: 'Next', - cacheValidityDecidingFile: '', - excludes: '', - includes: '**/*', - path: "./.next/cache" - ), - arbitraryFileCache( - cacheName: 'NPM', // Added a cache name for better clarity - cacheValidityDecidingFile: '', - excludes: '', - includes: '**/*', - path: "~/.npm" // Use the HOME environment variable for home directory - ) - ], defaultBranch: 'dev', maxCacheSize: 256000, skipRestore: true) - - cleanWs(cleanWhenNotBuilt: false, notFailBuild: true) } success { echo 'Build completed successfully!' + cleanWs(cleanWhenNotBuilt: false, notFailBuild: true) } failure { echo 'Build failed!' + cleanWs(cleanWhenNotBuilt: false, notFailBuild: true) } } } From 4c8f9cf9c8ef813d4600b4e3e19c4a89e12fd5b2 Mon Sep 17 00:00:00 2001 From: egelhaus <156946629+egelhaus@users.noreply.github.com> Date: Wed, 9 Apr 2025 17:32:13 +0200 Subject: [PATCH 12/17] Update Jenkinsfile --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index b51059fd..9fb5b6b7 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -68,11 +68,11 @@ pipeline { } success { echo 'Build completed successfully!' - cleanWs(cleanWhenNotBuilt: false, notFailBuild: true) + } failure { echo 'Build failed!' - cleanWs(cleanWhenNotBuilt: false, notFailBuild: true) + } } } From c769483f25487d954c7c75f3daa1344b9b27c2f1 Mon Sep 17 00:00:00 2001 From: egelhaus <156946629+egelhaus@users.noreply.github.com> Date: Wed, 9 Apr 2025 17:40:28 +0200 Subject: [PATCH 13/17] Update Jenkinsfile --- Jenkinsfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 9fb5b6b7..74cab9e0 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -12,14 +12,14 @@ pipeline { cacheValidityDecidingFile: '', excludes: '', includes: '**/*', - path: "./.next/cache" + path: "./.nx/cache" ), arbitraryFileCache( - cacheName: 'NPM', // Added a cache name for better clarity + cacheName: 'NodeJS', // Added a cache name for better clarity cacheValidityDecidingFile: '', excludes: '', includes: '**/*', - path: "~/.npm" // Use the HOME environment variable for home directory + path: "./node_modules" // Use the HOME environment variable for home directory ) ], defaultBranch: 'dev', maxCacheSize: 256000) } From c36c16d92f9f1b97af4a34bec2a631fb060e0808 Mon Sep 17 00:00:00 2001 From: egelhaus <156946629+egelhaus@users.noreply.github.com> Date: Wed, 9 Apr 2025 17:59:20 +0200 Subject: [PATCH 14/17] Update Jenkinsfile --- Jenkinsfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 74cab9e0..08647574 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -64,7 +64,8 @@ pipeline { always { junit '**/reports/junit.xml' archiveArtifacts artifacts: 'reports/**', fingerprint: true - archiveArtifacts artifacts: 'build_report.log', fingerprint: true + archiveArtifacts artifacts: 'build_report.log', fingerprint: true + cleanWs(cleanWhenNotBuilt: false, notFailBuild: true) } success { echo 'Build completed successfully!' From 3c00ea792ab753dd77a9bc9d572a25594208f03a Mon Sep 17 00:00:00 2001 From: egelhaus <156946629+egelhaus@users.noreply.github.com> Date: Wed, 9 Apr 2025 21:00:15 +0200 Subject: [PATCH 15/17] Update Jenkinsfile --- Jenkinsfile | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 08647574..85101ae9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -5,27 +5,26 @@ pipeline { NODE_VERSION = '20.17.0' } - options { - cache(caches: [ - arbitraryFileCache( - cacheName: 'Next', - cacheValidityDecidingFile: '', - excludes: '', - includes: '**/*', - path: "./.nx/cache" - ), - arbitraryFileCache( - cacheName: 'NodeJS', // Added a cache name for better clarity - cacheValidityDecidingFile: '', - excludes: '', - includes: '**/*', - path: "./node_modules" // Use the HOME environment variable for home directory - ) - ], defaultBranch: 'dev', maxCacheSize: 256000) - } - - stages { + options { + cache(caches: [ + arbitraryFileCache( + cacheName: 'Next', + cacheValidityDecidingFile: '', + excludes: '', + includes: '**/*', + path: "./.nx/cache" + ), + arbitraryFileCache( + cacheName: 'NodeJS', // Added a cache name for better clarity + cacheValidityDecidingFile: '', + excludes: '', + includes: '**/*', + path: "./node_modules" // Use the HOME environment variable for home directory + ) + ], defaultBranch: 'dev', maxCacheSize: 256000) + } + stage('Checkout Repository') { steps { checkout scm From 632639bb409ca80d1a8b072b7c3eb72a27a02e60 Mon Sep 17 00:00:00 2001 From: egelhaus <156946629+egelhaus@users.noreply.github.com> Date: Wed, 9 Apr 2025 21:26:34 +0200 Subject: [PATCH 16/17] Update Jenkinsfile --- Jenkinsfile | 61 ++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 44 insertions(+), 17 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 85101ae9..f97e5c9f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -6,23 +6,27 @@ pipeline { } stages { - options { - cache(caches: [ - arbitraryFileCache( - cacheName: 'Next', - cacheValidityDecidingFile: '', - excludes: '', - includes: '**/*', - path: "./.nx/cache" - ), - arbitraryFileCache( - cacheName: 'NodeJS', // Added a cache name for better clarity - cacheValidityDecidingFile: '', - excludes: '', - includes: '**/*', - path: "./node_modules" // Use the HOME environment variable for home directory - ) - ], defaultBranch: 'dev', maxCacheSize: 256000) + stage('Fetch Cache') { + options { + cache(caches: [ + arbitraryFileCache( + cacheName: 'Next', + cacheValidityDecidingFile: '', + excludes: '', + includes: '**/*', + path: "./.nx/cache" + ), + arbitraryFileCache( + cacheName: 'NodeJS', // Added a cache name for better clarity + cacheValidityDecidingFile: '', + excludes: '', + includes: '**/*', + path: "./node_modules" // Use the HOME environment variable for home directory + ) + ], defaultBranch: 'dev', maxCacheSize: 256000, skipSave: true) + } + steps { + } } stage('Checkout Repository') { @@ -57,6 +61,29 @@ pipeline { sh 'npm run build 2>&1 | tee build_report.log' // Captures build output } } + + stage('Save Cache') { + options { + cache(caches: [ + arbitraryFileCache( + cacheName: 'Next', + cacheValidityDecidingFile: '', + excludes: '', + includes: '**/*', + path: "./.nx/cache" + ), + arbitraryFileCache( + cacheName: 'NodeJS', // Added a cache name for better clarity + cacheValidityDecidingFile: '', + excludes: '', + includes: '**/*', + path: "./node_modules" // Use the HOME environment variable for home directory + ) + ], defaultBranch: 'dev', maxCacheSize: 256000, skipRestore: true) + } + steps { + } + } } post { From b1b2f93ac27e71e12825cc3e42b353ab2c7558b6 Mon Sep 17 00:00:00 2001 From: egelhaus <156946629+egelhaus@users.noreply.github.com> Date: Wed, 9 Apr 2025 21:28:35 +0200 Subject: [PATCH 17/17] Update Jenkinsfile --- Jenkinsfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index f97e5c9f..204a4dae 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -26,6 +26,7 @@ pipeline { ], defaultBranch: 'dev', maxCacheSize: 256000, skipSave: true) } steps { + echo 'Start fetching Cache.' } } @@ -82,6 +83,7 @@ pipeline { ], defaultBranch: 'dev', maxCacheSize: 256000, skipRestore: true) } steps { + echo 'Start saving Cache.' } } }