Skip to content

Commit

Permalink
Add parameter for docker re-release to use corresponding opensearch-b…
Browse files Browse the repository at this point in the history
…uild tag reference (#373)

Signed-off-by: Peter Zhu <[email protected]>
  • Loading branch information
peterzhuamazon authored Jan 30, 2024
1 parent ae6bcad commit d560891
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ jacocoTestReport {
}
}

String version = '6.1.1'
String version = '6.2.0'

task updateVersion {
doLast {
Expand Down
4 changes: 2 additions & 2 deletions tests/jenkins/jobs/PatchDockerImage_Jenkinsfile.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
patchDockerImage.sh({script=docker inspect --format '{{ index .Config.Labels "org.label-schema.version"}}' opensearchproject/opensearch:latest, returnStdout=true})
patchDockerImage.readYaml({file=manifests/1.3.0/opensearch-1.3.0.yml})
InputManifest.asBoolean()
patchDockerImage.buildDockerImage({inputManifest=manifests/1.3.0/opensearch-1.3.0.yml, buildNumber=7756, buildDate=20230619, buildOption=re_release_docker_image, artifactUrlX64=https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/1.3.0/7756/linux/x64/tar/dist/opensearch/opensearch-1.3.0-linux-x64.tar.gz, artifactUrlArm64=https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/1.3.0/7756/linux/arm64/tar/dist/opensearch/opensearch-1.3.0-linux-arm64.tar.gz})
patchDockerImage.buildDockerImage({inputManifest=manifests/1.3.0/opensearch-1.3.0.yml, buildNumber=7756, buildGitRef=1.3.0, buildDate=20230619, buildOption=re_release_docker_image, artifactUrlX64=https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/1.3.0/7756/linux/x64/tar/dist/opensearch/opensearch-1.3.0-linux-x64.tar.gz, artifactUrlArm64=https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/1.3.0/7756/linux/arm64/tar/dist/opensearch/opensearch-1.3.0-linux-arm64.tar.gz})
buildDockerImage.legacySCM(groovy.lang.Closure)
buildDockerImage.library({identifier=jenkins@main, retriever=null})
buildDockerImage.readYaml({file=manifests/1.3.0/opensearch-1.3.0.yml})
InputManifest.asBoolean()
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_GIT_REPOSITORY_REFERENCE, value=1.3.0})
buildDockerImage.string({name=DOCKER_BUILD_SCRIPT_WITH_COMMANDS, value=id && pwd && cd docker/release && curl -sSL https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/1.3.0/7756/linux/x64/tar/dist/opensearch/opensearch-1.3.0-linux-x64.tar.gz -o opensearch-x64.tgz && curl -sSL https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/1.3.0/7756/linux/arm64/tar/dist/opensearch/opensearch-1.3.0-linux-arm64.tar.gz -o opensearch-arm64.tgz && bash build-image-multi-arch.sh -v 1.3.0 -f ./dockerfiles/opensearch.al2.dockerfile -p opensearch -a 'x64,arm64' -r opensearchstaging/opensearch -t 'opensearch-x64.tgz,opensearch-arm64.tgz' -n 7756})
buildDockerImage.build({job=docker-build, propagate=true, wait=true, parameters=[null, null, null]})
buildDockerImage.echo(Triggering docker create tag with build number)
Expand Down
6 changes: 4 additions & 2 deletions vars/buildDockerImage.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,19 @@
Library to build Docker Image with different Build Options
@param Map[inputManifest] <Required> - Path to Input Manifest.
@param Map[buildNumber] <Required> - Build number of the corresponding Artifact.
@param Map[buildDate] <Optional> - Date on which the artifacts were built.
@param Map[artifactUrlX64] <Required> - Url Path to X64 Tarball.
@param Map[artifactUrlARM64] <Required> - Url Path to ARM64 Tarball.
@param Map[buildOption] <Required> - Build Option for building the image with different options.
@param Map[buildGitRef] <Optional> - Build Git Reference of the opensearch-build repository, default to 'main'.
@param Map[buildDate] <Optional> - Date on which the artifacts were built.
*/
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}"
def build_git_ref = args.buildGitRef ?: "main"
String image_tag = ""
String image_base_os = "al2023"

Expand Down Expand Up @@ -52,7 +54,7 @@ void call(Map args = [:]) {
wait: true,
parameters: [
string(name: 'DOCKER_BUILD_GIT_REPOSITORY', value: 'https://github.com/opensearch-project/opensearch-build'),
string(name: 'DOCKER_BUILD_GIT_REPOSITORY_REFERENCE', value: 'main'),
string(name: 'DOCKER_BUILD_GIT_REPOSITORY_REFERENCE', value: "${build_git_ref}"),
string(name: 'DOCKER_BUILD_SCRIPT_WITH_COMMANDS', value: [
'id',
'pwd',
Expand Down
1 change: 1 addition & 0 deletions vars/patchDockerImage.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ void call(Map args = [:]) {
buildDockerImage(
inputManifest: "manifests/${version}/${args.product}-${version}.yml",
buildNumber: "${build_number}",
buildGitRef: "${version}",
buildDate: "${build_date}",
buildOption: "${build_option}",
artifactUrlX64: "${artifactUrlX64}",
Expand Down

0 comments on commit d560891

Please sign in to comment.