Skip to content

Commit

Permalink
[Backport 5.x] [NodeJS18 Upgrade] Add AL2023 Docker Images Selection …
Browse files Browse the repository at this point in the history
…by BuildDocker lib (#303)

Signed-off-by: Peter Zhu <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
1 parent e17e162 commit 43dd99b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ jacocoTestReport {
}
}

String version = '5.7.1'
String version = '5.8.0'

task updateVersion {
doLast {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
buildDockerImage.echo(Triggering docker-build)
buildDockerImage.string({name=DOCKER_BUILD_GIT_REPOSITORY, value=https://github.com/opensearch-project/opensearch-build})
buildDockerImage.string({name=DOCKER_BUILD_GIT_REPOSITORY_REFERENCE, value=main})
buildDockerImage.string({name=DOCKER_BUILD_SCRIPT_WITH_COMMANDS, value=id && pwd && cd docker/release && curl -sSL opensearch.linux.x64 -o opensearch-x64.tgz && curl -sSL opensearch.linux.arm64 -o opensearch-arm64.tgz && bash build-image-multi-arch.sh -v 2.0.0-alpha1 -f ./dockerfiles/opensearch.al2.dockerfile -p opensearch -a 'x64,arm64' -r opensearchstaging/opensearch -t 'opensearch-x64.tgz,opensearch-arm64.tgz' -n 33})
buildDockerImage.string({name=DOCKER_BUILD_SCRIPT_WITH_COMMANDS, value=id && pwd && cd docker/release && curl -sSL opensearch.linux.x64 -o opensearch-x64.tgz && curl -sSL opensearch.linux.arm64 -o opensearch-arm64.tgz && bash build-image-multi-arch.sh -v 2.0.0-alpha1 -f ./dockerfiles/opensearch.al2023.dockerfile -p opensearch -a 'x64,arm64' -r opensearchstaging/opensearch -t 'opensearch-x64.tgz,opensearch-arm64.tgz' -n 33})
buildDockerImage.build({job=docker-build, propagate=true, wait=true, parameters=[null, null, null]})
buildDockerImage.echo(Triggering docker create tag with build number)
buildDockerImage.echo(Triggering docker-scan for opensearch version 2.0.0-alpha1)
Expand Down
19 changes: 13 additions & 6 deletions vars/buildDockerImage.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,16 @@ Library to build Docker Image with different Build Options
void call(Map args = [:]) {
def lib = library(identifier: '[email protected]', retriever: legacySCM(scm))
def inputManifest = lib.jenkins.InputManifest.new(readYaml(file: args.inputManifest))
def build_version = inputManifest.build.version
def build_qualifier = inputManifest.build.qualifier
def build_number = args.buildNumber ?: "${BUILD_NUMBER}"
String image_tag = ""
String image_base_os = "al2023"

// Keep al2 for the 1.x versions
if (build_version.split("\\.")[0] == "1") {
image_base_os = "al2"
}

if (args.buildDate != null && args.buildDate != 'null'){
image_tag = "." + "${args.buildDate}"
Expand Down Expand Up @@ -55,8 +62,8 @@ void call(Map args = [:]) {
[
'bash',
'build-image-multi-arch.sh',
"-v ${inputManifest.build.version}${build_qualifier}",
"-f ./dockerfiles/${filename}.al2.dockerfile",
"-v ${build_version}${build_qualifier}",
"-f ./dockerfiles/${filename}.${image_base_os}.dockerfile",
"-p ${filename}",
"-a 'x64,arm64'",
"-r opensearchstaging/${filename}",
Expand All @@ -75,20 +82,20 @@ void call(Map args = [:]) {
wait: true,
parameters: [
string(name: 'SOURCE_IMAGE_REGISTRY', value: 'opensearchstaging'),
string(name: 'SOURCE_IMAGE', value: "${filename}:${inputManifest.build.version}${build_qualifier}"),
string(name: 'SOURCE_IMAGE', value: "${filename}:${build_version}${build_qualifier}"),
string(name: 'DESTINATION_IMAGE_REGISTRY', value: 'opensearchstaging'),
string(name: 'DESTINATION_IMAGE', value: "${filename}:${inputManifest.build.version}${build_qualifier}.${build_number}${image_tag}")
string(name: 'DESTINATION_IMAGE', value: "${filename}:${build_version}${build_qualifier}.${build_number}${image_tag}")
]
}
}

echo "Triggering docker-scan for ${filename} version ${inputManifest.build.version}${build_qualifier}"
echo "Triggering docker-scan for ${filename} version ${build_version}${build_qualifier}"
dockerScan: {
build job: 'docker-scan',
propagate: true,
wait: true,
parameters: [
string(name: 'IMAGE_FULL_NAME', value: "opensearchstaging/${filename}:${inputManifest.build.version}${build_qualifier}")
string(name: 'IMAGE_FULL_NAME', value: "opensearchstaging/${filename}:${build_version}${build_qualifier}")
]
}

Expand Down

0 comments on commit 43dd99b

Please sign in to comment.