forked from grpc/grpc
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
first attempt at bazelified rules for building artifacts/packages
- Loading branch information
1 parent
98704e7
commit b4e5ffe
Showing
6 changed files
with
246 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/bin/bash | ||
# Copyright 2023 The gRPC Authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
set -e | ||
|
||
ARCHIVE_WITH_SUBMODULES="$1" | ||
BUILD_SCRIPT="$2" | ||
EXIT_CODE_FILE="$3" | ||
SCRIPT_LOG_FILE="$4" | ||
ARTIFACTS_OUT_FILE="$5" | ||
shift 5 | ||
|
||
# Extract grpc repo archive | ||
tar -xopf ${ARCHIVE_WITH_SUBMODULES} | ||
cd grpc | ||
|
||
mkdir -p artifacts | ||
|
||
# Run the build script with args, storing its stdout and stderr | ||
# in a log file. | ||
SCRIPT_EXIT_CODE=0 | ||
../"${BUILD_SCRIPT}" "$@" >"../${SCRIPT_LOG_FILE}" 2>&1 || SCRIPT_EXIT_CODE="$?" | ||
|
||
# Store build script's exitcode in a file. | ||
# Note that the build atifacts task will terminate with success even when | ||
# there was an error building the artifacts. | ||
# The error status (an associated log) will be reported by an associated | ||
# bazel test. | ||
echo "${SCRIPT_EXIT_CODE}" >"../${EXIT_CODE_FILE}" | ||
|
||
# TODO(jtattermusch): add a test for the build_arifact_task test harness. | ||
|
||
# collect the artifacts | ||
# TODO: create deterministic tar archive | ||
tar -czvf ../"${ARTIFACTS_OUT_FILE}" artifacts |
49 changes: 49 additions & 0 deletions
49
tools/bazelify_tests/grpc_build_artifact_task_build_test.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/bin/bash | ||
# Copyright 2023 The gRPC Authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
set -e | ||
|
||
EXIT_CODE_FILE="$1" | ||
SCRIPT_LOG_FILE="$2" | ||
ARTIFACTS_ARCHIVE="$3" | ||
shift 3 | ||
|
||
BUILD_ARTIFACT_EXITCODE="$(cat ${EXIT_CODE_FILE})" | ||
|
||
echo "Build artifact task for '${ARTIFACTS_ARCHIVE}' has finished with exitcode ${BUILD_ARTIFACT_EXITCODE}." | ||
|
||
echo "BUILD LOG" | ||
echo "--------------" | ||
cat "${SCRIPT_LOG_FILE}" | ||
echo "--------------" | ||
echo | ||
|
||
# Try extracting the archive with artifacts (and list the files) | ||
mkdir -p input_artifacts | ||
pushd input_artifacts >/dev/null | ||
echo "Artifacts that were built by the build artifact task:" | ||
echo "--------------" | ||
tar -xopvf ../${ARTIFACTS_ARCHIVE} | ||
echo "--------------" | ||
popd >/dev/null | ||
|
||
|
||
if [ "${BUILD_ARTIFACT_EXITCODE}" -eq "0" ] | ||
then | ||
echo "SUCCESS: Artifact build task for '${ARTIFACTS_ARCHIVE}' to build 'ran successfully." | ||
else | ||
echo "FAIL: Artifact build task for '${ARTIFACTS_ARCHIVE}' failed with exitcode ${BUILD_ARTIFACT_EXITCODE}." | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
# Copyright 2023 The gRPC Authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
set -ex | ||
|
||
# compile/link options extracted from ProtocArtifact in tools/run_tests/artifacts/artifact_targets.py | ||
export LDFLAGS="${LDFLAGS} -static-libgcc -static-libstdc++ -s" | ||
# set build parallelism to fit the machine configuration of bazelified tests RBE pool. | ||
export GRPC_PROTOC_BUILD_COMPILER_JOBS=8 | ||
|
||
mkdir -p artifacts | ||
|
||
ARTIFACTS_OUT=artifacts tools/run_tests/artifacts/build_artifact_protoc.sh |