-
Notifications
You must be signed in to change notification settings - Fork 39
/
Jenkinsfile
66 lines (64 loc) · 1.99 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
pipeline {
agent { label 'php' }
stages {
//stage('Clean') {
// steps {
// cleanWs()
// }
//}
stage('Build') {
steps {
sh 'composer install --no-progress --no-interaction --no-scripts --prefer-dist'
}
}
stage('Run Tests') {
steps {
sh 'php -i | grep debug'
sh 'composer test -- --log-junit=junit.xml'
//sh 'composer test -- --coverage-clover=clover.xml --log-junit=junit.xml'
}
}
stage('SonarQube analysis') {
steps {
script {
scannerHome = tool 'SonarQube Scanner 2.8'
}
withSonarQubeEnv('sonar_procergs') {
sh "${scannerHome}/bin/sonar-scanner"
}
}
}
//stage('Quality Gate') {
// steps {
// timeout(time: 5, unit: 'MINUTES') {
// waitForQualityGate abortPipeline: true
// }
// }
//}
// Artifactory examples:
// https://github.com/jfrog/project-examples/tree/master/jenkins-examples/pipeline-examples
stage('Archive') {
steps {
// Save commit ID to file
sh 'echo $GIT_COMMIT > web/commit'
sh 'composer archive --format=zip --dir=dist'
archiveArtifacts artifacts: 'dist/*.zip'
script {
def artifactory = Artifactory.server('artifactory')
def uploadSpec = """{
"files": [{
"pattern": "dist/*.zip",
"target": "php-local/procergs/login-cidadao/"
}]
}"""
artifactory.upload(uploadSpec)
}
}
}
}
post {
always {
deleteDir()
}
}
}