forked from codelibs/elasticsearch-module
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
75 lines (60 loc) · 1.88 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
@Library('jenkins-shared-library') _
/**
* Job Parameters:
* targetVersion - the version of Elasticsearch to generate artifacts from
* remoteRepositoryURL - the remote maven repository URL
* remoteRepositoryID - the remote maven repository ID
* custom_maven_settings - custom maven settings
*
**/
try {
slack.notifyBuild('STARTED', targetVersion)
node('docker') {
stage('Checkout repository') {
checkout scm
}
stage('Build') {
sh 'rm -rf ${WORKSPACE}/target'
sh 'mkdir ${WORKSPACE}/target'
def esBinaryFileName
if (targetVersion.startsWith("6")) {
esBinaryFileName = "elasticsearch-${targetVersion}"
} else {
esBinaryFileName = "elasticsearch-${targetVersion}-windows-x86_64"
}
fileOperations([
fileDownloadOperation(
password: '',
proxyHost: '',
proxyPort: '',
targetFileName: ''+esBinaryFileName+'.zip',
targetLocation: 'target',
url: 'https://artifacts.elastic.co/downloads/elasticsearch/'+esBinaryFileName+'.zip',
userName: '')
])
fileOperations([
fileDownloadOperation(
password: '',
proxyHost: '',
proxyPort: '',
targetFileName: 'v'+targetVersion+'.zip',
targetLocation: 'target',
url: 'https://github.com/elastic/elasticsearch/archive/v'+targetVersion+'.zip',
userName: '')
])
sh 'ls -l ${WORKSPACE}/target'
withMaven(jdk: 'OpenJDK_17', maven: 'Maven_3.9.6', globalMavenSettingsConfig: custom_maven_settings, options: [artifactsPublisher(disabled: true)], publisherStrategy: 'EXPLICIT') {
sh 'chmod +x ${WORKSPACE}/build.sh'
sh '${WORKSPACE}/build.sh "'+targetVersion+'" "'+remoteRepositoryURL+'" "'+remoteRepositoryID+'"'
}
}
}
} catch (org.jenkinsci.plugins.workflow.steps.FlowInterruptedException e) {
currentBuild.result = "ABORTED"
throw e
} catch (e) {
currentBuild.result = "FAILURE"
throw e
} finally {
slack.notifyBuild(currentBuild.result)
}