-
Notifications
You must be signed in to change notification settings - Fork 295
Add opensearch promotion workflow and jenkins libs for tar #1354
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
Merged
peternied
merged 3 commits into
opensearch-project:main
from
peterzhuamazon:opensearch-promotion-setups
Dec 16, 2021
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,60 @@ | ||
lib = library(identifier: "jenkins@20211123", retriever: legacySCM(scm)) | ||
|
||
pipeline { | ||
options { | ||
timeout(time: 1, unit: 'HOURS') | ||
} | ||
agent none | ||
parameters { | ||
choice( | ||
choices: ['distribution-build-opensearch', 'distribution-build-opensearch-dashboards'], | ||
name: 'DISTRIBUTION_JOB_NAME', | ||
description: 'What platform is this distribution build for?.' | ||
) | ||
string( | ||
defaultValue: '', | ||
name: 'DISTRIBUTION_BUILD_NUMBER', | ||
description: 'What is the build id of the above DISTRIBUTION_JOB_NAME that you want to promote? (e.g. 123, 136)', | ||
trim: true | ||
) | ||
string( | ||
defaultValue: '', | ||
name: 'INPUT_MANIFEST', | ||
description: 'What is the input manifest of the above DISTRIBUTION_JOB_NAME that you want to promote? (e.g. 1.2.2/opensearch-1.2.2.yml)', | ||
trim: true | ||
) | ||
choice( | ||
choices: ['linux', 'windows', 'darwin'], | ||
name: 'DISTRIBUTION_PLATFORM', | ||
description: 'What platform is this distribution build for?.' | ||
) | ||
choice( | ||
choices: ['x64', 'arm64'], | ||
peterzhuamazon marked this conversation as resolved.
Show resolved
Hide resolved
|
||
name: 'DISTRIBUTION_ARCHITECTURE', | ||
description: 'What architecture is this distribution build for?.' | ||
) | ||
} | ||
stages { | ||
stage('promote artifacts') { | ||
agent { | ||
docker { | ||
label 'Jenkins-Agent-al2-x64-c54xlarge-Docker-Host' | ||
image 'opensearchstaging/ci-runner:ubuntu2004-x64-docker-buildx0.6.3-qemu5.0-awscli1.22-jdk14' | ||
alwaysPull true | ||
} | ||
} | ||
steps { | ||
script { | ||
promoteArtifacts() | ||
} | ||
} | ||
post() { | ||
peterzhuamazon marked this conversation as resolved.
Show resolved
Hide resolved
|
||
always { | ||
script { | ||
cleanWs disableDeferredWipeout: true, deleteDirs: true | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains hidden or 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,53 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
void call(Map args = [:]) { | ||
git url: 'https://github.com/opensearch-project/opensearch-build.git', branch: 'main' | ||
def lib = library(identifier: 'jenkins@20211123', retriever: legacySCM(scm)) | ||
|
||
String manifest = args.manifest ?: "manifests/${INPUT_MANIFEST}" | ||
def inputManifest = lib.jenkins.InputManifest.new(readYaml(file: manifest)) | ||
String filename = inputManifest.build.getFilename() | ||
String version = inputManifest.build.version | ||
|
||
def artifactPath = "${DISTRIBUTION_JOB_NAME}/${version}/${DISTRIBUTION_BUILD_NUMBER}/${DISTRIBUTION_PLATFORM}/${DISTRIBUTION_ARCHITECTURE}" | ||
peterzhuamazon marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
withAWS(role: "${ARTIFACT_DOWNLOAD_ROLE_NAME}", roleAccount: "${AWS_ACCOUNT_PUBLIC}", duration: 900, roleSessionName: 'jenkins-session') { | ||
peterzhuamazon marked this conversation as resolved.
Show resolved
Hide resolved
|
||
s3Download(bucket: "${ARTIFACT_BUCKET_NAME}", file: "$WORKSPACE/artifacts", path: "${artifactPath}/", force: true) | ||
} | ||
|
||
String build_manifest = "artifacts/$artifactPath/builds/$filename/manifest.yml" | ||
def buildManifest = readYaml(file: build_manifest) | ||
|
||
withAWS(role: "${ARTIFACT_PROMOTION_ROLE_NAME}", roleAccount: "${AWS_ACCOUNT_ARTIFACT}", duration: 900, roleSessionName: 'jenkins-session') { | ||
// Core Plugins | ||
println("Start Core Plugin Promotion to artifects.opensearch.org Bucket") | ||
List<String> corePluginList = buildManifest.components.artifacts."core-plugins"[0] | ||
for (String pluginSubPath : corePluginList) { | ||
String pluginSubFolder = pluginSubPath.split('/')[0] | ||
String pluginNameWithExt = pluginSubPath.split('/')[1] | ||
String pluginName = pluginNameWithExt.replace('-' + version + '.zip', '') | ||
String pluginFullPath = ['plugins', pluginName, version].join('/') | ||
s3Upload(bucket: "${ARTIFACT_PRODUCTION_BUCKET_NAME}", path: "releases/$pluginFullPath/", workingDir: "$WORKSPACE/artifacts/$artifactPath/builds/$filename/$pluginSubFolder/" | ||
peterzhuamazon marked this conversation as resolved.
Show resolved
Hide resolved
|
||
, includePathPattern: "**/${pluginName}*") | ||
} | ||
|
||
|
||
// Tar Core/Bundle | ||
println("Start Tar Core/Bundle Promotion to artifacts.opensearch.org Bucket") | ||
String coreFullPath = ['core', filename, version].join('/') | ||
String bundleFullPath = ['bundle', filename, version].join('/') | ||
s3Upload(bucket: "${ARTIFACT_PRODUCTION_BUCKET_NAME}", path: "releases/$coreFullPath/", workingDir: "$WORKSPACE/artifacts/$artifactPath/builds/$filename/dist/" | ||
, includePathPattern: "**/${filename}-min-${version}*") | ||
s3Upload(bucket: "${ARTIFACT_PRODUCTION_BUCKET_NAME}", path: "releases/$bundleFullPath/", workingDir: "$WORKSPACE/artifacts/$artifactPath/dist/$filename/" | ||
, includePathPattern: "**/${filename}*-${version}*") | ||
peterzhuamazon marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
|
||
} | ||
|
||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.