Skip to content

Commit 0f77934

Browse files
authored
Merge pull request #33088 from shunping/fix-postcommit-python
Revert PR #32960
2 parents 682eaef + 93a3dea commit 0f77934

File tree

6 files changed

+3
-88
lines changed

6 files changed

+3
-88
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"comment": "Modify this file in a trivial way to cause this test suite to run.",
3-
"modification": 3
3+
"modification": 4
44
}
55

sdks/python/container/Dockerfile

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -103,33 +103,9 @@ RUN if [ "$pull_licenses" = "true" ] ; then \
103103
python /tmp/license_scripts/pull_licenses_py.py ; \
104104
fi
105105

106-
FROM beam as base
106+
FROM beam
107107
ARG pull_licenses
108108
COPY --from=third_party_licenses /opt/apache/beam/third_party_licenses /opt/apache/beam/third_party_licenses
109109
RUN if [ "$pull_licenses" != "true" ] ; then \
110110
rm -rf /opt/apache/beam/third_party_licenses ; \
111111
fi
112-
113-
ARG TARGETARCH
114-
FROM gcr.io/distroless/python3-debian12:latest-${TARGETARCH} as distroless
115-
ARG py_version
116-
117-
# Contains header files needed by the Python interpreter.
118-
COPY --from=base /usr/local/include /usr/local/include
119-
120-
# Contains the Python interpreter executables.
121-
COPY --from=base /usr/local/bin /usr/local/bin
122-
123-
# Contains the Python library dependencies.
124-
COPY --from=base /usr/local/lib /usr/local/lib
125-
126-
# Python standard library modules.
127-
COPY --from=base /usr/lib/python${py_version} /usr/lib/python${py_version}
128-
129-
# Contains the boot entrypoint and related files such as licenses.
130-
COPY --from=base /opt /opt
131-
132-
ENV PATH "$PATH:/usr/local/bin"
133-
134-
# Despite the ENTRYPOINT set above, need to reset since deriving the layer derives from a different image.
135-
ENTRYPOINT ["/opt/apache/beam/boot"]

sdks/python/container/common.gradle

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,16 +71,10 @@ def copyLauncherDependencies = tasks.register("copyLauncherDependencies", Copy)
7171
}
7272

7373
def pushContainers = project.rootProject.hasProperty(["isRelease"]) || project.rootProject.hasProperty("push-containers")
74-
def baseBuildTarget = 'base'
75-
def buildTarget = project.findProperty('container-build-target') ?: 'base'
76-
var imageName = project.docker_image_default_repo_prefix + "python${project.ext.pythonVersion}_sdk"
77-
if (buildTarget != baseBuildTarget) {
78-
imageName += "_${buildTarget}"
79-
}
8074

8175
docker {
8276
name containerImageName(
83-
name: imageName,
77+
name: project.docker_image_default_repo_prefix + "python${project.ext.pythonVersion}_sdk",
8478
root: project.rootProject.hasProperty(["docker-repository-root"]) ?
8579
project.rootProject["docker-repository-root"] :
8680
project.docker_image_default_repo_root,
@@ -96,7 +90,6 @@ docker {
9690
platform(*project.containerPlatforms())
9791
load project.useBuildx() && !pushContainers
9892
push pushContainers
99-
target buildTarget
10093
}
10194

10295
dockerPrepare.dependsOn copyLauncherDependencies

sdks/python/test-suites/dataflow/build.gradle

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,6 @@ task validatesContainerTests {
6060
}
6161
}
6262

63-
task validatesDistrolessContainerTests {
64-
getVersionsAsList('distroless_python_versions').each {
65-
dependsOn.add(":sdks:python:test-suites:dataflow:py${getVersionSuffix(it)}:validatesDistrolessContainer")
66-
}
67-
}
68-
6963
task examplesPostCommit {
7064
getVersionsAsList('dataflow_examples_postcommit_py_versions').each {
7165
dependsOn.add(":sdks:python:test-suites:dataflow:py${getVersionSuffix(it)}:examples")

sdks/python/test-suites/dataflow/common.gradle

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -380,51 +380,6 @@ task validatesContainer() {
380380
}
381381
}
382382

383-
/**
384-
* Validates the distroless (https://github.com/GoogleContainerTools/distroless) variant of the Python SDK container
385-
* image (sdks/python/container/Dockerfile).
386-
* To test a single version of Python:
387-
* ./gradlew :sdks:python:test-suites:dataflow:py311:validatesDistrolessContainer
388-
* See https://cwiki.apache.org/confluence/display/BEAM/Python+Tips#PythonTips-VirtualEnvironmentSetup
389-
* for more information on setting up different Python versions.
390-
*/
391-
task validatesDistrolessContainer() {
392-
def pyversion = "${project.ext.pythonVersion.replace('.', '')}"
393-
def buildTarget = 'distroless'
394-
def repository = "us.gcr.io/apache-beam-testing/${System.getenv('USER')}"
395-
def tag = java.time.Instant.now().getEpochSecond()
396-
def imageURL = "${repository}/beam_python${project.ext.pythonVersion}_sdk_${buildTarget}:${tag}"
397-
project.rootProject.ext['docker-repository-root'] = repository
398-
project.rootProject.ext['container-build-target'] = buildTarget
399-
project.rootProject.ext['docker-tag'] = tag
400-
if (project.rootProject.hasProperty('dry-run')) {
401-
println "Running in dry run mode: imageURL: ${imageURL}, pyversion: ${pyversion}, buildTarget: ${buildTarget}, repository: ${repository}, tag: ${tag}, envdir: ${envdir}"
402-
return
403-
}
404-
dependsOn 'initializeForDataflowJob'
405-
dependsOn ":sdks:python:container:py${pyversion}:docker"
406-
dependsOn ":sdks:python:container:py${pyversion}:dockerPush"
407-
def testTarget = "apache_beam/examples/wordcount_it_test.py::WordCountIT::test_wordcount_it"
408-
def argMap = [
409-
"output": "gs://temp-storage-for-end-to-end-tests/py-it-cloud/output",
410-
"project": "apache-beam-testing",
411-
"region": "us-central1",
412-
"runner": "TestDataflowRunner",
413-
"sdk_container_image": "${imageURL}",
414-
"sdk_location": "container",
415-
"staging_location": "gs://temp-storage-for-end-to-end-tests/staging-it",
416-
"temp_location": "gs://temp-storage-for-end-to-end-tests/temp-it",
417-
]
418-
def cmdArgs = mapToArgString(argMap)
419-
doLast {
420-
exec {
421-
workingDir = "${rootDir}/sdks/python"
422-
executable 'sh'
423-
args '-c', ". ${envdir}/bin/activate && pytest ${testTarget} --test-pipeline-options=\"${cmdArgs}\""
424-
}
425-
}
426-
}
427-
428383
task validatesContainerARM() {
429384
def pyversion = "${project.ext.pythonVersion.replace('.', '')}"
430385
dependsOn 'initializeForDataflowJob'

sdks/python/test-suites/gradle.properties

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,3 @@ prism_examples_postcommit_py_versions=3.9,3.12
5454

5555
# cross language postcommit python test suites
5656
cross_language_validates_py_versions=3.9,3.12
57-
58-
# Python versions to support distroless variants
59-
distroless_python_versions=3.9,3.10,3.11,3.12

0 commit comments

Comments
 (0)