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

Add qualifier support for docker build task #1844

Merged
Show file tree
Hide file tree
Changes from 4 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: 2 additions & 0 deletions src/jenkins/InputManifest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,14 @@ class InputManifest {
class Build implements Serializable {
String name
String version
String qualifier
String platform
String architecture

Build(Map data) {
this.name = data.name
this.version = data.version
this.qualifier = data.qualifier
this.platform = data.platform
this.architecture = data.architecture
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
InputManifest.asBoolean()
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 1.3.0 -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 1.3.0null -f ./dockerfiles/opensearch.al2.dockerfile -p opensearch -a 'x64,arm64' -r opensearchstaging/opensearch -t 'opensearch-x64.tgz,opensearch-arm64.tgz' -n 33})
peterzhuamazon marked this conversation as resolved.
Show resolved Hide resolved
buildDockerImage.booleanParam({name=IS_STAGING, value=true})
buildDockerImage.build({job=docker-build, parameters=[null, null, null, null]})
8 changes: 6 additions & 2 deletions vars/buildDockerImage.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ void call(Map args = [:]) {

def lib = library(identifier: 'jenkins@20211123', retriever: legacySCM(scm))
def inputManifest = lib.jenkins.InputManifest.new(readYaml(file: args.inputManifest))
def build_qualifier = inputManifest.build.qualifier

if (build_qualifier != null) {
build_qualifier = "-" + build_qualifier
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: move else up.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should just default build_qualifier to null and check inputmanifest.build.qualifier.
Will change in a later improvement.

String filename = inputManifest.build.getFilename()

if (args.artifactUrlX64 == null || args.artifactUrlArm64 == null) {
Expand All @@ -23,7 +27,7 @@ void call(Map args = [:]) {
[
'bash',
'build-image-multi-arch.sh',
"-v ${inputManifest.build.version}",
"-v ${inputManifest.build.version}${build_qualifier}",
peterzhuamazon marked this conversation as resolved.
Show resolved Hide resolved
"-f ./dockerfiles/${filename}.al2.dockerfile",
"-p ${filename}",
"-a 'x64,arm64'",
Expand All @@ -36,4 +40,4 @@ void call(Map args = [:]) {
]
}
}
}
}