-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
(cherry picked from commit 353a473) Signed-off-by: Sayali Gaikawad <[email protected]> Co-authored-by: Sayali Gaikawad <[email protected]>
- Loading branch information
1 parent
d2f6838
commit 858897b
Showing
1 changed file
with
87 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
lib = library(identifier: '[email protected]', retriever: modernSCM([ | ||
$class: 'GitSCMSource', | ||
remote: 'https://github.com/opensearch-project/opensearch-build-libraries.git', | ||
])) | ||
|
||
pipeline { | ||
agent | ||
{ | ||
docker { | ||
label 'Jenkins-Agent-AL2-X64-C54xlarge-Docker-Host' | ||
image 'opensearchstaging/ci-runner:release-centos7-clients-v2' | ||
alwaysPull true | ||
} | ||
} | ||
options { | ||
timeout(time: 1, unit: 'HOURS') | ||
} | ||
parameters { | ||
string( | ||
name: 'BASE_DOWNLOAD_PATH', | ||
description: 'S3 base path to download artifacts from eg:ml-models/huggingface/sentence-transformers/all-distilroberta-v1. DO NOT include the trailing backlash at the end', | ||
trim: true | ||
) | ||
string( | ||
name: 'VERSION', | ||
description: 'Version number of the model', | ||
trim: true | ||
) | ||
} | ||
environment { | ||
ARTIFACT_PATH = "${BASE_DOWNLOAD_PATH}/${VERSION}/" | ||
UPLOAD_PATH = "models/ml-models" | ||
BUCKET_NAME = credentials('ml-models-bucket-name') | ||
} | ||
stages{ | ||
stage('Parameters Check') { | ||
steps { | ||
script { | ||
if(BASE_DOWNLOAD_PATH.isEmpty() || VERSION.isEmpty()) { | ||
currentBuild.result = 'ABORTED' | ||
error('Parameters cannot be empty! Please provide the correct values.') | ||
} | ||
if(BASE_DOWNLOAD_PATH.endsWith('/')) { | ||
currentBuild.result = 'ABORTED' | ||
error('"/" not allowed at the end of the BASE_DOWNLOAD_PATH') | ||
} | ||
} | ||
} | ||
} | ||
stage('Download the artifacts') { | ||
steps { | ||
script { | ||
downloadFromS3( | ||
assumedRoleName: 'get_models', | ||
roleAccountNumberCred: 'ml-models-aws-account-number', | ||
downloadPath: "${ARTIFACT_PATH}", | ||
bucketName: "${BUCKET_NAME}", | ||
localPath: "${WORKSPACE}/artifacts", | ||
force: true, | ||
region: 'us-west-2' | ||
) | ||
} | ||
} | ||
} | ||
stage('Sign and Release the artifacts') { | ||
steps { | ||
script { | ||
publishToArtifactsProdBucket( | ||
assumedRoleName: 'ml-models-artifacts-upload-role', | ||
source: "${WORKSPACE}/artifacts/ml-models", | ||
destination: "${UPLOAD_PATH}", | ||
signingPlatform: 'linux', | ||
sigType: '.sig', | ||
sigOverwrite: true | ||
) | ||
} | ||
} | ||
} | ||
} | ||
post { | ||
always { | ||
script { | ||
postCleanup() | ||
} | ||
} | ||
} | ||
} |