Merge pull request #688 from gitroomhq/jenk-cache

Jenk cache
This commit is contained in:
egelhaus 2025-04-09 22:12:41 +02:00 committed by GitHub
commit 72bb497e37
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 51 additions and 1 deletions

52
Jenkinsfile vendored
View File

@ -6,6 +6,30 @@ pipeline {
}
stages {
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 {
echo 'Start fetching Cache.'
}
}
stage('Checkout Repository') {
steps {
checkout scm
@ -38,20 +62,46 @@ 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 {
echo 'Start saving Cache.'
}
}
}
post {
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!'
}
failure {
echo 'Build failed!'
}
}
}