-
Notifications
You must be signed in to change notification settings - Fork 0
/
simple.groovy
58 lines (53 loc) · 1.33 KB
/
simple.groovy
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
properties([disableConcurrentBuilds()])
pipeline {
agent {
label 'master'
}
options {
buildDiscarder(logRotator(numToKeepStr: '3'))
timestamps()
}
environment {
DOCKER_COMPOSE = "/usr/bin/compose"
}
stages {
stage('Build') {
steps {
echo 'Building..'
}
}
stage("Testing myapp") {
steps {
withEnv(["PATH+EXTRA=$DOCKER_COMPOSE"]) {
sh "cd $WORKSPACE/final_project"
dir ("$WORKSPACE/final_project") {
sh "ls -a"
sh "docker compose up --abort-on-container-exit"
}
}
}
}
stage('Deploy') {
steps {
echo 'Deploying....'
}
}
}
post {
always {
allure([
reportBuildPolicy: 'ALWAYS',
results: [[path: 'alluredir']]
])
script {
withEnv(["PATH+EXTRA=$DOCKER_COMPOSE"]) {
sh "cd $WORKSPACE/final_project"
dir("$WORKSPACE/final_project") {
sh 'docker compose down'
}
}
}
cleanWs()
}
}
}