diff options
| author | Max Nanis | 2026-09-10 11:17:07 -0700 |
|---|---|---|
| committer | Max Nanis | 2026-09-10 11:17:07 -0700 |
| commit | 26167c923448fae157f5134350e771928ad09b0b (patch) | |
| tree | 7c0442b82edce6370007e3a604e36d7c395d5987 /Jenkinsfile | |
| parent | bbc373bd2e9617c8da829b3a180e9c42f139a380 (diff) | |
| download | amt-jb-26167c923448fae157f5134350e771928ad09b0b.tar.gz amt-jb-26167c923448fae157f5134350e771928ad09b0b.zip | |
basic tests should be working. Jenkins p1
Diffstat (limited to 'Jenkinsfile')
| -rw-r--r-- | Jenkinsfile | 88 |
1 files changed, 20 insertions, 68 deletions
diff --git a/Jenkinsfile b/Jenkinsfile index eb53bfd..0632ee8 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -10,95 +10,47 @@ pipeline { pollSCM('H */3 * * *') } + options { + skipDefaultCheckout() + } + environment { DATA_SRC = "${env.WORKSPACE}/mnt/" - - AMT_JB_CARER_VENV = "${env.WORKSPACE}/amt-jb-carer-venv" - AMT_JB_VENV = "${env.WORKSPACE}/amt-jb-venv" + VENV = "${env.WORKSPACE}/amt-jb-venv" } stages { - stage('Setup DB') { - steps { - script { - 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=${env.DB_PASSWORD} psql -h ${env.DB_POSTGRESQL_HOST} -U ${env.DB_USER} -d postgres <<EOF - CREATE DATABASE "${env.DB_NAME}" WITH TEMPLATE = template0 ENCODING = 'UTF8'; - EOF - """ - } - } - - stage('env') { + stage('setup') { steps { - withCredentials([file( - credentialsId: 'amt-jb-app-env', - variable: 'ENV_FILE_PATH')]) { - sh "cp \$ENV_FILE_PATH ${WORKSPACE}/.env.test" + dir("generalresearch-${VER}") { + deleteDir() + unstash 'source' + + withCredentials([file( + credentialsId: '971e1f48-09ce-4446-9155-a52c1adb6249', + variable: 'ENV_TEST_FILE')]) { + sh 'cp $ENV_TEST_FILE .env.test' } - } - } - - stage('setup:amt-jb-carer') { - steps { - checkout scmGit( - branches: [[name: 'master']], - extensions: [ cloneOption(shallow: true) ], - userRemoteConfigs: [ - [credentialsId: 'abdeb570-b708-44f3-b857-8a6b06ed9822', - url: 'ssh://code.g-r-l.com:6611/panels/amt-jb'] - ], - ) - - 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' - sh '$AMT_JB_CARER_VENV/bin/python3.13 manage.py migrate --settings=carer.settings.unittest' + sh "/usr/local/bin/python3.14 -m venv ${VENV}" + sh "${VENV}/bin/pip install -U setuptools wheel pip" + sh "${VENV}/bin/pip install -r requirements.txt" + sh "${VENV}/bin/pip install django" } } } - /* Okay, finally we can setup the virtual environment for the actual - project itself. gr-api FastAPI doesn't manage any of it's own - database so it doesn't need to do any migrations or anything. - */ - stage('setup:amt-jb') { - steps { - sh 'python3.13 -m venv $AMT_JB_VENV' - sh '$AMT_JB_VENV/bin/pip install -U setuptools wheel pip' - 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 - """ - } - } - } - stage('tests') { steps { - sh '$AMT_JB_VENV/bin/pytest -v tests' + sh '$VENV/bin/pytest tests/test_postgres.py -vs' } } + } post { always { echo 'One way or another, I have finished' deleteDir() /* clean up our workspace */ - - sh """ - PGPASSWORD=${env.DB_PASSWORD} psql -h ${env.DB_POSTGRESQL_HOST} -U ${env.DB_USER} -d postgres <<EOF - DROP DATABASE "${env.DB_NAME}"; - EOF - """ } } } |
