-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
41 lines (36 loc) · 1.19 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
node {
checkout scm
// build
stage("Build"){
docker.image('shippingdocker/php-composer:7.4').inside('-u root') {
sh 'rm composer.lock'
sh 'composer install'
}
}
// Testing
stage("Test"){
docker.image('php:7.4-cli').inside('-u root') {
sh 'php artisan test --testsuite=Unit'
}
}
// Deploy
stage("Deploy"){
docker.image('agung3wi/alpine-rsync:1.1').inside('-u root') {
sshagent (credentials: ['ssh-dev']) {
sh 'mkdir -p ~/.ssh'
sh 'ssh-keyscan -H "$IP_DEV" > ~/.ssh/known_hosts'
sh "rsync -rav --delete ./ ubuntu@$IP_DEV:/home/ubuntu/dev.kelasdevops.xyz/ --exclude=.env --exclude=storage --exclude=.git"
}
}
}
// Integration test
stage("Test"){
docker.image('agung3wi/alpine-rsync:1.1').inside('-u root') {
sshagent (credentials: ['ssh-dev']) {
sh 'mkdir -p ~/.ssh'
sh 'ssh-keyscan -H "$IP_DEV" > ~/.ssh/known_hosts'
sh "ssh ubuntu@$IP_DEV 'cd /home/ubuntu/dev.kelasdevops.xyz/ && php artisan test --testsuite=Feature'"
}
}
}
}