-
Notifications
You must be signed in to change notification settings - Fork 9
/
Jenkinsfile
97 lines (96 loc) · 3.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
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
pipeline {
agent any
environment {
GIT_REPO = 'bookstore-back-new'
GIT_CREDENTIAL_ID = '7c21addc-0cbf-4f2e-9bd8-eced479c56c6'
SONARQUBE_URL = 'http://172.24.101.209:8082/sonar-isis2603'
ARCHID_TOKEN = credentials('archid')
SONAR_TOKEN = credentials('sonar-login')
}
stages {
stage('Checkout') {
steps {
scmSkip(deleteBuild: true, skipPattern:'.*\\[ci-skip\\].*')
git branch: 'main',
credentialsId: env.GIT_CREDENTIAL_ID,
url: 'https://github.com/Uniandes-isis2603/' + env.GIT_REPO
}
}
stage('GitInspector') {
steps {
withCredentials([usernamePassword(credentialsId: env.GIT_CREDENTIAL_ID, passwordVariable: 'GIT_PASSWORD', usernameVariable: 'GIT_USERNAME')]) {
sh 'mkdir -p code-analyzer-report'
sh """ curl --request POST --url https://code-analyzer.virtual.uniandes.edu.co/analyze --header "Content-Type: application/json" --data '{"repo_url":"[email protected]:Uniandes-isis2603/${GIT_REPO}.git", "access_token": "${GIT_PASSWORD}" }' > code-analyzer-report/index.html """
}
publishHTML (target: [
allowMissing: false,
alwaysLinkToLastBuild: false,
keepAll: true,
reportDir: 'code-analyzer-report',
reportFiles: 'index.html',
reportName: "GitInspector"
])
}
}
stage('Build') {
// Build artifacts
steps {
script {
docker.image('citools-isis2603:latest').inside('-v $HOME/.m2:/root/.m2:z -u root') {
sh '''
java -version
mvn clean install
'''
}
}
}
}
stage('Testing') {
// Run unit tests
steps {
script {
docker.image('citools-isis2603:latest').inside('-v $HOME/.m2:/root/.m2:z -u root') {
sh '''
mvn test
'''
}
}
}
}
stage('Static Analysis') {
// Run static analysis
steps {
script {
docker.image('citools-isis2603:latest').inside('-v $HOME/.m2:/root/.m2:z -u root') {
sh '''
mvn sonar:sonar -Dsonar.token=${SONAR_TOKEN} -Dsonar.host.url=${SONARQUBE_URL}
'''
}
}
}
}
stage('ARCC') {
// Run arcc analysis
steps {
script {
docker.image('arcc-tools-isis2603:latest').inside('-e ARCHID_TOKEN=${ARCHID_TOKEN}'){
sh '''
java -version
rsync --recursive . bookstore-back
java -cp /eclipse/plugins/org.eclipse.equinox.launcher_1.5.700.v20200207-2156.jar org.eclipse.equinox.launcher.Main -application co.edu.uniandes.archtoring.archtoring bookstore-back
'''
}
}
}
}
}
post {
always {
cleanWs()
deleteDir()
dir("${env.GIT_REPO}@tmp") {
deleteDir()
}
}
}
}