-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: Add downstream native image testing (#1247)
* ci: Add downstream native image testing * ci: Parameterize MODULES_UNDER_TEST in .kokoro/presubmit/common.cfg
- Loading branch information
1 parent
8624f7d
commit 41c45b1
Showing
5 changed files
with
149 additions
and
6 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Format: //devtools/kokoro/config/proto/build.proto | ||
|
||
env_vars: { | ||
key: "TRAMPOLINE_BUILD_FILE" | ||
value: "github/gapic-generator-java/.kokoro/presubmit/downstream-build.sh" | ||
} | ||
|
||
# TODO: remove this after we've migrated all tests and scripts | ||
env_vars: { | ||
key: "GCLOUD_PROJECT" | ||
value: "cloud-java-ci-test" | ||
} | ||
|
||
env_vars: { | ||
key: "GOOGLE_CLOUD_PROJECT" | ||
value: "cloud-java-ci-test" | ||
} | ||
|
||
env_vars: { | ||
key: "GOOGLE_APPLICATION_CREDENTIALS" | ||
value: "secret_manager/cloud-java-ci-it-service-account" | ||
} | ||
|
||
env_vars: { | ||
key: "SECRET_MANAGER_KEYS" | ||
value: "cloud-java-ci-it-service-account" | ||
} | ||
|
||
# Defines the google-cloud-java modules to be tested downstream tested with GraalVM native image | ||
# builds. | ||
env_vars: { | ||
key: "MODULES_UNDER_TEST" | ||
value: "java-os-login,java-asset" # OS login's ITSystemTest exercises gax-java's native image | ||
# reflect-config.json. | ||
# Asset not required - added only as a sanity check. | ||
} |
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,99 @@ | ||
#!/bin/bash | ||
# Copyright 2019 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}/.." | ||
|
||
if [ -z "${MODULES_UNDER_TEST}" ]; then | ||
echo "MODULES_UNDER_TEST must be set to run downstream-build.sh" | ||
exit 1 | ||
fi | ||
|
||
# Use GCP Maven Mirror | ||
mkdir -p "${HOME}/.m2" | ||
cp settings.xml "${HOME}/.m2" | ||
|
||
### Round 1 | ||
# Publish this repo's modules to local maven to make them available for downstream libraries | ||
mvn -B -ntp install --projects '!gapic-generator-java' \ | ||
-Dcheckstyle.skip -Dfmt.skip -DskipTests | ||
|
||
# Read current BOM version | ||
GAPIC_BOM_VERSION=$(sed -e 's/xmlns=".*"//' gapic-generator-java-bom/pom.xml | xmllint --xpath '/project/version/text()' -) | ||
|
||
### Round 2 | ||
# Run the updated GAPIC BOM against HEAD of java-shared-dependencies | ||
git clone "https://github.com/googleapis/java-shared-dependencies.git" --depth=1 | ||
pushd java-shared-dependencies/first-party-dependencies | ||
|
||
# Replace GAPIC BOM version | ||
xmllint --shell pom.xml <<EOF | ||
setns x=http://maven.apache.org/POM/4.0.0 | ||
cd .//x:artifactId[text()="gapic-generator-java-bom"] | ||
cd ../x:version | ||
set ${GAPIC_BOM_VERSION} | ||
save pom.xml | ||
EOF | ||
|
||
echo "Modifications to java-shared-dependencies:" | ||
git diff | ||
echo | ||
|
||
cd .. | ||
mvn verify install -B -V -ntp -fae \ | ||
-DskipTests=true \ | ||
-Dmaven.javadoc.skip=true \ | ||
-Dgcloud.download.skip=true \ | ||
-Denforcer.skip=true | ||
|
||
# Namespace (xmlns) prevents xmllint from specifying tag names in XPath | ||
SHARED_DEPS_VERSION=$(sed -e 's/xmlns=".*"//' pom.xml | xmllint --xpath '/project/version/text()' -) | ||
|
||
if [ -z "${SHARED_DEPS_VERSION}" ]; then | ||
echo "Shared dependencies version is not found in pom.xml" | ||
exit 1 | ||
fi | ||
popd | ||
|
||
### Round 3 | ||
# Run the updated java-shared-dependencies BOM against google-cloud-java | ||
git clone "https://github.com/googleapis/google-cloud-java.git" --depth=1 | ||
pushd google-cloud-java/google-cloud-jar-parent | ||
|
||
# Replace java-shared-dependencies version | ||
xmllint --shell pom.xml <<EOF | ||
setns x=http://maven.apache.org/POM/4.0.0 | ||
cd .//x:artifactId[text()="google-cloud-shared-dependencies"] | ||
cd ../x:version | ||
set ${SHARED_DEPS_VERSION} | ||
save pom.xml | ||
EOF | ||
|
||
echo "Modifications to google-cloud-java:" | ||
git diff | ||
echo | ||
|
||
cd .. | ||
source ./.kokoro/common.sh | ||
RETURN_CODE=0 | ||
setup_application_credentials | ||
setup_cloud "$MODULES_UNDER_TEST" | ||
install_modules | ||
run_graalvm_tests "$MODULES_UNDER_TEST" | ||
exit $RETURN_CODE |
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,7 @@ | ||
# 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/graalvm17:22.3.0" | ||
} |
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,7 @@ | ||
# 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/graalvm:22.3.0" | ||
} |