From 984bbda0c176fc6e92115b008872c3af6b9aec23 Mon Sep 17 00:00:00 2001 From: Emilia Allison Date: Sat, 6 Jan 2024 14:49:11 -0500 Subject: [PATCH 1/4] Test Jenkinsfile for building plate-tool-beta Hotfix #1 Hotfix #2 Hothix #4 Hotfix #5 Transfer & Deploy steps Hotfix #6 Hotfix #7 Hotfix #8 --- Jenkinsfile | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..971ea8a --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,40 @@ +pipeline { + agent any + + stages { + stage('Build') { + steps { + sh ''' + . "$HOME/.cargo/env" + trunk build --release --public-url "cool-stuff/plate-tool-beta/" + ''' + } + } + stage('Archive') { + steps { + zip zipFile: "dist.zip", archive: true, dir: "dist/" + archiveArtifacts artifacts: "dist.zip", fingerprint: true + } + } + stage('Transfer') { + steps { + sh 'echo "put -r dist/" | sftp oracle' + } + } + stage('Deploy') { + steps { + sh ''' + ssh oracle "sudo rm -rf /usr/share/nginx/html/plate-tool-beta/ && sudo mv dist /usr/share/nginx/html/plate-tool-beta" + ''' + } + } + } + post { + always { + cleanWs(notFailBuild: true, + deleteDirs: true, + cleanWhenNotBuilt: false, + patterns: [[pattern: 'target/', type: 'EXCLUDE']]) + } + } +} From 1f213f47e898e1e4de5eb75708c121755551dbcb Mon Sep 17 00:00:00 2001 From: Emilia Date: Tue, 30 Jan 2024 20:49:27 -0500 Subject: [PATCH 2/4] Jenkinsfile compatability with main --- Jenkinsfile | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 971ea8a..0bff50a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -2,11 +2,22 @@ pipeline { agent any stages { + stage('Setup') { + if (env.BRANCH_NAME == 'main') { + environment { + OUTPUT_DIR = 'plate-tool' + } + } else { + environment { + OUTPUT_DIR = 'plate-tool-beta' + } + } + } stage('Build') { steps { sh ''' . "$HOME/.cargo/env" - trunk build --release --public-url "cool-stuff/plate-tool-beta/" + trunk build --release --public-url "cool-stuff/$OUTPUT_DIR/" ''' } } @@ -24,7 +35,7 @@ pipeline { stage('Deploy') { steps { sh ''' - ssh oracle "sudo rm -rf /usr/share/nginx/html/plate-tool-beta/ && sudo mv dist /usr/share/nginx/html/plate-tool-beta" + ssh oracle "sudo rm -rf /usr/share/nginx/html/$OUTPUT_DIR/ && sudo mv dist /usr/share/nginx/html/$OUTPUT_DIR" ''' } } From 0b82f2b1ab2ed63de83d9c00b9431199755e2ec7 Mon Sep 17 00:00:00 2001 From: Emilia Date: Tue, 30 Jan 2024 20:55:09 -0500 Subject: [PATCH 3/4] See last commit --- Jenkinsfile | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 0bff50a..a56b3ca 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -3,14 +3,8 @@ pipeline { stages { stage('Setup') { - if (env.BRANCH_NAME == 'main') { - environment { - OUTPUT_DIR = 'plate-tool' - } - } else { - environment { - OUTPUT_DIR = 'plate-tool-beta' - } + environment { + OUTPUT_DIR = "${env.BRANCH_NAME == "main" ? "plate-tool" : "plate-tool-beta"}" } } stage('Build') { From 0b6aec2f6ccfc43099abc9eaf0c293dbea1fe445 Mon Sep 17 00:00:00 2001 From: Emilia Date: Tue, 30 Jan 2024 20:56:48 -0500 Subject: [PATCH 4/4] pls work --- Jenkinsfile | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index a56b3ca..d5eb792 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,12 +1,10 @@ pipeline { agent any + environment { + OUTPUT_DIR = "${env.BRANCH_NAME == "main" ? "plate-tool" : "plate-tool-beta"}" + } stages { - stage('Setup') { - environment { - OUTPUT_DIR = "${env.BRANCH_NAME == "main" ? "plate-tool" : "plate-tool-beta"}" - } - } stage('Build') { steps { sh '''