aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Nanis2026-02-27 16:52:38 -0500
committerMax Nanis2026-02-27 16:52:38 -0500
commit5a3e20ee7bf6088330ffe2bd43eed1ef41dd3b02 (patch)
tree9d72540b1fa352fbea811094705d2248c38f4d25
parent24bc0a8f3ad434932c0b35a3a4d6715a18a8f919 (diff)
downloadamt-jb-5a3e20ee7bf6088330ffe2bd43eed1ef41dd3b02.tar.gz
amt-jb-5a3e20ee7bf6088330ffe2bd43eed1ef41dd3b02.zip
Jenkins Attempt #2 (linter, and env stage)
-rw-r--r--Jenkinsfile25
-rw-r--r--carer/carer/settings/base.py2
-rw-r--r--jb-ui/Jenkinsfile30
3 files changed, 30 insertions, 27 deletions
diff --git a/Jenkinsfile b/Jenkinsfile
index 265e6c6..cb285e0 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -18,22 +18,32 @@ pipeline {
}
stages {
- stage('Setup DB'){
+ stage('Setup DB') {
steps {
script {
- env.DB_NAME = "unittest-amt-jb-" + UUID.randomUUID().toString().replace("-", "").take(12)
- env.AMT_JB_DB = "postgres://jenkins:123456789@unittest-postgresql.fmt2.grl.internal/${env.DB_NAME}"
+ env.DB_NAME = 'unittest-amt-jb-' + UUID.randomUUID().toString().replace('-', '').take(12)
+ env.AMT_JB_DB = "postgres://${env.DB_USER}:${env.DB_PASSWORD}@${env.DB_POSTGRESQL_HOST}/${env.DB_NAME}"
echo "Using database: ${env.DB_NAME}"
}
sh """
- PGPASSWORD=123456789 psql -h unittest-postgresql.fmt2.grl.internal -U jenkins -d postgres <<EOF
+ PGPASSWORD=${env.DB_PASSWORD} psql -h ${env.DB_POSTGRESQL_HOST} -U ${env.DB_USER} -d ${env.DB_PASSWORD} <<EOF
CREATE DATABASE "${env.DB_NAME}" WITH TEMPLATE = template0 ENCODING = 'UTF8';
EOF
"""
}
}
+ stage('env') {
+ steps {
+ withCredentials([file(
+ credentialsId: 'amt-jb-app-env',
+ variable: 'ENV_FILE_PATH')]) {
+ sh "cp \$ENV_FILE_PATH ${WORKSPACE}/.env.test"
+ }
+ }
+ }
+
stage('setup:amt-jb-carer') {
steps {
checkout scmGit(
@@ -45,7 +55,7 @@ pipeline {
],
)
- dir("carer/") {
+ dir('carer/') {
sh 'python3.13 -m venv $AMT_JB_CARER_VENV'
sh '$AMT_JB_CARER_VENV/bin/pip install -U setuptools wheel pip'
sh '$AMT_JB_CARER_VENV/bin/pip install -r requirements.txt'
@@ -65,12 +75,11 @@ pipeline {
withCredentials([sshUserPrivateKey(
credentialsId: 'abdeb570-b708-44f3-b857-8a6b06ed9822',
keyFileVariable: 'SSH_PRIVATE_KEY')]) {
-
sh """
eval \$(ssh-agent) && ssh-add ${SSH_PRIVATE_KEY} && \
${AMT_JB_VENV}/bin/pip install -r requirements.txt
"""
- }
+ }
}
}
@@ -86,7 +95,7 @@ pipeline {
deleteDir() /* clean up our workspace */
sh """
- PGPASSWORD=123456789 psql -h unittest-postgresql.fmt2.grl.internal -U jenkins -d postgres <<EOF
+ PGPASSWORD=${env.DB_PASSWORD} psql -h ${env.DB_POSTGRESQL_HOST} -U ${env.DB_USER} -d postgres <<EOF
DROP DATABASE "${env.DB_NAME}";
EOF
"""
diff --git a/carer/carer/settings/base.py b/carer/carer/settings/base.py
index aea1920..c83e0fe 100644
--- a/carer/carer/settings/base.py
+++ b/carer/carer/settings/base.py
@@ -6,8 +6,6 @@ BASE_DIR = Path(__file__).resolve().parent.parent
SECRET_KEY = os.environ.get("CARER_SECRET_KEY")
-ALLOWED_HOSTS = []
-
INSTALLED_APPS = [
"carer.mtwerk",
]
diff --git a/jb-ui/Jenkinsfile b/jb-ui/Jenkinsfile
index 2735dc6..27a0ab9 100644
--- a/jb-ui/Jenkinsfile
+++ b/jb-ui/Jenkinsfile
@@ -7,9 +7,9 @@ pipeline {
}
environment {
- BUILD_DIR = "dist"
- JS_FILENAME = "james-billings"
- CSS_FILENAME = "james-has-style"
+ BUILD_DIR = 'dist'
+ JS_FILENAME = 'james-billings'
+ CSS_FILENAME = 'james-has-style'
}
options {
@@ -17,8 +17,7 @@ pipeline {
}
stages {
-
- stage('setup'){
+ stage('setup') {
steps {
cleanWs()
checkout scmGit(
@@ -38,31 +37,30 @@ pipeline {
credentialsId: 'amt-jb-ui-env',
variable: 'ENV_FILE_PATH')]) {
sh "cp \$ENV_FILE_PATH ${WORKSPACE}/jb-ui/.env.production"
- }
+ }
}
}
stage('pnpm.install') {
steps {
- dir("jb-ui") {
- sh "pnpm install"
+ dir('jb-ui') {
+ sh 'pnpm install'
}
}
}
stage('pnpm.test') {
steps {
- dir("jb-ui") {
- sh "pnpm run test"
+ dir('jb-ui') {
+ sh 'pnpm run test'
}
}
}
stage('pnpm.build') {
-
steps {
- dir("jb-ui") {
- sh "pnpm run build"
+ dir('jb-ui') {
+ sh 'pnpm run build'
script {
dir(env.BUILD_DIR) {
def minSize = 750 * 1024
@@ -93,7 +91,7 @@ pipeline {
expression { env.BRANCH_NAME != 'master' }
}
steps {
- dir("jb-ui") {
+ dir('jb-ui') {
script {
echo "Detected branch: ${env.BRANCH_NAME}"
def versioned_js = "${env.JS_FILENAME}-${env.BRANCH_NAME}"
@@ -106,7 +104,6 @@ pipeline {
sh "/usr/bin/rsync -avz ${WORKSPACE}/jb-ui/${env.BUILD_DIR}/ thl-cdn:/root/amt-jb-cdn/"
}
}
-
}
}
}
@@ -119,7 +116,7 @@ pipeline {
}
steps {
- dir("jb-ui") {
+ dir('jb-ui') {
script {
echo "Detected tag: ${env.TAG_NAME}"
def versioned_js = "${env.JS_FILENAME}-${env.TAG_NAME}"
@@ -132,7 +129,6 @@ pipeline {
sh "/usr/bin/rsync -avz ${WORKSPACE}/jb-ui/${env.BUILD_DIR}/ thl-cdn:/root/amt-jb-cdn/"
}
}
-
}
}
}