forked from opensearch-project/opensearch-build
-
Notifications
You must be signed in to change notification settings - Fork 0
/
maven-publish-1.3.x.jenkinsfile
102 lines (98 loc) · 3.4 KB
/
maven-publish-1.3.x.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
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/
lib = library(identifier: '[email protected]', retriever: modernSCM([
$class: 'GitSCMSource',
remote: 'https://github.com/opensearch-project/opensearch-build-libraries.git',
]))
pipeline {
options {
timeout(time: 2, unit: 'HOURS')
}
agent none
environment {
AGENT_X64 = 'Jenkins-Agent-AL2023-X64-M54xlarge-Docker-Host'
}
triggers {
parameterizedCron '''
H 1 * * * %INPUT_MANIFEST=1.3.19/opensearch-1.3.19.yml
'''
}
parameters {
string(
name: 'COMPONENT_NAME',
description: 'If this field contains one or more component names (e.g. OpenSearch common-utils ...), will build with "--component <COMPONENT_NAME> ...", else build everything in the INPUT_MANIFEST.',
trim: true
)
string(
name: 'INPUT_MANIFEST',
description: 'Input manifest under the manifests folder, e.g. 2.0.0/opensearch-2.0.0.yml.',
trim: true
)
}
stages {
stage('dockerAgent-setup') {
agent {
docker {
label AGENT_X64
image 'docker/library/alpine:3'
registryUrl 'https://public.ecr.aws/'
alwaysPull true
}
}
steps {
script {
echo("Detect Docker Images and Related Parameters")
dockerAgent = detectDockerAgent()
currentBuild.description = INPUT_MANIFEST
}
}
}
stage('publish-maven-snaphots') {
environment {
SNAPSHOT_REPO_URL = "https://aws.oss.sonatype.org/content/repositories/snapshots/"
}
agent {
docker {
label AGENT_X64
image dockerAgent.image
args dockerAgent.args
alwaysPull true
}
}
steps {
script {
buildManifest(
componentName: "${COMPONENT_NAME}",
inputManifest: "manifests/${INPUT_MANIFEST}",
platform: 'linux',
architecture: 'x64',
distribution: 'tar',
snapshot: true
)
String mavenPath = "$WORKSPACE/tar/builds/opensearch/maven"
if (fileExists(mavenPath)) {
withCredentials([
string(credentialsId: 'maven-snapshots-username', variable: 'SONATYPE_USERNAME'),
string(credentialsId: 'maven-snapshots-password', variable: 'SONATYPE_PASSWORD')
]) {
sh("$WORKSPACE/publish/publish-snapshot.sh ${mavenPath}")
}
} else {
echo "Skipping publishing snapshots, ${mavenPath} does not exist."
}
}
}
post {
always {
postCleanup()
}
}
}
}
}