-
Notifications
You must be signed in to change notification settings - Fork 45
/
Jenkinsfile.central
81 lines (73 loc) · 2.98 KB
/
Jenkinsfile.central
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
#!groovy
node {
properties([
parameters([
[$class: 'ValidatingStringParameterDefinition',
defaultValue: '',
description: 'The tag of the current release.',
failedValidationMessage: 'Invalid SemVer.',
name: 'RELEASE_TAG',
regex: /^\d+\.\d+\.\d+$/]
])
])
try {
env.AWS_DEFAULT_REGION = "us-east-1"
// Checkout the proper revision into the workspace.
stage('checkout') {
checkout([
$class: 'GitSCM',
branches: [[name: params.RELEASE_TAG]],
extensions: scm.extensions + [[$class: 'CloneOption', noTags: false, reference: '', shallow: false]],
userRemoteConfigs: scm.userRemoteConfigs
])
}
env.RF_SETTINGS_BUCKET = 'rasterfoundry-testing-config-us-east-1'
stage('bootstrap') {
wrap([$class: 'AnsiColorBuildWrapper']) {
sh """#!/bin/bash
./scripts/bootstrap --env
./scripts/bootstrap --sbtopts
"""
}
}
stage('publish releases to maven central') {
withCredentials([[$class: 'StringBinding',
credentialsId: 'SONATYPE_USERNAME',
variable: 'SONATYPE_USERNAME'],
[$class: 'StringBinding',
credentialsId: 'SONATYPE_PASSWORD',
variable: 'SONATYPE_PASSWORD'],
[$class: 'StringBinding',
credentialsId: 'GPG_KEY',
variable: 'GPG_KEY'],
[$class: 'StringBinding',
credentialsId: 'GPG_KEY_ID',
variable: 'GPG_KEY_ID']]) {
wrap([$class: 'AnsiColorBuildWrapper']) {
sh """#!/bin/bash
docker-compose \
-f docker-compose.test.yml \
run --rm --no-deps --entrypoint "bash -c" \
-e SONATYPE_USERNAME="${SONATYPE_USERNAME}" \
-e SONATYPE_PASSWORD="${SONATYPE_PASSWORD}" \
-e GPG_KEY_ID="${GPG_KEY_ID}" \
build "
gpg --keyserver keyserver.ubuntu.com \
--recv-keys ${GPG_KEY_ID} &&
echo ${GPG_KEY} | base64 -d >signing_key.asc &&
gpg --import signing_key.asc &&
./sbt ';set version in ThisBuild := \\"${params.RELEASE_TAG}\\";sonatypeBundleClean;publish;sonatypeBundleRelease'
"
"""
}
}
}
slackMessage = "*<https://github.com/raster-foundry/raster-foundry/tree/${params.RELEASE_TAG}|${params.RELEASE_TAG}>* deployed to Maven Central :tada:"
slackSend color: 'warning', message: slackMessage
} catch(err) {
def slackMessage = ":jenkins-angry: *failed to deploy <https://github.com/raster-foundry/raster-foundry/tree/${params.RELEASE_TAG}|${params.RELEASE_TAG}> to Maven Central #${env.BUILD_NUMBER}*"
slackMessage += "\n<${env.BUILD_URL}|View Build>"
slackSend color: 'danger', message: slackMessage
throw err
}
}