Skip to content

Commit bea9df4

Browse files
gaiksayaJonah Calvo
authored andcommitted
Refactor maven downloading logic to be dynamic (opensearch-project#5826)
Refactor maven downloading logic to be dynamic Signed-off-by: Sayali Gaikawad <gaiksaya@amazon.com> Signed-off-by: Jonah Calvo <caljonah@amazon.com>
1 parent ccc6b30 commit bea9df4

1 file changed

Lines changed: 10 additions & 20 deletions

File tree

jenkins/release.jenkinsFile

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -235,13 +235,16 @@ pipeline {
235235
stage('Download Maven Artifacts') {
236236
steps {
237237
script {
238-
mavenPath = "${DATA_PREPPER_ARTIFACT_STAGING_SITE}/${VERSION}/${DATA_PREPPER_BUILD_NUMBER}/maven"
239-
group = 'org/opensearch/dataprepper'
240-
artifacts = ['data-prepper-api']
241-
fileTypes = ['-javadoc.jar', '.jar', '.pom', '-sources.jar', '.module']
242-
checksums = ['', '.md5', '.sha1', '.sha256', '.sha512']
243-
244-
downloadArtifacts("$VERSION")
238+
downloadPath = "${VERSION}/${DATA_PREPPER_BUILD_NUMBER}/maven"
239+
withCredentials([
240+
string(credentialsId: 'data-prepper-s3-role', variable: 'DP_S3_ROLE_NAME'),
241+
string(credentialsId: 'data-prepper-aws-account-number', variable: 'DP_AWS_ACCOUNT_NUMBER'),
242+
string(credentialsId: 'data-prepper-s3-bucket-name', variable: 'DP_S3_BUCKET_NAME'),]) {
243+
echo 'Downloading artifacts from S3'
244+
withAWS(role: "${DP_S3_ROLE_NAME}", roleAccount: "${DP_AWS_ACCOUNT_NUMBER}", duration: 900, roleSessionName: 'dp-jenkins-session', region: 'us-east-1') {
245+
s3Download(file: "${WORKSPACE}/maven", bucket: "${DP_S3_BUCKET_NAME}", path: "${downloadPath}", force: true)
246+
}
247+
}
245248
}
246249
}
247250
}
@@ -281,19 +284,6 @@ pipeline {
281284
}
282285
}
283286

284-
def downloadArtifacts(version) {
285-
dir('maven') {
286-
for (artifact in artifacts) {
287-
sh "mkdir -p ${group}/${artifact}/${version}"
288-
for (fileType in fileTypes) {
289-
for (checksum in checksums) {
290-
sh "curl -sSL ${mavenPath}/${group}/${artifact}/${version}/${artifact}-${version}${fileType}${checksum} -o ${group}/${artifact}/${version}/${artifact}-${version}${fileType}${checksum}"
291-
}
292-
}
293-
}
294-
}
295-
}
296-
297287
def isNullOrEmpty(str) {
298288
return (str == null || str == '')
299289
}

0 commit comments

Comments
 (0)