aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Nanis2025-06-27 14:03:29 +0700
committerMax Nanis2025-06-27 14:03:29 +0700
commit32560fa4091b1f2f2898a9cace04cb9d4ae123de (patch)
tree1b413c6d2e4f87940ca3bc09e9b43416ad6e0278
parent7cdd091a6d678ce75a9aa366b71ead580cfd9f4f (diff)
downloadpanel-ui-32560fa4091b1f2f2898a9cace04cb9d4ae123de.tar.gz
panel-ui-32560fa4091b1f2f2898a9cace04cb9d4ae123de.zip
dir() to cleanup somev0.1.1
-rw-r--r--Jenkinsfile43
1 files changed, 24 insertions, 19 deletions
diff --git a/Jenkinsfile b/Jenkinsfile
index f2d9ef6..54e0330 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -55,14 +55,15 @@ pipeline {
dir("panel-ui") {
sh "/usr/local/bin/npm run build"
script {
- def filePath = "dist/grl-panel.js"
- def minSize = 500 * 1024
- def size = sh(script: "stat -c%s ${filePath}", returnStdout: true).trim().toInteger()
-
- if (size < minSize) {
- error "Build ${filePath} is too small: ${size} bytes"
- } else {
- echo "Build size is acceptable: ${size} bytes"
+ 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"
+ }
}
}
}
@@ -75,7 +76,9 @@ pipeline {
}
steps {
dir("panel-ui") {
- sh "/usr/bin/rsync -v ${env.BUILD_DIR}/${env.JS_FILENAME}.js grl-cdn:/root/gr-cdn/"
+ dir(env.BUILD_DIR) {
+ sh "/usr/bin/rsync -v ${env.JS_FILENAME}.js grl-cdn:/root/gr-cdn/"
+ }
}
}
}
@@ -87,12 +90,13 @@ pipeline {
steps {
dir("panel-ui") {
script {
- def branch = env.BRANCH_NAME
- echo "Detected branch: ${branch}"
- def versioned = "${env.BUILD_DIR}/${env.JS_FILENAME}-${branch}.js"
+ echo "Detected branch: ${env.BRANCH_NAME}"
+ def versioned = "${env.JS_FILENAME}-${env.BRANCH_NAME}"
- sh "cp ${env.BUILD_DIR}/${env.JS_FILENAME}.js ${versioned}"
- sh "/usr/bin/rsync -v ${env.BUILD_DIR}/${versioned}.js grl-cdn:/root/gr-cdn/"
+ dir(env.BUILD_DIR) {
+ sh "cp ${env.JS_FILENAME}.js ${versioned}.js"
+ sh "/usr/bin/rsync -v ${versioned}.js grl-cdn:/root/gr-cdn/"
+ }
}
}
@@ -109,12 +113,13 @@ pipeline {
steps {
dir("panel-ui") {
script {
- def tag = env.TAG_NAME
- echo "Detected tag: ${tag}"
- def versioned = "${env.BUILD_DIR}/${env.JS_FILENAME}-${tag}.js"
+ echo "Detected tag: ${env.TAG_NAME}"
+ def versioned = "${env.JS_FILENAME}-${env.TAG_NAME}"
- sh "cp ${env.BUILD_DIR}/${env.JS_FILENAME}.js ${versioned}"
- sh "/usr/bin/rsync -v ${env.BUILD_DIR}/${versioned} grl-cdn:/root/gr-cdn/"
+ dir(env.BUILD_DIR) {
+ sh "cp ${env.JS_FILENAME}.js ${versioned}.js"
+ sh "/usr/bin/rsync -v ${versioned}.js grl-cdn:/root/gr-cdn/"
+ }
}
}