-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathJenkinsfile
117 lines (95 loc) · 2.83 KB
/
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
/*
* Copyright (C) 2022 SailPoint Technologies, Inc. All rights reserved.
*/
@Library('sailpoint/jenkins-release-utils')_
/**
* Jenkins pipeline for building and uploading sailpoint-cli docker image.
*/
pipeline {
agent none
options {
// Aborts job if run time is over 24 hours
timeout(time: 24, unit: 'HOURS')
// Add timestamps to console output
timestamps()
// Don't allow concurrent builds to run
disableConcurrentBuilds()
// Keep builds for a year + 30 days.
buildDiscarder(logRotator(daysToKeepStr: '395'))
}
triggers {
// Poll for changes every 5 minutes.
pollSCM('H/5 * * * *')
}
environment {
// The scrum which owns this component
JIRA_PROJECT = "PLTCONN"
// The name of the build artifact to generate
BUILD_NUMBER = "${env.BUILD_NUMBER}"
// The maximum amount of time (in minutes) to wait for a build
BUILD_TIMEOUT = 20
// The maximum amount of time (in minutes) for tests to take before they are auto failed.
TEST_TIMEOUT = 10
// The maximum amount of time (in minutes) to wait for a deploy
DEPLOY_TIMEOUT = 30
// Which room to report successes & failures too.
SLACK_CHANNEL = "#team-eng-platform-connectivity-jnk"
// The branch releases can be cut from.
RELEASE_BRANCH = "main"
// The name of service being released
SERVICE_NAME = "sailpoint-cli"
}
stages {
stage('Build and push sailpoint-cli') {
when {
branch env.RELEASE_BRANCH
}
steps {
echo "${env.SERVICE_NAME} release pipeline for ${env.BUILD_NUMBER} is starting."
sendSlackNotification(
env.SLACK_CHANNEL,
"${env.SERVICE_NAME} service release pipeline for <${env.BUILD_URL}|${env.BUILD_NUMBER}> is starting.",
utils.NOTIFY_START
)
script {
node {
label 'devaws'
checkout scm
echo "Starting build of ${env.SERVICE_NAME}"
sh("make VERSION=${env.BUILD_NUMBER} docker/push")
//Git Config
sh "git config --global user.email [email protected]"
sh "git config --global user.name Jenkins"
// Create and push a git tag for build
TAG_NAME= "jenkins/${env.SERVICE_NAME}/${env.BUILD_NUMBER}"
sh "git tag -a -f -m 'Built by Pipeline' ${TAG_NAME}"
sh "git push origin tag ${TAG_NAME}"
}
}
}
}
}
post {
success {
sendSlackNotification(
env.SLACK_CHANNEL,
"${env.SERVICE_NAME} release pipeline for <${env.BUILD_URL}|${env.BUILD_NUMBER}> was successful.",
utils.NOTIFY_SUCCESS
)
}
failure {
sendSlackNotification(
env.SLACK_CHANNEL,
"${env.SERVICE_NAME} release pipeline for <${env.BUILD_URL}|${env.BUILD_NUMBER}> failed.",
utils.NOTIFY_FAILURE
)
}
aborted {
sendSlackNotification(
env.SLACK_CHANNEL,
"${env.SERVICE_NAME} release pipeline for <${env.BUILD_URL}|${env.BUILD_NUMBER}> was aborted.",
utils.NOTIFY_ABORTED
)
}
}
}