-
Notifications
You must be signed in to change notification settings - Fork 5
/
Jenkinsfile
75 lines (61 loc) · 1.32 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
pipeline {
agent any
triggers {
githubPush()
}
environment {
DOCKERHUB_CREDENTIALS=credentials('Dockerhub')
}
stages{
stage("unit test"){
agent {
docker {
image 'node:lts'
reuseNode true
}
}
steps {
sh "npm i "
sh"""
cp /Read-it/deployment/envfiles/backend_testing.env ./.env
cp /Read-it/Backend/private/privateKey.json ./private/
"""
sh "npm run test"
}
}
stage('Build') {
steps {
sh 'docker build -t waer/backend:latest .'
}
}
stage("intgration testing"){
steps {
sh """
cd /Read-it-testing/deployment-testing
docker-compose up --exit-code-from cypress
docker wait cypress
"""
}
}
stage('Login') {
steps {
sh 'echo $DOCKERHUB_CREDENTIALS_PSW | docker login -u $DOCKERHUB_CREDENTIALS_USR --password-stdin'
}
}
stage('Push') {
steps {
sh 'docker push waer/backend:latest'
}
}
}
post {
always {
sh 'docker logout'
echo "------------------------------ down the Testing enviroment ---------------------------------------------"
sh"""
cd /Read-it-testing/deployment-testing
docker-compose down
"""
}
}
}