-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathJenkinsfile_Java
More file actions
50 lines (45 loc) · 1.19 KB
/
Copy pathJenkinsfile_Java
File metadata and controls
50 lines (45 loc) · 1.19 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
pipeline {
agent any
stages {
stage('Checkout') {
steps {
echo 'Checking out source code...'
checkout scm // Use the Jenkins SCM configuration
}
}
stage('Build') {
steps {
echo 'Building the project...'
// Example build command (adjust for your build system)
sh 'make build'
}
}
stage('Test') {
steps {
echo 'Running tests...'
// Example test command
sh 'make test'
}
}
stage('Deploy') {
when {
branch 'main' // Only deploy on a specific branch
}
steps {
echo 'Deploying the project...'
// Example deployment command
sh 'make deploy'
}
}
}
post {
success {
echo 'Pipeline succeeded!'
// Additional actions on success (e.g., notifications)
}
failure {
echo 'Pipeline failed!'
// Additional actions on failure (e.g., alerts, cleanup)
}
}
}