Skip to content

Commit

Permalink
chore: update common templates (googleapis#119)
Browse files Browse the repository at this point in the history
* build(java): fix retry_with_backoff when -e option set (googleapis#475)

Source-Author: Jeff Ching <chingor@google.com>
Source-Date: Wed Apr 8 14:01:08 2020 -0700
Source-Repo: googleapis/synthtool
Source-Sha: bd69a2aa7b70875f3c988e269706b22fefbef40e
Source-Link: googleapis/synthtool@bd69a2a

* build(java): fix nightly integration test config to run integrations (googleapis#465)

This was only running the units.

Source-Author: Jeff Ching <chingor@google.com>
Source-Date: Wed Apr 8 14:06:04 2020 -0700
Source-Repo: googleapis/synthtool
Source-Sha: c7e0e517d7f46f77bebd27da2e5afcaa6eee7e25
Source-Link: googleapis/synthtool@c7e0e51

* ci: add dependency list completeness check (googleapis#490)

Source-Author: Stephanie Wang <stephaniewang526@users.noreply.github.com>
Source-Date: Mon Apr 13 18:30:27 2020 -0400
Source-Repo: googleapis/synthtool
Source-Sha: 3df869dd6eb546ef13beeb7a9efa6ee0226afafd
Source-Link: googleapis/synthtool@3df869d

* build(java): set GOOGLE_CLOUD_PROJECT env for samples/integration tests (googleapis#484)

* build(java): set GOOGLE_CLOUD_PROJECT env variable for samples/integration tests

* ci: use java-docs-samples-testing for sample tests

Source-Author: Jeff Ching <chingor@google.com>
Source-Date: Mon Apr 13 16:24:21 2020 -0700
Source-Repo: googleapis/synthtool
Source-Sha: 52638600f387deb98efb5f9c85fec39e82aa9052
Source-Link: googleapis/synthtool@5263860
  • Loading branch information
yoshi-automation committed May 12, 2020
1 parent bc6a7f3 commit 839e4dc
Show file tree
Hide file tree
Showing 7 changed files with 120 additions and 13 deletions.
19 changes: 17 additions & 2 deletions .kokoro/common.sh
Expand Up @@ -13,18 +13,28 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# set -eo pipefail

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
echo "${command}"
${command}
exit_code=$?

# restore "e" flag
if [[ ${flags} =~ e ]]
then set -e
else set +e
fi

if [[ $exit_code == 0 ]]
then
return 0
Expand All @@ -42,3 +52,8 @@ function retry_with_backoff {

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) $*"; }
48 changes: 48 additions & 0 deletions .kokoro/dependencies.sh
Expand Up @@ -36,3 +36,51 @@ retry_with_backoff 3 10 \
-Dclirr.skip=true

mvn -B dependency:analyze -DfailOnWarning=true

echo "****************** DEPENDENCY LIST COMPLETENESS CHECK *******************"
## Run dependency list completeness check
function completenessCheck() {
# Output dep list with compile scope generated using the original pom
msg "Generating dependency list using original pom..."
mvn dependency:list -f pom.xml -Dsort=true | grep '\[INFO] .*:.*:.*:.*:.*' | grep -v ':test$' >.org-list.txt

# Output dep list generated using the flattened pom (test scope deps are ommitted)
msg "Generating dependency list using flattened pom..."
mvn dependency:list -f .flattened-pom.xml -Dsort=true | grep '\[INFO] .*:.*:.*:.*:.*' >.new-list.txt

# Compare two dependency lists
msg "Comparing dependency lists..."
diff .org-list.txt .new-list.txt >.diff.txt
if [[ $? == 0 ]]
then
msg "Success. No diff!"
else
msg "Diff found. See below: "
msg "You can also check .diff.txt file located in $1."
cat .diff.txt
return 1
fi
}

# Allow failures to continue running the script
set +e

error_count=0
for path in $(find -name ".flattened-pom.xml")
do
# Check flattened pom in each dir that contains it for completeness
dir=$(dirname "$path")
pushd "$dir"
completenessCheck "$dir"
error_count=$(($error_count + $?))
popd
done

if [[ $error_count == 0 ]]
then
msg "All checks passed."
exit 0
else
msg "Errors found. See log statements above."
exit 1
fi
20 changes: 20 additions & 0 deletions .kokoro/nightly/integration.cfg
Expand Up @@ -6,11 +6,31 @@ env_vars: {
value: "gcr.io/cloud-devrel-kokoro-resources/java8"
}

env_vars: {
key: "JOB_TYPE"
value: "integration"
}
# 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: "ENABLE_BUILD_COP"
value: "true"
}

env_vars: {
key: "GOOGLE_APPLICATION_CREDENTIALS"
value: "keystore/73713_java_it_service_account"
}

before_action {
fetch_keystore {
keystore_resource {
Expand Down
8 changes: 7 additions & 1 deletion .kokoro/nightly/samples.cfg
Expand Up @@ -11,9 +11,15 @@ env_vars: {
value: "samples"
}

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

env_vars: {
key: "GOOGLE_CLOUD_PROJECT"
value: "java-docs-samples-testing"
}

env_vars: {
Expand Down
14 changes: 10 additions & 4 deletions .kokoro/presubmit/integration.cfg
Expand Up @@ -11,14 +11,20 @@ env_vars: {
value: "integration"
}

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

env_vars: {
key: "GOOGLE_APPLICATION_CREDENTIALS"
value: "keystore/73713_java_it_service_account"
key: "GOOGLE_CLOUD_PROJECT"
value: "gcloud-devel"
}

env_vars: {
key: "GOOGLE_APPLICATION_CREDENTIALS"
value: "keystore/73713_java_it_service_account"
}

before_action {
Expand Down
14 changes: 10 additions & 4 deletions .kokoro/presubmit/samples.cfg
Expand Up @@ -11,14 +11,20 @@ env_vars: {
value: "samples"
}

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

env_vars: {
key: "GOOGLE_APPLICATION_CREDENTIALS"
value: "keystore/73713_java_it_service_account"
key: "GOOGLE_CLOUD_PROJECT"
value: "java-docs-samples-testing"
}

env_vars: {
key: "GOOGLE_APPLICATION_CREDENTIALS"
value: "keystore/73713_java_it_service_account"
}

before_action {
Expand Down
10 changes: 8 additions & 2 deletions synth.metadata
@@ -1,11 +1,17 @@
{
"updateTime": "2020-03-25T23:36:35.815671Z",
"sources": [
{
"git": {
"name": ".",
"remote": "https://github.com/googleapis/java-spanner-jdbc.git",
"sha": "a8caef202d88e497c474a69eb7abe0b4096a1b0e"
}
},
{
"git": {
"name": "synthtool",
"remote": "https://github.com/googleapis/synthtool.git",
"sha": "e36822bfa0acb355502dab391b8ef9c4f30208d8"
"sha": "52638600f387deb98efb5f9c85fec39e82aa9052"
}
}
]
Expand Down

0 comments on commit 839e4dc

Please sign in to comment.