This repository has been archived by the owner on Nov 28, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Jenkinsfile
96 lines (96 loc) · 2.9 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
// Developed by: Marcelo Jacinto
// Date: 29/05/2022
pipeline {
agent {
docker {
image 'docker.io/dsorisr/medusa:v0.0.1'
//image 'harbor.dsor.isr.tecnico.ulisboa.pt/medusa/medusa:latest'
//registryUrl 'https://harbor.dsor.isr.tecnico.ulisboa.pt'
//registryCredentialsId 'harbor-robot-token'
args '--entrypoint=""'
reuseNode false
}
}
environment {
ROS_WORKSPACE="${WORKSPACE}/catkin_ws"
}
options {
checkoutToSubdirectory('catkin_ws/src')
}
// Move all the packages to the default catkin workspace
stages {
// Build stage - compile the code (using 10 threads)
stage('Build') {
steps {
echo 'Build..'
dir('catkin_ws') {
sh '''#!/bin/bash
source /opt/ros/noetic/setup.bash
catkin build --no-status -j10'''
}
}
}
// Test stage - test the code
stage('Test') {
steps {
echo 'Testing..'
// Only test the code inside the medusa meta-packages (ignoring 3rd party code)
dir('catkin_ws/src/test') {
sh '''#!/bin/bash
bash unit_test.sh
'''
}
}
}
// Generate Doxygen documentation
// only in release tags
stage('Documentation') {
when {
expression {env.BRANCH_NAME == "main"}
}
steps{
echo 'Generating Doxygen Documentation..'
dir('catkin_ws/src') {
withCredentials([GitUsernamePassword(
credentialsId: 'github_app_tokn',
gitToolName: 'Default')])
{
sh '''#!/bin/bash
git config --global push.default tracking
python3 docs/scripts/generate_documentation.py deploy
'''
}
}
}
}
// Update the docker image on the cloud if the docker file has changed
stage('Update Docker Image') {
when {
changeset "Dockerfile"
}
steps {
echo 'Generating the new docker image'
// TODO
echo 'Uploading the new image to online hub'
// TODO
}
}
}
// Cleanup the jenkins environment after running
post {
always {
echo "Pipeline finished do cleanup"
deleteDir()
}
success {
echo "Release Success"
}
failure {
echo "Release Failed"
}
cleanup {
echo "Clean up in post work space"
cleanWs()
}
}
}