aboutsummaryrefslogtreecommitdiff
path: root/Jenkinsfile
diff options
context:
space:
mode:
Diffstat (limited to 'Jenkinsfile')
-rw-r--r--Jenkinsfile25
1 files changed, 17 insertions, 8 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
"""