forked from upes-open/Bus-Tracking-system
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pipeline.Jenkinsfile
94 lines (81 loc) · 2.37 KB
/
pipeline.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
pipeline {
agent any
stages {
stage('Checkout') {
steps {
checkout scm
}
}
// stage('Build and Test') {
// steps {
// // Set up Flutter environment (adjust paths as needed)
// sh 'export PATH=$PATH:/home/ubuntu/snap/flutter/common/flutter/bin'
// sh 'flutter doctor'
// // Build Flutter project
// dir('Bus-Tracking-system/src/bus_tracking_system/') {
// sh 'flutter build apk'
// }
// // Run tests
// sh 'flutter test'
// }
// }
stage('Publish to Nexus') {
steps {
// Publish artifacts to Nexus
nexusArtifactUploader(
nexusVersion: 'nexus3',
protocol: 'http',
nexusUrl: 'http://localhost:8081/repository/Bus-Tracking-Application/',
groupId: 'com.example',
version: '1.0.0',
repository: 'Bus-Tracking-Application',
file: 'Bus-Tracking-system/src/bus_tracking_system/build/app/outputs/flutter-apk/app-release.apk',
credentialsId: 'nexus-credentials'
)
}
}
// stage('Deploy to Staging') {
// steps {
// // Deploy to staging environment
// sh 'flutter deploy staging'
// }
// }
// stage('Deploy to Production') {
// steps {
// // Deploy to production environment
// sh 'flutter deploy production'
// }
// }
// stage('Post-Deployment Test') {
// steps {
// // Run post-deployment tests
// sh 'flutter test_integration'
// }
}
}
post {
always {
// Archive artifacts
archiveArtifacts 'build/app/outputs/flutter-apk/*.apk'
}
success {
// Send email notification on success
emailext (
to: 'aakshitasingh786@gmail.com',
subject: 'Build Successful: Bus Tracking System',
body: 'The Bus Tracking System build and deployment were successful.'
)
}
failure {
// Send email notification on failure
emailext (
to: 'aakshitasingh786@gmail.com',
subject: 'Build Failed: Bus Tracking System',
body: 'The Bus Tracking System build and deployment failed. Please check the Jenkins logs for details.'
)
}
}
// // Trigger the pipeline when code is pushed to the main branch
// triggers {
// scm('*/5 * * * *') // Poll SCM every 5 minutes
// }