-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
44 lines (44 loc) · 1.16 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
pipeline {
agent {
node {
label 'docker'
}
}
stages {
stage('Clone') {
steps {
git branch: 'develop', url: 'https://github.com/harbourheading/savsa.git'
}
}
stage('Setup Environment') {
steps {
withCredentials([file(credentialsId: 'savsaenvfile', variable: 'ENV_FILE')]) {
script {
if (!fileExists('.env')) {
sh 'cp ${ENV_FILE} .env'
} else {
echo '.env file already exists. Skipping copy.'
}
}
}
}
}
stage('Build') {
steps {
sh 'docker compose up -d --no-color --wait'
sh 'docker compose ps'
}
}
stage('Test') {
steps {
sh 'docker exec backend pytest'
}
}
}
post {
always {
sh 'docker compose down'
sh 'docker system prune --filter "label!=database" --volumes -f'
}
}
}