-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathJenkinsfile
35 lines (35 loc) · 995 Bytes
/
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
pipeline {
agent any
stages {
stage('Prepare') {
steps {
sh '/usr/local/bin/composer install --prefer-dist --optimize-autoloader --no-interaction'
}
}
stage('Test') {
steps {
sh 'vendor/bin/simple-phpunit'
}
}
stage('Create artifact') {
steps {
sh 'rm -rf var/cache/*'
sh 'APP_ENV=prod /usr/local/bin/composer install --prefer-dist --no-dev --optimize-autoloader --no-interaction'
sh 'mkdir /tmp/release'
sh 'cp -r * /tmp/release/'
sh 'tar --exclude="*.git" -zcf release.tgz /tmp/release/*'
sh 'rm -rf /tmp/release'
archiveArtifacts(onlyIfSuccessful: true, artifacts: 'release.tgz')
}
}
stage('Deploy') {
steps {
sh 'echo "Deploy"'
// sh 'ansible-playbook /var/lib/jenkins/cleanphp-ansible/deploy.yml -i /var/lib/jenkins/cleanphp-ansible/inventory -e artifact=release.tgz'
}
}
}
environment {
APP_ENV = 'dev'
}
}