-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
41 lines (41 loc) · 1.25 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
pipeline{
agent{
label 'ecr'
}
stages{
stage('Build'){
steps{
sh "/usr/local/bin/docker-compose -f ./Develop/docker-compose.yml build"
}
}
stage('Test'){
steps{
sh "/usr/local/bin/docker-compose -f ./Develop/docker-compose.yml up -d"
sh "chmod a+x ./test.sh"
script{
flag = sh (script: './test.sh', returnStdout: true)
echo "Resultado : ${flag}"
}
sh "/usr/local/bin/docker-compose -f ./Develop/docker-compose.yml down"
}
}
stage('Deploy'){
steps{
script{
echo "Resultado : ${flag}"
if(flag.contains("PASSED")){
version = sh (script: 'cat version', returnStdout: true)
sh 'docker build -t ecs-javi-repository ./Develop/django'
sh '$(aws ecr get-login --no-include-email --region us-east-2)'
sh "docker tag ecs-javi-repository:latest 797409686075.dkr.ecr.us-east-2.amazonaws.com/ecs-javi-repository:latest"
sh "docker push 797409686075.dkr.ecr.us-east-2.amazonaws.com/ecs-javi-repository:latest"
sh "chmod a+x ./Deploy/delete.sh"
sh "./Deploy/delete.sh"
} else {
echo "Test not passed"
}
}
}
}
}
}