Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add release workflow for ml-models #77

Merged
merged 1 commit into from
Feb 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 87 additions & 0 deletions jenkins/ml-models.JenkinsFile
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(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After version, there are also two types of folder: torch_script & onnx
will that be any issue? As I'm seeing there are two parameters?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The entire version folder is downloaded along with sub-folders. So this will include above mentioned scripts.

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()
}
}
}
}