forked from josejbocanegra/ISIS2603
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
104 lines (101 loc) · 3.49 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
98
99
100
101
102
103
104
pipeline {
agent any
environment {
GIT_REPO = '202020_S2_E1_MiBarrio_Back'
SONARQUBE_URL = 'http://172.24.101.209:8082'
MAVEN_CONFIG = '/home/estudiante/DATA/maven'
GIT_CREDENTIAL_ID = '692cb316-0794-4522-9cf0-83c2618a09e5'
ARCHID_TOKEN = credentials('041703df-dd96-47c3-97b1-b7fbf12069d5')
}
stages {
stage('Checkout') {
steps {
scmSkip(deleteBuild: true, skipPattern:'.*\\[ci-skip\\].*')
git branch: 'master',
credentialsId: env.GIT_CREDENTIAL_ID,
url: 'https://github.com/Uniandes-isis2603/' + env.GIT_REPO
}
}
stage('Build') {
// Build artifacts
steps {
script {
docker.image('citools-isis2603:latest').inside('-v ${MAVEN_CONFIG}:/root/.m2 -u root') {
sh '''
java -version
mvn -v
node -v
npm -v
newman -v
mvn clean package
'''
}
}
}
}
stage('Testing') {
// Run unit tests and integration tests
steps {
script {
docker.image('citools-isis2603:latest').inside('-v ${MAVEN_CONFIG}:/root/.m2 -u root') {
sh '''
mvn clean test integration-test
'''
}
}
}
}
stage('Static Analysis') {
// Run static analysis
steps {
script {
docker.image('citools-isis2603:latest').inside('-v ${MAVEN_CONFIG}:/root/.m2 -u root') {
sh '''
mvn clean verify sonar:sonar -Dsonar.host.url=${SONARQUBE_URL}
'''
}
}
}
}
stage('Git Analysis') {
// Run git analysis
steps {
script {
docker.image('gitinspector-isis2603').inside('--entrypoint=""') {
sh '''
mkdir -p ./reports/
datetime=$(date +'%Y-%m-%d_%H%M%S')
gitinspector --file-types="java" --format=html --AxU -w -T -x author:Bocanegra > ./reports/index.html
'''
}
}
withCredentials([usernamePassword(credentialsId: env.GIT_CREDENTIAL_ID, passwordVariable: 'GIT_PASSWORD', usernameVariable: 'GIT_USERNAME')]) {
sh('git config --global user.email "[email protected]"')
sh('git config --global user.name "ci-isis2603"')
sh('git add -A')
sh('git commit -m "[ci-skip] GitInspector report added"')
sh('git push https://${GIT_USERNAME}:${GIT_PASSWORD}@github.com/Uniandes-isis2603/${GIT_REPO} master')
}
}
}
stage('ARCC') {
// Run arcc analysis
steps {
script {
docker.image('arcc-tools-isis2603:latest').inside('-e ARCHID_TOKEN=${ARCHID_TOKEN}') {
sh '''
java -version
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 --full
'''
}
}
}
}
}
post {
always {
// Clean workspace
cleanWs deleteDirs: true
}
}
}