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

Automated fix for refs/heads/test-musl-linux-arm64 #244

Open
wants to merge 6 commits into
base: test-musl-linux-arm64
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
@@ -1 +1 @@
us-docker.pkg.dev/grpc-testing/testing-images-public/python_alpine_aarch64:086c6b7ba4177b5c086a4e1e36019fdd1d86a061@sha256:da5d191e62811fd3470d593aa9a7c2bfc8ee7d3453db92db13d62edb2eb9f39e
us-docker.pkg.dev/grpc-testing/testing-images-public/python_alpine_aarch64:78b5c9d459ceaedfa8dc8fa6dc52ce11666dd581@sha256:bcdfc865daa8c61dc6f9b67ddab63d47fcacb109ed57de5b9a7673dff907e02c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM python:3.10-alpine3.14
# this an aarch64 image
FROM arm64v8/python:3.10-alpine

# Our test infrastructure demands bash
RUN apk update && apk add bash
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# Config file for the internal CI (in protobuf text format)

# Location of the continuous shell script in repository.
build_file: "grpc/tools/internal_ci/linux/grpc_distribtests_python_arm64.sh"
build_file: "grpc/tools/internal_ci/linux/grpc_distribtests_python.sh"
timeout_mins: 240
action {
define_artifacts {
Expand All @@ -24,3 +24,8 @@ action {
regex: "github/grpc/artifacts/**"
}
}

env_vars {
key: "TASK_RUNNER_EXTRA_FILTERS"
value: "aarch64 musllinux_1_1"
}
5 changes: 5 additions & 0 deletions tools/internal_ci/linux/grpc_distribtests_python.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,8 @@ action {
regex: "github/grpc/artifacts/**"
}
}

env_vars {
key: "TASK_RUNNER_EXTRA_FILTERS"
value: "-e aarch64 musllinux_1_1"
}
32 changes: 25 additions & 7 deletions tools/internal_ci/linux/grpc_distribtests_python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,37 @@ cd $(dirname $0)/../../..

source tools/internal_ci/helper_scripts/prepare_build_linux_rc

# some distribtests use a pre-registered binfmt_misc hook
# to automatically execute foreign binaries (such as aarch64)
# under qemu emulator.
source tools/internal_ci/helper_scripts/prepare_qemu_rc
if [[ "${AUDITWHEEL_PLAT}" == "musllinux_1_1_aarch64" ]]; then
echo "Skipping prepare_qemu_rc'"
else
# some distribtests use a pre-registered binfmt_misc hook
# to automatically execute foreign binaries (such as aarch64)
# under qemu emulator.
source tools/internal_ci/helper_scripts/prepare_qemu_rc
fi

# configure ccache
source tools/internal_ci/helper_scripts/prepare_ccache_rc

# Build all python linux artifacts (this step actually builds all the binary wheels and source archives)
tools/run_tests/task_runner.py -f artifact linux python ${TASK_RUNNER_EXTRA_FILTERS} -j 12 -x build_artifacts/sponge_log.xml || FAILED="true"
if [[ "${AUDITWHEEL_PLAT}" == "musllinux_1_1_aarch64" ]]; then
tools/run_tests/task_runner.py -f artifact linux python ${TASK_RUNNER_EXTRA_FILTERS} -j 12 -x build_artifacts/sponge_log.xml || FAILED="true"
else
tools/run_tests/task_runner.py -f package linux python -x build_packages/sponge_log.xml || FAILED="true"
fi


# the next step expects to find the artifacts from the previous step in the "input_artifacts" folder.
rm -rf input_artifacts
mkdir -p input_artifacts
cp -r artifacts/* input_artifacts/ || true

# This step simply collects python artifacts from subdirectories of input_artifacts/ and copies them to artifacts/
tools/run_tests/task_runner.py -f package linux python -x build_packages/sponge_log.xml || FAILED="true"
if [[ "${AUDITWHEEL_PLAT}" == "musllinux_1_1_aarch64" ]]; then
tools/run_tests/task_runner.py -f package linux python ${TASK_RUNNER_EXTRA_FILTERS} -x build_packages/sponge_log.xml || FAILED="true"
else
tools/run_tests/task_runner.py -f package linux python -x build_packages/sponge_log.xml || FAILED="true"
fi

# the next step expects to find the artifacts from the previous step in the "input_artifacts" folder.
# in addition to that, preserve the contents of "artifacts" directory since we want kokoro
Expand All @@ -52,7 +65,12 @@ cp -r artifacts/* input_artifacts/ || true
# Run all python linux distribtests
# We run the distribtests even if some of the artifacts have failed to build, since that gives
# a better signal about which distribtest are affected by the currently broken artifact builds.
tools/run_tests/task_runner.py -f distribtest linux python ${TASK_RUNNER_EXTRA_FILTERS} -j 12 -x distribtests/sponge_log.xml || FAILED="true"
if [[ "${AUDITWHEEL_PLAT}" == "musllinux_1_1_aarch64" ]]; then
# We're using alpine as tag in distribtest targets.
tools/run_tests/task_runner.py -f distribtest linux python aarch64 alpine -j 12 -x distribtests/sponge_log.xml || FAILED="true"
else
tools/run_tests/task_runner.py -f distribtest linux python ${TASK_RUNNER_EXTRA_FILTERS} -j 12 -x distribtests/sponge_log.xml || FAILED="true"
fi

# This step checks if any of the artifacts exceeds a per-file size limit.
tools/internal_ci/helper_scripts/check_python_artifacts_size.sh
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ action {

env_vars {
key: "TASK_RUNNER_EXTRA_FILTERS"
value: "presubmit"
value: "presubmit -e aarch64 musllinux_1_1"
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# Config file for the internal CI (in protobuf text format)

# Location of the continuous shell script in repository.
build_file: "grpc/tools/internal_ci/linux/grpc_distribtests_python_arm64.sh"
build_file: "grpc/tools/internal_ci/linux/grpc_distribtests_python.sh"
timeout_mins: 240
action {
define_artifacts {
Expand All @@ -27,5 +27,5 @@ action {

env_vars {
key: "TASK_RUNNER_EXTRA_FILTERS"
value: "presubmit"
value: "presubmit aarch64 musllinux_1_1"
}
10 changes: 10 additions & 0 deletions tools/internal_ci/linux/pull_request/grpc_examples_tests_cpp.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,13 @@ action {
regex: "github/grpc/reports/**"
}
}

env_vars {
key: "TASK_RUNNER_EXTRA_FILTERS"
value: "aarch64 -e x64 x86 armv7"
}

# env_vars {
# key: "TASK_RUNNER_EXCLUDE_FILTERS"
# value: "x64 x86 armv7"
# }
5 changes: 5 additions & 0 deletions tools/internal_ci/linux/release/grpc_distribtests_python.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,8 @@ action {
regex: "github/grpc/artifacts/**"
}
}

env_vars {
key: "TASK_RUNNER_EXTRA_FILTERS"
value: "-e aarch64 musllinux_1_1"
}
20 changes: 18 additions & 2 deletions tools/run_tests/artifacts/package_targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,17 @@ def build_jobspec(self, inner_jobs=None):
class PythonPackage:
"""Collects python eggs and wheels created in the artifact phase"""

def __init__(self):
def __init__(self, platform="", arch=""):
self.name = "python_package"
self.labels = ["package", "python", "linux"]
self.platform = platform
self.arch = arch
if self.platform:
self.labels.append(platform)
self.name += "_" + platform
if self.arch:
self.labels.append(arch)
self.name += "_" + arch

def pre_build_jobspecs(self):
return []
Expand All @@ -154,9 +162,16 @@ def build_jobspec(self, inner_jobs=None):
# since the python package build does very little, we can use virtually
# any image that has new-enough python, so reusing one of the images used
# for artifact building seems natural.
dockerfile_dir = (
"tools/dockerfile/grpc_artifact_python_manylinux2014_x64"
)
if "musllinux_1_1" in self.platform and "aarch64" in self.arch:
dockerfile_dir = (
"tools/dockerfile/grpc_artifact_python_musllinux_1_1_aarch64"
)
return create_docker_jobspec(
self.name,
"tools/dockerfile/grpc_artifact_python_manylinux2014_x64",
dockerfile_dir,
"tools/run_tests/artifacts/build_package_python.sh",
environ={"PYTHON": "/opt/python/cp39-cp39/bin/python"},
)
Expand Down Expand Up @@ -189,5 +204,6 @@ def targets():
CSharpPackage("windows"),
RubyPackage(),
PythonPackage(),
PythonPackage("musllinux_1_1", "aarch64"),
PHPPackage(),
]
11 changes: 11 additions & 0 deletions tools/run_tests/task_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@ def _create_build_map():
default=[],
help="Filter targets to build with AND semantics.",
)
argp.add_argument(
"-e",
"--exclude",
choices=sorted(_BUILD_MAP.keys()),
nargs="+",
default=[],
help="Target labels to exclude from building.",
)
argp.add_argument("-j", "--jobs", default=multiprocessing.cpu_count(), type=int)
argp.add_argument(
"-x",
Expand Down Expand Up @@ -106,6 +114,9 @@ def _create_build_map():
# Among targets selected by -b, filter out those that don't match the filter
targets = [t for t in targets if all(f in t.labels for f in args.filter)]

# Exclude target if it has ALL of the specified exclude labels.
targets = [t for t in targets if not all(l in args.exclude for l in t.labels)]

print("Will build %d targets:" % len(targets))
for target in targets:
print(" %s, labels %s" % (target.name, target.labels))
Expand Down