-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
101 lines (90 loc) · 2.79 KB
/
Copy pathJenkinsfile
File metadata and controls
101 lines (90 loc) · 2.79 KB
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
pipeline {
agent any
options {
ansiColor('xterm')
}
environment {
// Define environment variables here
BOT_NAME = 'awesome-bot'
// BOT_TOKEN = credentials('telegram-bot-token')
}
stages {
stage('Initialisation') {
steps {
sh "echo Branch name ${BRANCH_NAME}"
sh "make venv && make install"
}
}
stage('Environment variable injection') {
steps {
script {
withCredentials([file(credentialsId: 'matbradiouf-chatbot-env-file', variable: 'ENV_FILE')]) {
// Load the environment variables from the file
echo "Loading environment variables from ${ENV_FILE}"
sh "cat ${ENV_FILE} > .env"
}
}
}
}
stage('Tests Unitaires') {
steps {
script {
// Add your test commands here
echo "Running tests..."
sh "make test"
}
}
}
stage('Build') {
steps {
script {
// Add your build commands here
echo "Building the project..."
sh "make build"
}
}
}
stage('Deploy') {
steps {
script {
// Add your deployment commands here
echo "Deploying the project..."
sh "make deploy env=${BRANCH_NAME}"
}
}
}
stage('Test endpoint'){
steps {
script {
// Add your endpoint testing commands here
echo "Testing the endpoint..."
sh "make test-endpoint env=${BRANCH_NAME}"
}
}
}
}
post {
always {
script {
// Add your post-build actions here
echo "Post-build actions..."
}
}
success {
script {
// Notify success
echo "Build succeeded!"
// Uncomment the line below to send a message to Telegram
// sh "curl -X POST https://api.telegram.org/bot${BOT_TOKEN}/sendMessage -d chat_id=<CHAT_ID> -d text='Build succeeded!'"
}
}
failure {
script {
// Notify failure
echo "Build failed!"
// Uncomment the line below to send a message to Telegram
// sh "curl -X POST https://api.telegram.org/bot${BOT_TOKEN}/sendMessage -d chat_id=<CHAT_ID> -d text='Build failed!'"
}
}
}
}