Skip to content

Commit

Permalink
Delete scripts in kokoro/{gcp_ubuntu,macos_external}/examples
Browse files Browse the repository at this point in the history
Test examples in kokoro/{gcp_ubuntu,macos_external}/bazel.

PiperOrigin-RevId: 567223488
Change-Id: Ib13f3d23bc3b97d9c35082f9eaa609953de19aa4
  • Loading branch information
morambro authored and copybara-github committed Sep 21, 2023
1 parent 668bff6 commit 64552a8
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 156 deletions.
43 changes: 33 additions & 10 deletions kokoro/gcp_ubuntu/bazel/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,29 +31,25 @@ readonly GITHUB_ORG="https://github.com/tink-crypto"

RUN_COMMAND_ARGS=()
if [[ -n "${KOKORO_ARTIFACTS_DIR:-}" ]] ; then
TINK_BASE_DIR="$(echo "${KOKORO_ARTIFACTS_DIR}"/git*)"
source \
"${TINK_BASE_DIR}/tink_java_gcpkms/kokoro/testutils/java_test_container_images.sh"
readonly TINK_BASE_DIR="$(echo "${KOKORO_ARTIFACTS_DIR}"/git*)"
cd "${TINK_BASE_DIR}/tink_java_gcpkms"
source ./kokoro/testutils/java_test_container_images.sh
CONTAINER_IMAGE="${TINK_JAVA_BASE_IMAGE}"
RUN_COMMAND_ARGS+=( -k "${TINK_GCR_SERVICE_KEY}" )
fi
: "${TINK_BASE_DIR:=$(cd .. && pwd)}"
readonly TINK_BASE_DIR
readonly CONTAINER_IMAGE

if [[ -n "${CONTAINER_IMAGE:-}" ]]; then
RUN_COMMAND_ARGS+=( -c "${CONTAINER_IMAGE}" )
fi
readonly RUN_COMMAND_ARGS

cd "${TINK_BASE_DIR}/tink_java_gcpkms"

# Check for dependencies in TINK_BASE_DIR. Any that aren't present will be
# downloaded.
./kokoro/testutils/fetch_git_repo_if_not_present.sh "${TINK_BASE_DIR}" \
"${GITHUB_ORG}/tink-java"

./kokoro/testutils/copy_credentials.sh "testdata" "gcp"
./kokoro/testutils/copy_credentials.sh "examples/testdata" "gcp"

cp WORKSPACE WORKSPACE.bak
./kokoro/testutils/replace_http_archive_with_local_repository.py \
Expand All @@ -64,14 +60,34 @@ set -euo pipefail
./tools/create_maven_build_file.sh -o BUILD.bazel.temp
if ! cmp -s BUILD.bazel BUILD.bazel.temp; then
echo "ERROR: Update your BUILD.bazel file using ./tools/create_maven_build_file.sh or applying:" >&2
echo -n "ERROR: Update your BUILD.bazel file using" >&2
echo " ./tools/create_maven_build_file.sh or applying:"
echo "patch BUILD.bazel<<PATCH"
echo "$(diff BUILD.bazel BUILD.bazel.temp)"
echo "PATCH"
EOP
exit 1
fi
./kokoro/testutils/run_bazel_tests.sh .
MANUAL_TARGETS=()
if [[ -n "${KOKORO_ROOT:-}" ]]; then
MANUAL_TARGETS+=(
"//src/test/java/com/google/crypto/tink/integration/gcpkms:GcpKmsIntegrationTest"
)
fi
readonly MANUAL_TARGETS
./kokoro/testutils/run_bazel_tests.sh . "${MANUAL_TARGETS[@]}"
# Targets tagged as "manual" that require setting GCP credentials.
EXAMPLES_MANUAL_TARGETS=()
if [[ -n "${KOKORO_ROOT:-}" ]]; then
EXAMPLES_MANUAL_TARGETS=(
"//gcs:gcs_envelope_aead_example_test"
"//encryptedkeyset:encrypted_keyset_example_test"
"//envelopeaead:envelope_aead_example_test"
)
fi
readonly EXAMPLES_MANUAL_TARGETS
./kokoro/testutils/run_bazel_tests.sh "examples" "${EXAMPLES_MANUAL_TARGETS[@]}"
EOF
chmod +x _do_run_test.sh

Expand All @@ -84,4 +100,11 @@ cleanup() {
mv WORKSPACE.bak WORKSPACE
}

# Share the required Kokoro env variables.
cat <<EOF > env_variables.txt
KOKORO_ROOT
EOF
RUN_COMMAND_ARGS+=( -e env_variables.txt )
readonly RUN_COMMAND_ARGS

./kokoro/testutils/run_command.sh "${RUN_COMMAND_ARGS[@]}" ./_do_run_test.sh
83 changes: 0 additions & 83 deletions kokoro/gcp_ubuntu/examples/bazel/run_tests.sh

This file was deleted.

18 changes: 15 additions & 3 deletions kokoro/macos_external/bazel/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,19 @@ export ANDROID_HOME="/usr/local/share/android-sdk"
export COURSIER_OPTS="-Djava.net.preferIPv6Addresses=true"

if [[ -n "${KOKORO_ROOT:-}" ]] ; then
TINK_BASE_DIR="$(echo "${KOKORO_ARTIFACTS_DIR}"/git*)"
readonly TINK_BASE_DIR="$(echo "${KOKORO_ARTIFACTS_DIR}"/git*)"
cd "${TINK_BASE_DIR}/tink_java_gcpkms"
export JAVA_HOME=$(/usr/libexec/java_home -v "1.8.0_292")
fi

: "${TINK_BASE_DIR:=$(cd .. && pwd)}"

# Check for dependencies in TINK_BASE_DIR. Any that aren't present will be
# downloaded.
readonly GITHUB_ORG="https://github.com/tink-crypto"
./kokoro/testutils/fetch_git_repo_if_not_present.sh "${TINK_BASE_DIR}" \
"${GITHUB_ORG}/tink-java"

./kokoro/testutils/copy_credentials.sh "testdata" "gcp"
./kokoro/testutils/copy_credentials.sh "examples/testdata" "gcp"
./kokoro/testutils/update_android_sdk.sh
./kokoro/testutils/replace_http_archive_with_local_repository.py \
-f "WORKSPACE" -t "${TINK_BASE_DIR}"
Expand All @@ -51,3 +50,16 @@ fi
readonly MANUAL_TARGETS

./kokoro/testutils/run_bazel_tests.sh . "${MANUAL_TARGETS[@]}"

# Targets tagged as "manual" that require setting GCP credentials.
MANUAL_EXAMPLE_TARGETS=()
if [[ -n "${KOKORO_ROOT:-}" ]]; then
MANUAL_EXAMPLE_TARGETS=(
"//gcs:gcs_envelope_aead_example_test"
"//encryptedkeyset:encrypted_keyset_example_test"
"//envelopeaead:envelope_aead_example_test"
)
fi
readonly MANUAL_EXAMPLE_TARGETS

./kokoro/testutils/run_bazel_tests.sh "examples" "${MANUAL_EXAMPLE_TARGETS[@]}"
60 changes: 0 additions & 60 deletions kokoro/macos_external/examples/bazel/run_tests.sh

This file was deleted.

0 comments on commit 64552a8

Please sign in to comment.