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

Made changes to build and test multi-arch Beam SDK container images #27311

Closed
wants to merge 72 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
0741f78
Made changes to build and test multiarch Beam Python SDK containers
celeste-zeng Jun 29, 2023
ba50ba7
Merge branch 'master' of https://github.com/celeste-zeng/beam into be…
celeste-zeng Jun 29, 2023
20fe137
Specified directory to push the multiarch containers and changed the …
celeste-zeng Jun 30, 2023
38a8398
Changed the tag for the multiarch containers built during the validat…
celeste-zeng Jun 30, 2023
ea45aee
Correctly formatted tag and repository so the docker pull request for…
celeste-zeng Jul 1, 2023
f5f4f44
Made changes so that python validatesContainer will automatically bui…
celeste-zeng Jul 6, 2023
5b53d59
fix format errors
celeste-zeng Jul 6, 2023
bec91cd
minor errors
celeste-zeng Jul 6, 2023
383c4c4
remove unnecessary changes
celeste-zeng Jul 6, 2023
03759eb
Made changes to build Java and Go multi-arch Beam container images
celeste-zeng Jul 11, 2023
f5a2b74
Make the postcommit go and java to build and test multi-arch containers.
celeste-zeng Jul 11, 2023
8c2494d
Add building multiarch Java containers to the PostCommit Java job_Pos…
celeste-zeng Jul 11, 2023
1fdf4cb
Add unique tag for multiarch Beam Python containers in validatesConta…
celeste-zeng Jul 11, 2023
cdfb582
Hardcode the repository to push multiarch Beam Python SDK container i…
celeste-zeng Jul 11, 2023
5b4931a
fix format error for container tag
celeste-zeng Jul 11, 2023
357a3d3
Make the Java postcommit dataflow test suite to build and use multiar…
celeste-zeng Jul 12, 2023
b5cb071
Add unique tag for Java and Go postcommit tests, also make the Python…
celeste-zeng Jul 12, 2023
3e0f47b
Made the Go PostCommit test script to build multiarch containers; rem…
celeste-zeng Jul 12, 2023
d92cc50
Get rid of redundant switch options.
celeste-zeng Jul 13, 2023
32a410b
Remove unnecessary changes for crosee-language tests.
celeste-zeng Jul 13, 2023
88b8f5b
Add unique tag for PostCommit Java tests.
celeste-zeng Jul 13, 2023
f5d2161
Remove comment.
celeste-zeng Jul 13, 2023
64d503b
Pull different components of the multiarch containers separately, so …
celeste-zeng Jul 17, 2023
85aec94
Changed how to verify and clean Java multiarch containers.
celeste-zeng Jul 18, 2023
bcf66fb
fixed typo
celeste-zeng Jul 18, 2023
373428a
No need to pull multiarch containers to verify its existence and upda…
celeste-zeng Jul 18, 2023
a078ec9
Revert the Multiarch Java container name changes to make the precommi…
celeste-zeng Jul 18, 2023
84fbc02
Remove regenerate base image requirements for each Python validatesCo…
celeste-zeng Jul 19, 2023
bf27b0e
[Build/Release] Change release settings so that the release Beam SDk …
celeste-zeng Jul 20, 2023
27eaf4d
Merge branch 'apache:master' into master
celeste-zeng Jul 20, 2023
a4adb77
[Build/Release]Update release task for Beam Python SDK containers
celeste-zeng Jul 21, 2023
66b68c6
[Build/Release] Update BeamModulePlugin.groovy to fix spotlessGroovyC…
celeste-zeng Jul 21, 2023
3a09642
[Build/Release] Remove trailing whitespaces.
celeste-zeng Jul 21, 2023
d6410bf
Merge branch 'master' of https://github.com/celeste-zeng/beam into be…
celeste-zeng Jul 21, 2023
3a880b9
Merge branch 'apache:master' into master
celeste-zeng Jul 21, 2023
24ebacc
[Build/Release] Change the pushAll task for Python SDK containers to …
celeste-zeng Jul 21, 2023
5557c00
Merge branch 'master' of https://github.com/celeste-zeng/beam into be…
celeste-zeng Jul 21, 2023
0438751
[New Arm Tests]Create job_PostCommit_Python_Dataflow_Arm.groovy
celeste-zeng Jul 24, 2023
9820b24
[New Arm Tests] Changed .txt and .md files for the newly added Datafl…
celeste-zeng Jul 24, 2023
5e88bae
Merge branch 'master' of https://github.com/celeste-zeng/beam into be…
celeste-zeng Jul 24, 2023
a91c12b
[New Arm Tests] Changed .test-infra/jenkins/job_PostCommit_Python_Dat…
celeste-zeng Jul 24, 2023
150b659
[New Arm Tests] Added a script file for the new Dataflow Python Arm t…
celeste-zeng Jul 24, 2023
f0eec39
[Existing test] Format job_PostCommit_Python_ValidatesContainer_Dataf…
celeste-zeng Jul 24, 2023
39c7c55
[New Arm Tests] Fix formetts for wordcount_it_test.py
celeste-zeng Jul 24, 2023
419b81b
[New Arm Tests] Update job_PostCommit_Python_Dataflow_Arm.groovy
celeste-zeng Jul 24, 2023
3299c5b
[Existing Tests] Correct image tag formats.
celeste-zeng Jul 25, 2023
13a1080
Merge branch 'master' of https://github.com/celeste-zeng/beam into be…
celeste-zeng Jul 25, 2023
17cdc26
[New Arm Tests] fix format for job_PostCommit_Python_Dataflow_Arm
celeste-zeng Jul 25, 2023
2097372
[New Arm Tests] Added yml file for Go PostCommit Dataflow ARM test an…
celeste-zeng Jul 25, 2023
2f69ec7
[New Arm Tests] modify beam_PostCommit_Go_Dataflow_ARM and add it int…
celeste-zeng Jul 25, 2023
8ef53cf
Merge branch 'apache:master' into master
celeste-zeng Jul 26, 2023
e59f71d
Merge branch 'apache:master' into master
celeste-zeng Jul 26, 2023
90055dc
[New ARM Tests] Update beam_PostCommit_Go_Dataflow_ARM.yml to run aga…
celeste-zeng Jul 26, 2023
85d0d20
[New Arm Tests] format beam_PostCommit_Go_Dataflow_ARM.yml
celeste-zeng Jul 26, 2023
b88ebbc
Merge branch 'apache:master' into master
celeste-zeng Jul 26, 2023
eed7080
[New Arm Tests] Make temp changes in beam_PostCommit_Go_Dataflow_ARM.yml
celeste-zeng Jul 26, 2023
83f4b28
[New Arm tests] try to not skip beam_PostCommit_Go_Dataflow_ARM.yml
celeste-zeng Jul 27, 2023
89a6944
[New Arm Tests] repository only allows lower case names
celeste-zeng Jul 27, 2023
3c33910
[New Arm Tests] Add Docker Buildx
celeste-zeng Jul 27, 2023
1918f4b
[Go Arm Test] Revert temp changes, delete unnecessary gradle target.
celeste-zeng Jul 27, 2023
d1292ba
Merge branch 'apache:master' into master
celeste-zeng Jul 27, 2023
1c63831
Delete files that are added in other PRs.
celeste-zeng Jul 27, 2023
293f703
Revert changes no longer needed.
celeste-zeng Jul 27, 2023
9e4922b
Revert more Jenkins changes.
celeste-zeng Jul 27, 2023
f43e365
Revert more changes in another PR.
celeste-zeng Jul 27, 2023
a6e91aa
Revert more remaining changes.
celeste-zeng Jul 27, 2023
7847711
Resolve conflicts.
celeste-zeng Jul 27, 2023
97d6c2d
Merge branch 'master' into master
celeste-zeng Jul 28, 2023
22a78a4
Remove white space
celeste-zeng Jul 28, 2023
d94a5ff
Remove white space
celeste-zeng Jul 28, 2023
b105fb4
Remove blank line.
celeste-zeng Jul 28, 2023
e3d321b
Merge branch 'apache:master' into master
celeste-zeng Jul 28, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import PostcommitJobBuilder
import CommonJobProperties as commonJobProperties
import java.time.LocalDateTime

PostcommitJobBuilder.postCommitJob('beam_PostCommit_Java_Examples_Dataflow_V2',
'Run Java Examples on Dataflow Runner V2', 'Google Cloud Dataflow Runner V2 Examples', this) {
Expand All @@ -30,17 +31,23 @@ PostcommitJobBuilder.postCommitJob('beam_PostCommit_Java_Examples_Dataflow_V2',
archiveJunit('**/build/test-results/**/*.xml')
}

// Generates a unique tag for the container as the current time.
def now = LocalDateTime.now()
def unique_tag = "${now.date}${now.hour}${now.minute}${now.second}"
steps {
gradle {
rootBuildScriptDir(commonJobProperties.checkoutDir)
tasks(':runners:google-cloud-dataflow-java:examplesJavaRunnerV2IntegrationTest')

// Increase parallel worker threads above processor limit since most time is
// spent waiting on Dataflow jobs. ValidatesRunner tests on Dataflow are slow
// because each one launches a Dataflow job with about 3 mins of overhead.
// 3 x num_cores strikes a good balance between maxing out parallelism without
// overloading the machines.
commonJobProperties.setGradleSwitches(delegate, 3 * Runtime.runtime.availableProcessors())
switches "-Pcontainer-architecture-list=arm64,amd64"
switches '-Ppush-containers'
switches "-Pdocker-repository-root=us.gcr.io/apache-beam-testing/java-postcommit-it"
switches "-Pdocker-tag=${unique_tag}"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import PostcommitJobBuilder
import CommonJobProperties as commonJobProperties
import java.time.LocalDateTime

PostcommitJobBuilder.postCommitJob('beam_PostCommit_Java_Examples_Dataflow_V2_java11',
'Run Java 11 Examples on Dataflow Runner V2', 'Google Cloud Dataflow Runner V2 Examples Java 11', this) {
Expand All @@ -30,11 +31,13 @@ PostcommitJobBuilder.postCommitJob('beam_PostCommit_Java_Examples_Dataflow_V2_ja
archiveJunit('**/build/test-results/**/*.xml')
}

// Generates a unique tag for the container as the current time.
def now = LocalDateTime.now()
def unique_tag = "${now.date}${now.hour}${now.minute}${now.second}"
steps {
gradle {
rootBuildScriptDir(commonJobProperties.checkoutDir)
tasks(':runners:google-cloud-dataflow-java:examplesJavaRunnerV2IntegrationTest')

// Increase parallel worker threads above processor limit since most time is
// spent waiting on Dataflow jobs. ValidatesRunner tests on Dataflow are slow
// because each one launches a Dataflow job with about 3 mins of overhead.
Expand All @@ -46,6 +49,10 @@ PostcommitJobBuilder.postCommitJob('beam_PostCommit_Java_Examples_Dataflow_V2_ja
switches '-PcompileAndRunTestsWithJava11'
switches '-PskipCheckerFramework'
switches "-Pjava11Home=${commonJobProperties.JAVA_11_HOME}"
switches '-Ppush-containers'
switches "-Pcontainer-architecture-list=arm64,amd64"
switches "-Pdocker-repository-root=us.gcr.io/apache-beam-testing/java-postcommit-it"
switches "-Pdocker-tag=${unique_tag}"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import PostcommitJobBuilder
import CommonJobProperties as commonJobProperties
import java.time.LocalDateTime

PostcommitJobBuilder.postCommitJob('beam_PostCommit_Java_Examples_Dataflow_V2_java17',
'Run Java 17 Examples on Dataflow Runner V2', 'Google Cloud Dataflow Runner V2 Examples Java 17', this) {
Expand All @@ -30,11 +31,13 @@ PostcommitJobBuilder.postCommitJob('beam_PostCommit_Java_Examples_Dataflow_V2_ja
archiveJunit('**/build/test-results/**/*.xml')
}

// Generates a unique tag for the container as the current time.
def now = LocalDateTime.now()
def unique_tag = "${now.date}${now.hour}${now.minute}${now.second}"
steps {
gradle {
rootBuildScriptDir(commonJobProperties.checkoutDir)
tasks(':runners:google-cloud-dataflow-java:examplesJavaRunnerV2IntegrationTest')

// Increase parallel worker threads above processor limit since most time is
// spent waiting on Dataflow jobs. ValidatesRunner tests on Dataflow are slow
// because each one launches a Dataflow job with about 3 mins of overhead.
Expand All @@ -46,6 +49,10 @@ PostcommitJobBuilder.postCommitJob('beam_PostCommit_Java_Examples_Dataflow_V2_ja
switches '-PcompileAndRunTestsWithJava17'
switches '-PskipCheckerFramework'
switches "-Pjava17Home=${commonJobProperties.JAVA_17_HOME}"
switches "-Pcontainer-architecture-list=arm64,amd64"
switches '-Ppush-containers'
switches "-Pdocker-repository-root=us.gcr.io/apache-beam-testing/java-postcommit-it"
switches "-Pdocker-tag=${unique_tag}"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import CommonJobProperties as commonJobProperties
import PostcommitJobBuilder

import static PythonTestProperties.VALIDATES_CONTAINER_DATAFLOW_PYTHON_VERSIONS
import java.time.LocalDateTime

// This job runs the suite of Python ValidatesContainer tests against the
// Dataflow runner.
Expand All @@ -34,11 +35,19 @@ PostcommitJobBuilder.postCommitJob('beam_PostCommit_Py_ValCont',
archiveJunit('**/pytest*.xml')
}

// Generates a unique tag for the container as the current time.
def now = LocalDateTime.now()
def unique_tag = "${now.date}${now.hour}${now.minute}${now.second}"
// Execute shell command to test Python SDK.
steps {
gradle {
rootBuildScriptDir(commonJobProperties.checkoutDir)
tasks(':sdks:python:test-suites:dataflow:validatesContainerTests')
switches('-Pcontainer-architecture-list=arm64,amd64')
switches('-Ppush-containers')
// Push multi-arch containers to the repository set in run_validatescontainer.sh
switches('-Pdocker-repository-root=us.gcr.io/apache-beam-testing/jenkins')
switches("-Pdocker-tag=${unique_tag}")
commonJobProperties.setGradleSwitches(delegate)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ class BeamModulePlugin implements Plugin<Project> {
project.ext.containerArchitectures = {
if (isRelease(project)) {
// Ensure we always publish the expected containers.
return ["amd64"];
return ["amd64", "arm64"];
} else if (project.rootProject.findProperty("container-architecture-list") != null) {
def containerArchitectures = project.rootProject.findProperty("container-architecture-list").split(',')
if (containerArchitectures.size() > 1 && !project.rootProject.hasProperty("push-containers")) {
Expand Down
36 changes: 11 additions & 25 deletions runners/google-cloud-dataflow-java/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,16 @@ def dataflowLegacyWorkerJar = project.findProperty('dataflowWorkerJar') ?: proje
def dataflowKmsKey = project.findProperty('dataflowKmsKey') ?: "projects/apache-beam-testing/locations/global/keyRings/beam-it/cryptoKeys/test"
def firestoreDb = project.findProperty('firestoreDb') ?: 'firestoredb'

def dockerImageRoot = project.findProperty('dockerImageRoot') ?: "us.gcr.io/${dataflowProject}/java-postcommit-it"
def dockerJavaImageContainer = "${dockerImageRoot}/java"
def javaVer = "java8"
if(project.hasProperty('compileAndRunTestsWithJava17')) {
javaVer = "java17"
} else if(project.hasProperty('compileAndRunTestsWithJava11')) {
javaVer = "java11"
}
def dockerImageRoot = project.findProperty('docker-repository-root') ?: "us.gcr.io/${dataflowProject}/java-postcommit-it"
def dockerJavaImageContainer = "${dockerImageRoot}/${project.docker_image_default_repo_prefix}java${javaVer}_sdk"
def dockerPythonImageContainer = "${dockerImageRoot}/python"
def dockerTag = new Date().format('yyyyMMddHHmmss')
def dockerTag = project.findProperty('docker-tag') ?: new Date().format('yyyyMMddHHmmss')
ext.dockerJavaImageName = "${dockerJavaImageContainer}:${dockerTag}"
ext.dockerPythonImageName = "${dockerPythonImageContainer}:${dockerTag}"

Expand Down Expand Up @@ -272,33 +278,13 @@ def createRunnerV2ValidatesRunnerTest = { Map args ->
// task directly ('dependsOn buildAndPushDockerJavaContainer'). This ensures the correct
// task ordering such that the registry doesn't get cleaned up prior to task completion.
def buildAndPushDockerJavaContainer = tasks.register("buildAndPushDockerJavaContainer") {
def javaVer = "java8"
if(project.hasProperty('compileAndRunTestsWithJava17')) {
javaVer = "java17"
} else if(project.hasProperty('compileAndRunTestsWithJava11')) {
javaVer = "java11"
}
// The multi-arch Java container has been pushed during build.
dependsOn ":sdks:java:container:${javaVer}:docker"
def defaultDockerImageName = containerImageName(
name: "${project.docker_image_default_repo_prefix}${javaVer}_sdk",
root: "apache",
tag: project.sdk_version)
doLast {
exec {
commandLine "docker", "tag", "${defaultDockerImageName}", "${dockerJavaImageName}"
}
exec {
commandLine "gcloud", "docker", "--", "push", "${dockerJavaImageName}"
}
}
}

// Clean up built Java images
def cleanUpDockerJavaImages = tasks.register("cleanUpDockerJavaImages") {
doLast {
exec {
commandLine "docker", "rmi", "--force", "${dockerJavaImageName}"
}
exec {
commandLine "gcloud", "--quiet", "container", "images", "untag", "${dockerJavaImageName}"
}
Expand Down Expand Up @@ -368,7 +354,7 @@ task printRunnerV2PipelineOptions {
println "To run a Dataflow job with runner V2, add the following pipeline options to your command-line:"
println runnerV2PipelineOptions.join(' ')
println "Please delete your image upon completion with the following command:"
println "docker rmi ${dockerJavaImageName}; gcloud container images delete --force-delete-tags ${dockerJavaImageName}"
println "gcloud container images delete --force-delete-tags ${dockerJavaImageName}"
}
}

Expand Down
2 changes: 1 addition & 1 deletion sdks/go/container/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,5 @@ if (project.rootProject.hasProperty(["docker-pull-licenses"])) {
}

task pushAll {
dependsOn ":sdks:go:container:dockerPush"
dependsOn ":sdks:go:container:docker"
}
2 changes: 1 addition & 1 deletion sdks/go/test/run_validatesrunner_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ if [[ "$RUNNER" == "dataflow" ]]; then

if [[ -n "$TEST_EXPANSION_ADDR" || -n "$IO_EXPANSION_ADDR" || -n "$SCHEMAIO_EXPANSION_ADDR" || -n "$DEBEZIUMIO_EXPANSION_ADDR" ]]; then
# Delete the java cross-language container locally and remotely
docker rmi $JAVA_CONTAINER:$JAVA_TAG || echo "Failed to remove container"
docker rmi $JAVA_CONTAINER:$JAVA_TAG || echo "Built container image was not removed. Possibly, it was not not saved locally."
gcloud --quiet container images delete $JAVA_CONTAINER:$JAVA_TAG || echo "Failed to delete container"
fi

Expand Down
6 changes: 3 additions & 3 deletions sdks/java/container/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ artifacts {
}

task pushAll {
dependsOn ":sdks:java:container:java8:dockerPush"
dependsOn ":sdks:java:container:java11:dockerPush"
dependsOn ":sdks:java:container:java17:dockerPush"
dependsOn ":sdks:java:container:java8:docker"
dependsOn ":sdks:java:container:java11:docker"
dependsOn ":sdks:java:container:java17:docker"
}
7 changes: 6 additions & 1 deletion sdks/java/container/common.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ task validateJavaHome {
}
}

def useBuildx = project.containerPlatforms() != [project.nativeArchitecture()]
def pushContainers = project.rootProject.hasProperty(["isRelease"]) || project.rootProject.hasProperty("push-containers")

docker {
name containerImageName(
name: "${project.docker_image_default_repo_prefix}java${imageJavaVersion}_sdk",
Expand All @@ -121,8 +124,10 @@ docker {
project.rootProject.hasProperty(["isRelease"]),
'java_version': imageJavaVersion,
])
buildx project.containerPlatforms() != [project.nativeArchitecture()]
buildx useBuildx
platform(*project.containerPlatforms())
load useBuildx && !pushContainers
push pushContainers
}

if (project.rootProject.hasProperty(["docker-pull-licenses"]) ||
Expand Down
27 changes: 1 addition & 26 deletions sdks/python/container/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -42,33 +42,8 @@ tasks.register("buildAll") {
dependsOn ':sdks:python:container:py311:docker'
}

for(int i=8; i<=11; ++i) {
String cur = "3" + i
String prev = "3" + (i-1)
tasks.register("push" + cur) {
if (cur != "38") {
// Enforce ordering to allow the prune step to happen between runs.
// This will ensure we don't use up too much space (especially in CI environments)
mustRunAfter(":sdks:python:container:push" + prev)
}
dependsOn ':sdks:python:container:py' + cur + ':dockerPush'

doLast {
if (project.hasProperty("prune-images")) {
exec {
executable("docker")
args("system", "prune", "-a", "--force")
}
}
}
}
}

tasks.register("pushAll") {
dependsOn ':sdks:python:container:push38'
dependsOn ':sdks:python:container:push39'
dependsOn ':sdks:python:container:push310'
dependsOn ':sdks:python:container:push311'
dependsOn ':sdks:python:container:buildAll'
}

tasks.register("generatePythonRequirementsAll") {
Expand Down
Loading