-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
copy/paste all kokoro scripts from java-logging-logback. replace the repo name in all .sh and .cfg
- Loading branch information
Showing
48 changed files
with
1,364 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
:: See documentation in type-shell-output.bat | ||
|
||
"C:\Program Files\Git\bin\bash.exe" %~dp0build.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,129 @@ | ||
#!/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}/.. | ||
|
||
# include common functions | ||
source ${scriptDir}/common.sh | ||
|
||
# Print out Maven & Java version | ||
mvn -version | ||
echo ${JOB_TYPE} | ||
|
||
# attempt to install 3 times with exponential backoff (starting with 10 seconds) | ||
retry_with_backoff 3 10 \ | ||
mvn install -B -V -ntp \ | ||
-DskipTests=true \ | ||
-Dclirr.skip=true \ | ||
-Denforcer.skip=true \ | ||
-Dmaven.javadoc.skip=true \ | ||
-Dgcloud.download.skip=true \ | ||
-T 1C | ||
|
||
# if GOOGLE_APPLICATION_CREDENTIALS is specified as a relative path, prepend Kokoro root directory onto it | ||
if [[ ! -z "${GOOGLE_APPLICATION_CREDENTIALS}" && "${GOOGLE_APPLICATION_CREDENTIALS}" != /* ]]; then | ||
export GOOGLE_APPLICATION_CREDENTIALS=$(realpath ${KOKORO_GFILE_DIR}/${GOOGLE_APPLICATION_CREDENTIALS}) | ||
fi | ||
|
||
RETURN_CODE=0 | ||
set +e | ||
|
||
case ${JOB_TYPE} in | ||
test) | ||
mvn test -B -Dclirr.skip=true -Denforcer.skip=true | ||
RETURN_CODE=$? | ||
;; | ||
lint) | ||
mvn com.coveo:fmt-maven-plugin:check | ||
RETURN_CODE=$? | ||
;; | ||
javadoc) | ||
mvn javadoc:javadoc javadoc:test-javadoc | ||
RETURN_CODE=$? | ||
;; | ||
integration) | ||
mvn -B ${INTEGRATION_TEST_ARGS} \ | ||
-ntp \ | ||
-Penable-integration-tests \ | ||
-DtrimStackTrace=false \ | ||
-Dclirr.skip=true \ | ||
-Denforcer.skip=true \ | ||
-fae \ | ||
verify | ||
RETURN_CODE=$? | ||
;; | ||
graalvm) | ||
# Run Unit and Integration Tests with Native Image | ||
mvn test -Pnative -Penable-integration-tests | ||
RETURN_CODE=$? | ||
;; | ||
samples) | ||
SAMPLES_DIR=samples | ||
# only run ITs in snapshot/ on presubmit PRs. run ITs in all 3 samples/ subdirectories otherwise. | ||
if [[ ! -z ${KOKORO_GITHUB_PULL_REQUEST_NUMBER} ]] | ||
then | ||
SAMPLES_DIR=samples/snapshot | ||
fi | ||
|
||
if [[ -f ${SAMPLES_DIR}/pom.xml ]] | ||
then | ||
for FILE in ${KOKORO_GFILE_DIR}/secret_manager/*-samples-secrets; do | ||
[[ -f "$FILE" ]] || continue | ||
source "$FILE" | ||
done | ||
|
||
pushd ${SAMPLES_DIR} | ||
mvn -B \ | ||
-ntp \ | ||
-DtrimStackTrace=false \ | ||
-Dclirr.skip=true \ | ||
-Denforcer.skip=true \ | ||
-fae \ | ||
verify | ||
RETURN_CODE=$? | ||
popd | ||
else | ||
echo "no sample pom.xml found - skipping sample tests" | ||
fi | ||
;; | ||
clirr) | ||
mvn -B -Denforcer.skip=true clirr:check | ||
RETURN_CODE=$? | ||
;; | ||
*) | ||
;; | ||
esac | ||
|
||
if [ "${REPORT_COVERAGE}" == "true" ] | ||
then | ||
bash ${KOKORO_GFILE_DIR}/codecov.sh | ||
fi | ||
|
||
# fix output location of logs | ||
bash .kokoro/coerce_logs.sh | ||
|
||
if [[ "${ENABLE_FLAKYBOT}" == "true" ]] | ||
then | ||
chmod +x ${KOKORO_GFILE_DIR}/linux_amd64/flakybot | ||
${KOKORO_GFILE_DIR}/linux_amd64/flakybot -repo=googleapis/java-logging-servlet-initializer | ||
fi | ||
|
||
echo "exiting with ${RETURN_CODE}" | ||
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,37 @@ | ||
#!/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. | ||
|
||
# This script finds and moves sponge logs so that they can be found by placer | ||
# and are not flagged as flaky by sponge. | ||
|
||
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}/.. | ||
|
||
job=$(basename ${KOKORO_JOB_NAME}) | ||
|
||
echo "coercing sponge logs..." | ||
for xml in `find . -name *-sponge_log.xml` | ||
do | ||
class=$(basename ${xml} | cut -d- -f2) | ||
dir=$(dirname ${xml})/${job}/${class} | ||
text=$(dirname ${xml})/${class}-sponge_log.txt | ||
mkdir -p ${dir} | ||
mv ${xml} ${dir}/sponge_log.xml | ||
mv ${text} ${dir}/sponge_log.txt | ||
done |
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,13 @@ | ||
# Format: //devtools/kokoro/config/proto/build.proto | ||
|
||
# Download trampoline resources. These will be in ${KOKORO_GFILE_DIR} | ||
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" | ||
|
||
# All builds use the trampoline script to run in docker. | ||
build_file: "java-logging-servlet-initializer/.kokoro/trampoline.sh" | ||
|
||
# Tell the trampoline which build file to use. | ||
env_vars: { | ||
key: "TRAMPOLINE_BUILD_FILE" | ||
value: "github/java-logging-servlet-initializer/.kokoro/build.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,58 @@ | ||
#!/bin/bash | ||
# Copyright 2020 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. | ||
|
||
function retry_with_backoff { | ||
attempts_left=$1 | ||
sleep_seconds=$2 | ||
shift 2 | ||
command=$@ | ||
|
||
|
||
# store current flag state | ||
flags=$- | ||
|
||
# allow a failures to continue | ||
set +e | ||
${command} | ||
exit_code=$? | ||
|
||
# restore "e" flag | ||
if [[ ${flags} =~ e ]] | ||
then set -e | ||
else set +e | ||
fi | ||
|
||
if [[ $exit_code == 0 ]] | ||
then | ||
return 0 | ||
fi | ||
|
||
# failure | ||
if [[ ${attempts_left} > 0 ]] | ||
then | ||
echo "failure (${exit_code}), sleeping ${sleep_seconds}..." | ||
sleep ${sleep_seconds} | ||
new_attempts=$((${attempts_left} - 1)) | ||
new_sleep=$((${sleep_seconds} * 2)) | ||
retry_with_backoff ${new_attempts} ${new_sleep} ${command} | ||
fi | ||
|
||
return $exit_code | ||
} | ||
|
||
## Helper functionss | ||
function now() { date +"%Y-%m-%d %H:%M:%S" | tr -d '\n'; } | ||
function msg() { println "$*" >&2; } | ||
function println() { printf '%s\n' "$(now) $*"; } |
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 @@ | ||
# Format: //devtools/kokoro/config/proto/build.proto | ||
|
||
# Build logs will be here | ||
action { | ||
define_artifacts { | ||
regex: "**/*sponge_log.xml" | ||
regex: "**/*sponge_log.txt" | ||
} | ||
} | ||
|
||
# Download trampoline resources. | ||
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" | ||
|
||
# Use the trampoline script to run in docker. | ||
build_file: "java-logging-servlet-initializer/.kokoro/trampoline.sh" | ||
|
||
env_vars: { | ||
key: "TRAMPOLINE_BUILD_FILE" | ||
value: "github/java-logging-servlet-initializer/.kokoro/build.sh" | ||
} | ||
|
||
env_vars: { | ||
key: "JOB_TYPE" | ||
value: "test" | ||
} |
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,12 @@ | ||
# 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/java8" | ||
} | ||
|
||
env_vars: { | ||
key: "REPORT_COVERAGE" | ||
value: "true" | ||
} |
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,29 @@ | ||
#!/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 | ||
# | ||
# https://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 | ||
|
||
export NPM_CONFIG_PREFIX=/home/node/.npm-global | ||
|
||
if [ -f ${KOKORO_KEYSTORE_DIR}/73713_github-magic-proxy-url-release-please ]; then | ||
# Groom the release PR as new commits are merged. | ||
npx release-please release-pr --token=${KOKORO_KEYSTORE_DIR}/73713_github-magic-proxy-token-release-please \ | ||
--repo-url=googleapis/java-logging-servlet-initializer \ | ||
--package-name="logging-logback" \ | ||
--api-url=${KOKORO_KEYSTORE_DIR}/73713_github-magic-proxy-url-release-please \ | ||
--proxy-key=${KOKORO_KEYSTORE_DIR}/73713_github-magic-proxy-key-release-please \ | ||
--release-type=java-yoshi | ||
fi |
Oops, something went wrong.