aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Nanis2026-09-14 14:38:55 -0700
committerMax Nanis2026-09-14 14:38:55 -0700
commit0c3d211bdac717903141ec2f2be7489dd4c04963 (patch)
tree4d44e94a7a2e4adeada6baff8c1b9541488a6c07
parent2a79198d694a9825637d397215059560e3b09f13 (diff)
downloadamt-jb-0c3d211bdac717903141ec2f2be7489dd4c04963.tar.gz
amt-jb-0c3d211bdac717903141ec2f2be7489dd4c04963.zip
Try JSON parsing in Jenkins
-rw-r--r--jb-ui/Jenkinsfile78
1 files changed, 27 insertions, 51 deletions
diff --git a/jb-ui/Jenkinsfile b/jb-ui/Jenkinsfile
index 7b55575..a73ad59 100644
--- a/jb-ui/Jenkinsfile
+++ b/jb-ui/Jenkinsfile
@@ -8,8 +8,6 @@ pipeline {
environment {
BUILD_DIR = 'dist'
- JS_FILENAME = 'james-billings'
- CSS_FILENAME = 'james-has-style'
SENTRY_AUTH_TOKEN = credentials('2b685078-e5d8-49a7-af60-b8ec44bc2734')
}
@@ -62,52 +60,39 @@ pipeline {
steps {
dir('jb-ui') {
sh 'pnpm run build'
- // script {
- // dir(env.BUILD_DIR) {
- // def minSize = 750 * 1024
- // def size = sh(script: "stat -c%s ${env.JS_FILENAME}.js", returnStdout: true).trim().toInteger()
- // if (size < minSize) {
- // error "Build is too small: ${size} bytes"
- // } else {
- // echo "Build size is acceptable: ${size} bytes"
- // }
- // }
- // }
- }
- }
- }
-
- stage('cdn.deploy.master') {
- when {
- expression { env.BRANCH_NAME == 'master' }
- }
- steps {
- sh "/usr/bin/rsync -avz ${WORKSPACE}/jb-ui/${env.BUILD_DIR}/ cdn-jb:/var/www/amt-jb-cdn/"
- }
- }
- stage('cdn.deploy.non-master') {
- when {
- expression { env.BRANCH_NAME != 'master' }
- }
- steps {
- dir('jb-ui') {
script {
- echo "Detected branch: ${env.BRANCH_NAME}"
- def versioned_js = "${env.JS_FILENAME}-${env.BRANCH_NAME}"
- def versioned_css = "${env.CSS_FILENAME}-${env.BRANCH_NAME}"
+ def props = readJSON file: 'dist/.vite/manifest.json'
+ def jsFile = props["src/main.tsx"]["file"]
+ def cssFile = props["style.css"]["file"]
+ }
+ // echo "Deploying to ${envType} (v${version})"
+ script {
dir(env.BUILD_DIR) {
- sh "cp ${env.JS_FILENAME}.js ${versioned_js}.js"
- sh "cp ${env.CSS_FILENAME}.css ${versioned_css}.css"
-
- sh "/usr/bin/rsync -avz ${WORKSPACE}/jb-ui/${env.BUILD_DIR}/ cdn-jb:/var/www/amt-jb-cdn/"
+ def minSize = 750 * 1024
+ def size = sh(script: "stat -c%s ${jsFile}", returnStdout: true).trim().toInteger()
+ if (size < minSize) {
+ error "Build is too small: ${size} bytes"
+ } else {
+ echo "Build size is acceptable: ${size} bytes"
+ }
}
}
}
}
}
+ stage('cdn.deploy') {
+ steps {
+ sh "/usr/bin/rsync -avz ${WORKSPACE}/jb-ui/${env.BUILD_DIR}/ cdn-jb:/var/www/amt-jb-cdn/"
+
+ // This already gets moved over in a hidden folder, but let's
+ // make it more clear because dev builds would overwrite it
+ sh "/usr/bin/rsync -avz ${WORKSPACE}/jb-ui/${env.BUILD_DIR}/.vite/manifest.json cdn-jb:/var/www/amt-jb-cdn/manifest-${env.BRANCH_NAME}.json"
+ }
+ }
+
stage('cdn.deploy.tag') {
when {
expression {
@@ -116,20 +101,11 @@ pipeline {
}
steps {
- dir('jb-ui') {
- script {
- echo "Detected tag: ${env.TAG_NAME}"
- def versioned_js = "${env.JS_FILENAME}-${env.TAG_NAME}"
- def versioned_css = "${env.CSS_FILENAME}-${env.TAG_NAME}"
-
- dir(env.BUILD_DIR) {
- sh "cp ${env.JS_FILENAME}.js ${versioned}.js"
- sh "cp ${env.CSS_FILENAME}.css ${versioned}.css"
+ sh "/usr/bin/rsync -avz ${WORKSPACE}/jb-ui/${env.BUILD_DIR}/ cdn-jb:/var/www/amt-jb-cdn/"
- sh "/usr/bin/rsync -avz ${WORKSPACE}/jb-ui/${env.BUILD_DIR}/ cdn-jb:/var/www/amt-jb-cdn/"
- }
- }
- }
+ // This already gets moved over in a hidden folder, but let's
+ // make it more clear because dev builds would overwrite it
+ sh "/usr/bin/rsync -avz ${WORKSPACE}/jb-ui/${env.BUILD_DIR}/.vite/manifest.json cdn-jb:/var/www/amt-jb-cdn/manifest-${env.BRANCH_NAME}-${env.TAG_NAME}.json"
}
}
}