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

[NodeJS18 Upgrade] Add AL2023 Docker Images Selection by BuildDocker lib #302

Merged
Show file tree
Hide file tree
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
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: 'jenkins@main', 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