-
Notifications
You must be signed in to change notification settings - Fork 3
/
Jenkinsfile
67 lines (57 loc) · 1.95 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
loadLibrary "[email protected]"
pipeline {
agent none
options {
timestamps()
buildDiscarder(logRotator(daysToKeepStr: '90'))
disableConcurrentBuilds()
}
environment {
AWS_DEFAULT_REGION = 'eu-west-1'
// stable build number across restarts
INVOKED_BUILD_NUMBER = getInvokedBuildNumber()
// FAST credentials for maven etc
FAST_TOKEN = getFastToken()
FAST_USER = getFastUser()
ZIP_LAMBDA = "emr-autoscaling.zip"
LOCAL_ZIP_PATH = "./target/" + "$ZIP_LAMBDA"
VERSION = "v1." + "$INVOKED_BUILD_NUMBER"
S3_ZIP_ARTIFACT_PATH = "s3://is24-data-pro-artifacts/emr/lambda_autoscaling/" + "$VERSION" + "/" + "$ZIP_LAMBDA"
S3_ZIP_ARTIFACT_PATH_LATEST = "s3://is24-data-pro-artifacts/emr/lambda_autoscaling/latest/" + "$ZIP_LAMBDA"
}
stages {
stage('Test & Package') {
agent { node { label 'is24-data-pro-build-data-engineering' } }
steps {
script {
sh '''
make package
aws s3 cp $LOCAL_ZIP_PATH $S3_ZIP_ARTIFACT_PATH
'''
}
}
}
stage('Release the artifact to s3 Prod') {
when {
beforeAgent true
branch 'master'
}
agent { node { label 'is24-data-pro-build-data-engineering' } }
steps {
sh '''
aws s3 cp $S3_ZIP_ARTIFACT_PATH $S3_ZIP_ARTIFACT_PATH_LATEST
'''
}
}
}
post {
failure {
script {
if (env.BRANCH_NAME == 'master') {
slackSend channel: 'core-data-platform-alerts', color: 'danger',
message: "The pipeline <${env.BUILD_URL}|${currentBuild.fullDisplayName}> failed."
}
}
}
}
}