Skip to content

Commit

Permalink
Update index.json file at stage level for each distribution (#4286)
Browse files Browse the repository at this point in the history
Signed-off-by: Divya Madala <[email protected]>
  • Loading branch information
Divyaasm authored Jan 23, 2024
1 parent 0b6d493 commit fec0355
Show file tree
Hide file tree
Showing 2 changed files with 271 additions and 47 deletions.
161 changes: 137 additions & 24 deletions jenkins/opensearch-dashboards/distribution-build.jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* compatible open source license.
*/

lib = library(identifier: 'jenkins@5.12.0', retriever: modernSCM([
lib = library(identifier: 'jenkins@6.1.0', retriever: modernSCM([
$class: 'GitSCMSource',
remote: 'https://github.com/opensearch-project/opensearch-build-libraries.git',
]))
Expand Down Expand Up @@ -184,7 +184,7 @@ pipeline {
String buildManifestUrlOpenSearch = [buildManifestObj.getArtifactRootUrl(JOB_NAME_OPENSEARCH, "latest"), "builds", "opensearch", "manifest.yml"].join("/")
String artifactUrl = buildManifestObj.getArtifactUrl(JOB_NAME, BUILD_NUMBER)
env.ARTIFACT_URL_LINUX_X64_TAR = artifactUrl
env.INDEX_FILE_PATH = buildManifestObj.getIndexFileRoot("${JOB_NAME}")
env.INDEX_FILE_PATH_X64_TAR = buildManifestObj.getIndexFileRoot("${JOB_NAME}")

echo "buildManifestUrl (linux, x64, tar): ${buildManifestUrl}"
echo "artifactUrl (linux, x64, tar): ${artifactUrl}"
Expand Down Expand Up @@ -225,6 +225,24 @@ pipeline {
}
}
post {
success {
script {
if (params.UPDATE_LATEST_URL) {
uploadIndexFile(
indexFilePath: env.INDEX_FILE_PATH_X64_TAR
)
}
}
}
unstable {
script {
if (params.UPDATE_LATEST_URL) {
uploadIndexFile(
indexFilePath: env.INDEX_FILE_PATH_X64_TAR
)
}
}
}
always {
script {
lib.jenkins.Messages.new(this).add(
Expand Down Expand Up @@ -310,6 +328,7 @@ pipeline {
String buildManifestUrl = buildManifestObj.getUrl(JOB_NAME, BUILD_NUMBER)
String artifactUrl = buildManifestObj.getArtifactUrl(JOB_NAME, BUILD_NUMBER)
env.ARTIFACT_URL_LINUX_X64_RPM = artifactUrl
env.INDEX_FILE_PATH_X64_RPM = buildManifestObj.getIndexFileRoot("${JOB_NAME}")

echo "buildManifestUrl (linux, x64, rpm): ${buildManifestUrl}"
echo "artifactUrl (linux, x64, rpm): ${artifactUrl}"
Expand All @@ -328,6 +347,24 @@ pipeline {
}
}
post {
success {
script {
if (params.UPDATE_LATEST_URL) {
uploadIndexFile(
indexFilePath: env.INDEX_FILE_PATH_X64_RPM
)
}
}
}
unstable {
script {
if (params.UPDATE_LATEST_URL) {
uploadIndexFile(
indexFilePath: env.INDEX_FILE_PATH_X64_RPM
)
}
}
}
always {
script {
lib.jenkins.Messages.new(this).add(
Expand Down Expand Up @@ -412,6 +449,7 @@ pipeline {
String buildManifestUrl = buildManifestObj.getUrl(JOB_NAME, BUILD_NUMBER)
String artifactUrl = buildManifestObj.getArtifactUrl(JOB_NAME, BUILD_NUMBER)
env.ARTIFACT_URL_LINUX_X64_DEB = artifactUrl
env.INDEX_FILE_PATH_X64_DEB = buildManifestObj.getIndexFileRoot("${JOB_NAME}")

echo "buildManifestUrl (linux, x64, deb): ${buildManifestUrl}"
echo "artifactUrl (linux, x64, deb): ${artifactUrl}"
Expand All @@ -421,6 +459,24 @@ pipeline {
}
}
post {
success {
script {
if (params.UPDATE_LATEST_URL) {
uploadIndexFile(
indexFilePath: env.INDEX_FILE_PATH_X64_DEB
)
}
}
}
unstable {
script {
if (params.UPDATE_LATEST_URL) {
uploadIndexFile(
indexFilePath: env.INDEX_FILE_PATH_X64_DEB
)
}
}
}
always {
script {
lib.jenkins.Messages.new(this).add(
Expand Down Expand Up @@ -513,6 +569,8 @@ pipeline {
String buildManifestUrlOpenSearch = [buildManifestObj.getArtifactRootUrl(JOB_NAME_OPENSEARCH, "latest"), "builds", "opensearch", "manifest.yml"].join("/")
String artifactUrl = buildManifestObj.getArtifactUrl(JOB_NAME, BUILD_NUMBER)
env.ARTIFACT_URL_LINUX_ARM64_TAR = artifactUrl
env.INDEX_FILE_PATH_ARM64_TAR = buildManifestObj.getIndexFileRoot("${JOB_NAME}")

echo "buildManifestUrl (linux, arm64, tar): ${buildManifestUrl}"
echo "artifactUrl (linux, arm64, tar): ${artifactUrl}"

Expand Down Expand Up @@ -552,6 +610,24 @@ pipeline {
}
}
post {
success {
script {
if (params.UPDATE_LATEST_URL) {
uploadIndexFile(
indexFilePath: env.INDEX_FILE_PATH_ARM64_TAR
)
}
}
}
unstable {
script {
if (params.UPDATE_LATEST_URL) {
uploadIndexFile(
indexFilePath: env.INDEX_FILE_PATH_ARM64_TAR
)
}
}
}
always {
script {
lib.jenkins.Messages.new(this).add(
Expand Down Expand Up @@ -640,6 +716,8 @@ pipeline {
String buildManifestUrl = buildManifestObj.getUrl(JOB_NAME, BUILD_NUMBER)
String artifactUrl = buildManifestObj.getArtifactUrl(JOB_NAME, BUILD_NUMBER)
env.ARTIFACT_URL_LINUX_ARM64_RPM = artifactUrl
env.INDEX_FILE_PATH_ARM64_RPM = buildManifestObj.getIndexFileRoot("${JOB_NAME}")

echo "buildManifestUrl (linux, arm64, rpm): ${buildManifestUrl}"
echo "artifactUrl (linux, arm64, rpm): ${artifactUrl}"

Expand All @@ -657,6 +735,24 @@ pipeline {
}
}
post {
success {
script {
if (params.UPDATE_LATEST_URL) {
uploadIndexFile(
indexFilePath: env.INDEX_FILE_PATH_ARM64_RPM
)
}
}
}
unstable {
script {
if (params.UPDATE_LATEST_URL) {
uploadIndexFile(
indexFilePath: env.INDEX_FILE_PATH_ARM64_TAR
)
}
}
}
always {
script {
lib.jenkins.Messages.new(this).add(
Expand Down Expand Up @@ -741,6 +837,7 @@ pipeline {
String buildManifestUrl = buildManifestObj.getUrl(JOB_NAME, BUILD_NUMBER)
String artifactUrl = buildManifestObj.getArtifactUrl(JOB_NAME, BUILD_NUMBER)
env.ARTIFACT_URL_LINUX_ARM64_DEB = artifactUrl
env.INDEX_FILE_PATH_ARM64_DEB = buildManifestObj.getIndexFileRoot("${JOB_NAME}")

echo "buildManifestUrl (linux, arm64, deb): ${buildManifestUrl}"
echo "artifactUrl (linux, arm64, deb): ${artifactUrl}"
Expand All @@ -750,6 +847,24 @@ pipeline {
}
}
post {
success {
script {
if (params.UPDATE_LATEST_URL) {
uploadIndexFile(
indexFilePath: env.INDEX_FILE_PATH_ARM64_DEB
)
}
}
}
unstable {
script {
if (params.UPDATE_LATEST_URL) {
uploadIndexFile(
indexFilePath: env.INDEX_FILE_PATH_ARM64_DEB
)
}
}
}
always {
script {
lib.jenkins.Messages.new(this).add(
Expand Down Expand Up @@ -797,14 +912,32 @@ pipeline {
String buildManifestUrl = buildManifestObj.getUrl(JOB_NAME, BUILD_NUMBER)
String artifactUrl = buildManifestObj.getArtifactUrl(JOB_NAME, BUILD_NUMBER)
env.ARTIFACT_URL_LINUX_WINDOWS_X64_ZIP = artifactUrl
env.INDEX_FILE_PATH = buildManifestObj.getIndexFileRoot("${JOB_NAME}")
env.INDEX_FILE_PATH_X64_ZIP = buildManifestObj.getIndexFileRoot("${JOB_NAME}")

echo "buildManifestUrl (windows, x64, zip): ${buildManifestUrl}"
echo "artifactUrl (windows, x64, zip): ${artifactUrl}"

}
}
post {
success {
script {
if (params.UPDATE_LATEST_URL) {
uploadIndexFile(
indexFilePath: env.INDEX_FILE_PATH_X64_ZIP
)
}
}
}
unstable {
script {
if (params.UPDATE_LATEST_URL) {
uploadIndexFile(
indexFilePath: env.INDEX_FILE_PATH_X64_ZIP
)
}
}
}
always {
script {
lib.jenkins.Messages.new(this).add(
Expand All @@ -821,26 +954,6 @@ pipeline {
}
}
}
stage('update index file') {
agent {
docker {
label AGENT_LINUX_X64
image dockerAgent.image
args dockerAgent.args
registryUrl 'https://public.ecr.aws/'
alwaysPull true
}
}
steps {
script {
if (params.UPDATE_LATEST_URL) {
uploadIndexFile(
indexFilePath: env.INDEX_FILE_PATH
)
}
}
}
}
stage('docker build') {
when {
beforeAgent true
Expand Down Expand Up @@ -965,4 +1078,4 @@ def markStageUnstableIfPluginsFailedToBuild() {
if (stageLogs.any{e -> e.contains('Failed plugins are')}) {
unstable('Some plugins failed to build. See the ./build.sh step for logs and more details')
}
}
}
Loading

0 comments on commit fec0355

Please sign in to comment.