-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathJenkinsfile
More file actions
94 lines (88 loc) · 3.77 KB
/
Jenkinsfile
File metadata and controls
94 lines (88 loc) · 3.77 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
pipeline {
agent any
stages {
stage('Determine Branch and Execute Jobs') {
steps {
script {
def commitHash = env.GIT_COMMIT // Get the current commit hash
if (env.BRANCH_NAME == 'devel') {
// This block runs only for the 'devel' branch
echo "Running on 'devel' branch"
stage('Build Image for Devel') {
echo "Building image for 'devel' branch"
build job: 'Ingenium/build_image',
parameters: [
string(name: 'REPO', value: 'execution_server'),
string(name: 'REPO_BRANCH', value: 'devel')
]
}
stage('Update CI Image for Devel') {
echo "Updating CI image for 'devel' branch"
build job: 'Ingenium/update_ci_image',
parameters: [
string(name: 'REPO', value: 'execution_server'),
string(name: 'REPO_BRANCH', value: 'devel')
]
}
} else {
// This block runs for any other branch (including PRs)
echo "Running on branch '${env.BRANCH_NAME}', which is not 'devel'"
stage('Build Image for PR or Other Branch') {
echo "Building image for branch '${env.BRANCH_NAME}'"
build job: 'Ingenium/build_image',
parameters: [
string(name: 'REPO', value: 'execution_server'),
string(name: 'REPO_TAG', value: commitHash)
]
}
stage('Run Repo Tests for PR') {
echo "Running repo tests for branch '${env.BRANCH_NAME}'"
build job: 'Ingenium/run_repo_tests',
parameters: [
string(name: 'REPO', value: 'execution_server'),
booleanParam(name: 'ONLY_REPO_TESTS', value: true),
string(name: 'REPO_TAG', value: commitHash),
string(name: 'CLUSTER_BRANCH', value: 'devel')
]
}
}
}
}
}
}
post {
success {
script {
if (env.BRANCH_NAME == 'devel') {
echo 'Build and update for "devel" branch completed successfully.'
} else {
echo 'Build and tests for PR or other branches completed successfully.'
}
}
}
failure {
script {
if (env.BRANCH_NAME == 'devel') {
echo 'Build and update for "devel" branch failed.'
} else {
echo 'Build and tests for PR or other branches failed.'
}
}
}
aborted {
script {
if (env.BRANCH_NAME == 'devel') {
echo 'Build and update for "devel" branch was aborted.'
} else {
echo 'Build and tests for PR or other branches were aborted.'
}
}
}
cleanup {
script {
echo 'Cleaning up workspace...'
cleanWs() // Clean up workspace after build or tests
}
}
}
}