Skip to content
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
48 changes: 48 additions & 0 deletions .kokoro/bigtable-cleanup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/bash
# Copyright 2026 Google LLC
#
# 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 -eo pipefail

## Get the directory of the build script
scriptDir=$(realpath $(dirname "${BASH_SOURCE[0]}"))
## cd to the parent directory, i.e. the root of the git repo
cd ${scriptDir}/..

# include common functions
source ${scriptDir}/common.sh

# Use GCP Maven Mirror
mkdir -p ${HOME}/.m2
cp settings.xml ${HOME}/.m2

setup_application_credentials

echo "Compiling and building all modules for java-bigtable"
install_modules "java-bigtable"

pushd java-bigtable
RETURN_CODE=0
for instance in google-cloud-bigtable google-cloud-bigtable-session; do
echo "Cleaning up stale resources in instance: ${instance}"
mvn -B -ntp -pl google-cloud-bigtable \
exec:java@cleanup-stale-resources \
-Dbigtable.project="${GOOGLE_CLOUD_PROJECT:-gcloud-devel}" \
-Dbigtable.instance="${instance}" \
-Dbigtable.table=integration-tests || RETURN_CODE=$?
done
popd

echo "exiting with ${RETURN_CODE}"
exit ${RETURN_CODE}
27 changes: 27 additions & 0 deletions .kokoro/nightly/bigtable-cleanup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Format: //devtools/kokoro/config/proto/build.proto

# Configure the docker image for kokoro-trampoline.
env_vars: {
key: "TRAMPOLINE_IMAGE"
value: "gcr.io/cloud-devrel-kokoro-resources/java11"
}

env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/google-cloud-java/.kokoro/bigtable-cleanup.sh"
}

env_vars: {
key: "GOOGLE_CLOUD_PROJECT"
value: "gcloud-devel"
}

env_vars: {
key: "GOOGLE_APPLICATION_CREDENTIALS"
value: "secret_manager/java-it-service-account"
}

env_vars: {
key: "SECRET_MANAGER_KEYS"
value: "java-it-service-account"
}
43 changes: 43 additions & 0 deletions .kokoro/presubmit/bigtable-integration-admin.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Format: //devtools/kokoro/config/proto/build.proto

# Configure the docker image for kokoro-trampoline.
env_vars: {
key: "TRAMPOLINE_IMAGE"
value: "gcr.io/cloud-devrel-kokoro-resources/java11"
}

env_vars: {
key: "INTEGRATION_TEST_ARGS"
value: "-P bigtable-admin-it -Dbigtable.project=gcloud-devel -Dbigtable.instance=google-cloud-bigtable -Dbigtable.table=integration-tests -Dbigtable.kms_key_name=projects/gcloud-devel/locations/us-east1/keyRings/cmek-test-key-ring/cryptoKeys/cmek-test-key -Dbigtable.wait-for-cmek-key-status=true"
}

env_vars: {
key: "JOB_TYPE"
value: "integration-single"
}

# TODO: remove this after we've migrated all tests and scripts
env_vars: {
key: "GCLOUD_PROJECT"
value: "gcloud-devel"
}

env_vars: {
key: "GOOGLE_CLOUD_PROJECT"
value: "gcloud-devel"
}

env_vars: {
key: "GOOGLE_APPLICATION_CREDENTIALS"
value: "secret_manager/java-it-service-account"
}

env_vars: {
key: "SECRET_MANAGER_KEYS"
value: "java-it-service-account"
}

env_vars: {
key: "BUILD_SUBDIR"
value: "java-bigtable"
}
43 changes: 43 additions & 0 deletions .kokoro/presubmit/bigtable-integration-cfe.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Format: //devtools/kokoro/config/proto/build.proto

# Configure the docker image for kokoro-trampoline.
env_vars: {
key: "TRAMPOLINE_IMAGE"
value: "gcr.io/cloud-devrel-kokoro-resources/java11"
}

env_vars: {
key: "INTEGRATION_TEST_ARGS"
value: "-P bigtable-cfe-it,enable-verbose-grpc-logs -Dbigtable.project=gcloud-devel -Dbigtable.instance=google-cloud-bigtable -Dbigtable.table=integration-tests"
}

env_vars: {
key: "JOB_TYPE"
value: "integration-single"
}

# TODO: remove this after we've migrated all tests and scripts
env_vars: {
key: "GCLOUD_PROJECT"
value: "gcloud-devel"
}

env_vars: {
key: "GOOGLE_CLOUD_PROJECT"
value: "gcloud-devel"
}

env_vars: {
key: "GOOGLE_APPLICATION_CREDENTIALS"
value: "secret_manager/java-it-service-account"
}

env_vars: {
key: "SECRET_MANAGER_KEYS"
value: "java-it-service-account"
}

env_vars: {
key: "BUILD_SUBDIR"
value: "java-bigtable"
}
43 changes: 43 additions & 0 deletions .kokoro/presubmit/bigtable-integration-session-dp.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Format: //devtools/kokoro/config/proto/build.proto

# Configure the docker image for kokoro-trampoline.
env_vars: {
key: "TRAMPOLINE_IMAGE"
value: "gcr.io/cloud-devrel-kokoro-resources/java11"
}

env_vars: {
key: "INTEGRATION_TEST_ARGS"
value: "-P bigtable-directpath-it,bigtable-session-it,enable-verbose-grpc-logs -Dbigtable.project=gcloud-devel -Dbigtable.instance=google-cloud-bigtable-session -Dbigtable.table=integration-tests"
}

env_vars: {
key: "JOB_TYPE"
value: "integration-single"
}

# TODO: remove this after we've migrated all tests and scripts
env_vars: {
key: "GCLOUD_PROJECT"
value: "gcloud-devel"
}

env_vars: {
key: "GOOGLE_CLOUD_PROJECT"
value: "gcloud-devel"
}

env_vars: {
key: "GOOGLE_APPLICATION_CREDENTIALS"
value: "secret_manager/java-it-service-account"
}

env_vars: {
key: "SECRET_MANAGER_KEYS"
value: "java-it-service-account"
}

env_vars: {
key: "BUILD_SUBDIR"
value: "java-bigtable"
}
2 changes: 1 addition & 1 deletion .kokoro/presubmit/bigtable-integration.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ env_vars: {

env_vars: {
key: "INTEGRATION_TEST_ARGS"
value: "-P bigtable-prod-it,enable-verbose-grpc-logs -Dbigtable.project=gcloud-devel -Dbigtable.instance=google-cloud-bigtable -Dbigtable.table=integration-tests -Dbigtable.kms_key_name=projects/gcloud-devel/locations/us-east1/keyRings/cmek-test-key-ring/cryptoKeys/cmek-test-key -Dbigtable.wait-for-cmek-key-status=true"
value: "-P bigtable-prod-it,enable-verbose-grpc-logs -Dbigtable.project=gcloud-devel -Dbigtable.instance=google-cloud-bigtable -Dbigtable.table=integration-tests"
}

env_vars: {
Expand Down
93 changes: 81 additions & 12 deletions java-bigtable/google-cloud-bigtable/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,6 @@
<profile>
<id>enable-verbose-grpc-logs</id>
<properties>
<bigtable.enable-grpc-logs>true</bigtable.enable-grpc-logs>
<java-log-config>src/test/resources/logging-verbose.properties</java-log-config>
</properties>
<build>
Expand Down Expand Up @@ -527,8 +526,6 @@

<systemPropertyVariables>
<bigtable.env>emulator</bigtable.env>
<bigtable.enable-grpc-logs>${bigtable.enable-grpc-logs}</bigtable.enable-grpc-logs>
<bigtable.grpc-log-dir>${project.build.directory}/test-grpc-logs/emulator-it</bigtable.grpc-log-dir>
</systemPropertyVariables>
<includes>
<include>com.google.cloud.bigtable.**.it.*IT</include>
Expand All @@ -543,6 +540,41 @@
</build>
</profile>

<profile>
<id>bigtable-admin-it</id>
<build>
<plugins>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
<id>admin-it</id>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<configuration>
<skip>false</skip>

<systemPropertyVariables>
<bigtable.env>cloud</bigtable.env>
<bigtable.data-endpoint>${bigtable.cfe-data-endpoint}</bigtable.data-endpoint>
<bigtable.admin-endpoint>${bigtable.cfe-admin-endpoint}</bigtable.admin-endpoint>
<bigtable.data-jwt-audience>${bigtable.cfe-jwt-audience}</bigtable.data-jwt-audience>
</systemPropertyVariables>
<includes>
<include>com.google.cloud.bigtable.admin.v2.it.*IT</include>
</includes>
<summaryFile>${project.build.directory}/failsafe-reports/failsafe-summary-admin-it.xml</summaryFile>
<reportsDirectory>${project.build.directory}/failsafe-reports/admin-it</reportsDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>

<profile>
<id>bigtable-prod-it</id>
<build>
Expand All @@ -564,11 +596,9 @@
<bigtable.data-endpoint>${bigtable.cfe-data-endpoint}</bigtable.data-endpoint>
<bigtable.admin-endpoint>${bigtable.cfe-admin-endpoint}</bigtable.admin-endpoint>
<bigtable.data-jwt-audience>${bigtable.cfe-jwt-audience}</bigtable.data-jwt-audience>
<bigtable.enable-grpc-logs>${bigtable.enable-grpc-logs}</bigtable.enable-grpc-logs>
<bigtable.grpc-log-dir>${project.build.directory}/test-grpc-logs/prod-it</bigtable.grpc-log-dir>
</systemPropertyVariables>
<includes>
<include>com.google.cloud.bigtable.**.it.*IT</include>
<include>com.google.cloud.bigtable.data.v2.it.*IT</include>
</includes>
<summaryFile>${project.build.directory}/failsafe-reports/failsafe-summary-prod-it.xml</summaryFile>
<reportsDirectory>${project.build.directory}/failsafe-reports/prod-it</reportsDirectory>
Expand Down Expand Up @@ -608,8 +638,6 @@
<bigtable.data-endpoint>${bigtable.directpath-data-endpoint}</bigtable.data-endpoint>
<bigtable.admin-endpoint>${bigtable.directpath-admin-endpoint}</bigtable.admin-endpoint>
<bigtable.data-jwt-audience>${bigtable.directpath-jwt-audience}</bigtable.data-jwt-audience>
<bigtable.enable-grpc-logs>${bigtable.enable-grpc-logs}</bigtable.enable-grpc-logs>
<bigtable.grpc-log-dir>${project.build.directory}/test-grpc-logs/directpath-it</bigtable.grpc-log-dir>
<bigtable.connection-mode>REQUIRE_DIRECT_PATH</bigtable.connection-mode>
</systemPropertyVariables>
<environmentVariables>
Expand Down Expand Up @@ -650,8 +678,6 @@
<bigtable.data-endpoint>${bigtable.cfe-data-endpoint}</bigtable.data-endpoint>
<bigtable.admin-endpoint>${bigtable.cfe-admin-endpoint}</bigtable.admin-endpoint>
<bigtable.data-jwt-audience>${bigtable.cfe-jwt-audience}</bigtable.data-jwt-audience>
<bigtable.enable-grpc-logs>${bigtable.enable-grpc-logs}</bigtable.enable-grpc-logs>
<bigtable.grpc-log-dir>${project.build.directory}/test-grpc-logs/cfe-it</bigtable.grpc-log-dir>
<bigtable.connection-mode>REQUIRE_CFE</bigtable.connection-mode>
</systemPropertyVariables>
<includes>
Expand Down Expand Up @@ -689,8 +715,6 @@
<bigtable.data-endpoint>${bigtable.directpath-data-endpoint}</bigtable.data-endpoint>
<bigtable.admin-endpoint>${bigtable.directpath-admin-endpoint}</bigtable.admin-endpoint>
<bigtable.data-jwt-audience>${bigtable.directpath-jwt-audience}</bigtable.data-jwt-audience>
<bigtable.enable-grpc-logs>${bigtable.enable-grpc-logs}</bigtable.enable-grpc-logs>
<bigtable.grpc-log-dir>${project.build.directory}/test-grpc-logs/directpath-ipv4only-it</bigtable.grpc-log-dir>
<bigtable.connection-mode>REQUIRE_DIRECT_PATH_IPV4</bigtable.connection-mode>
</systemPropertyVariables>
<environmentVariables>
Expand Down Expand Up @@ -818,6 +842,51 @@
</configuration>
</plugin>

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<!--
Cleans up stale test resources (>24h old) in the configured shared Bigtable instance
and orphaned test instances in the project via CloudEnv.
Invoke with: mvn test-compile exec:java@cleanup-stale-resources ...
Required system properties:
-Dbigtable.project=<project-id>
-Dbigtable.instance=<instance-id>
-Dbigtable.table=<table-id>
Optional system properties (consistent with Failsafe IT profiles):
-Dbigtable.cfe-admin-endpoint=<host:port> (defaults to client default: bigtableadmin.googleapis.com:443)
-Dbigtable.cfe-data-endpoint=<host:port> (defaults to client default: bigtable.googleapis.com:443)
-Dbigtable.cfe-jwt-audience=<audience> (defaults to client default)
-->
<execution>
<id>cleanup-stale-resources</id>
<configuration>
<mainClass>com.google.cloud.bigtable.test_helpers.env.StaleResourceCleaner</mainClass>
<classpathScope>test</classpathScope>
<systemProperties>
<systemProperty>
<key>java.util.logging.config.file</key>
<value>${java-log-config}</value>
</systemProperty>
<systemProperty>
<key>bigtable.data-endpoint</key>
<value>${bigtable.cfe-data-endpoint}</value>
</systemProperty>
<systemProperty>
<key>bigtable.admin-endpoint</key>
<value>${bigtable.cfe-admin-endpoint}</value>
</systemProperty>
<systemProperty>
<key>bigtable.data-jwt-audience</key>
<value>${bigtable.cfe-jwt-audience}</value>
</systemProperty>
</systemProperties>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
Expand Down
Loading
Loading