Skip to content

Commit ea913e8

Browse files
committed
initial commit
0 parents  commit ea913e8

File tree

17,001 files changed

+1766259
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

17,001 files changed

+1766259
-0
lines changed

.gitignore

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
*.class
2+
.mtj.tmp/
3+
*.war
4+
*.ear
5+
hs_err_pid*
6+
target/
7+
.springBeans
8+
.metadata
9+
.factorypath
10+
.classpath
11+
.project
12+
.settings/
13+
.vertx/
14+
bin/
15+
tmp/
16+
logs/
17+
*.tmp
18+
*.bak
19+
*.swp
20+
*~.nib
21+
local.properties
22+
.loadpath
23+
.DS_Store
24+
test.txt
25+
.idea/
26+
.settings/
27+
.sonarlint/
28+
.recommenders/
29+
/.recommenders/
30+
**/*.iml
31+
.vscode

EmailNotificationJenkinsFile

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
node {
2+
3+
// If the build is triggered by any upstream job
4+
if (currentBuild.rawBuild.getCause(hudson.model.Cause$UpstreamCause)) {
5+
sendEmail()
6+
}
7+
}
8+
@NonCPS
9+
def sendEmail() {
10+
11+
// Name of the Jenkins jobs for email notification will be sent if status is FAILURE
12+
def String[] jobsForStatusNotification = ["Kernel", "Authentication", "Pre-Registration", "Registration", "Registration-Processor", "modify-pipeline-poc", "master-branch-build-all-modules"]
13+
14+
def upstream = currentBuild.rawBuild.getCause(hudson.model.Cause$UpstreamCause)
15+
16+
// Description for upstream job by which this pipeline has been triggered
17+
def description = upstream?.shortDescription
18+
19+
// projectName for upstream job by which this pipeline has been triggered
20+
def projectName = description.substring(description.indexOf("\"") + 1, description.indexOf("\"", description.indexOf("\"") + 1));
21+
22+
// projectStatus for upstream job by which this pipeline has been triggered
23+
def projectStatus = Jenkins.instance.getItem(projectName).lastCompletedBuild.getResult().toString()
24+
25+
// projectBuildNumber for upstream job by which this pipeline has been triggered
26+
def projectBuildNumber = Jenkins.instance.getItem(projectName).lastCompletedBuild.getNumber().toString()
27+
28+
// projectBuildURL for upstream job by which this pipeline has been triggered
29+
def projectBuildURL = Jenkins.instance.getItem(projectName).lastCompletedBuild.absoluteUrl.toString()
30+
31+
echo "projectName: " + projectName
32+
echo "projectStatus: " + projectStatus
33+
echo "projectBuildNumber: "+projectBuildNumber
34+
echo "projectBuildURL: "+projectBuildURL
35+
36+
def recipients
37+
if (jobsForStatusNotification.contains(projectName) && projectStatus.equals("FAILURE")) {
38+
if (projectName.equals("Kernel")) {
39+
recipients = "$env.KERNEL_RECIPIENT_LIST"
40+
} else if (projectName.equals("Pre-Registration")) {
41+
recipients = "$env.PRE_REGISTRATION_RECIPIENT_LIST"
42+
} else if (projectName.equals("Authentication")) {
43+
recipients = "$env.IDA_RECIPIENT_LIST"
44+
} else if (projectName.equals("Registration")) {
45+
recipients = "$env.REGISTRATION_RECIPIENT_LIST"
46+
} else if (projectName.equals("Registration-Processor")) {
47+
recipients = "$env.REGISTRATION_PROCESSOR_RECIPIENT_LIST"
48+
} else if (projectName.equals("master-branch-build-all-modules")) {
49+
recipients = "$env.MASTER_BRANCH_BUILD_ALL_MODULES_RECIPIENT_LIST"
50+
} else if (projectName.equals("modify-pipeline-poc")) {
51+
recipients = "$env.TEST_RECIPIENT_LIST"
52+
}
53+
54+
emailext (
55+
subject: "MOSIP Jenkins Job '${projectName} with build no ${projectBuildNumber} failed'",
56+
body: """<p>Check console output at <a href="${projectBuildURL}">${projectName}</a></p>""",
57+
to: "$recipients",
58+
from: '"Jenkins" <info@mosip.io>'
59+
)
60+
}
61+
}

0 commit comments

Comments
 (0)