From 014f5f558b74497b0e803eb4871b3dcba98a4270 Mon Sep 17 00:00:00 2001 From: Jeff Ching Date: Thu, 17 Oct 2019 09:59:22 -0700 Subject: [PATCH 1/3] feat(java): process sponge logs after tests --- .../templates/java_library/.kokoro/build.sh | 2 ++ .../java_library/.kokoro/coerce_logs.sh | 35 +++++++++++++++++++ .../.kokoro/continuous/common.cfg | 1 + .../java_library/.kokoro/nightly/common.cfg | 1 + .../java_library/.kokoro/presubmit/common.cfg | 1 + 5 files changed, 40 insertions(+) create mode 100755 synthtool/gcp/templates/java_library/.kokoro/coerce_logs.sh diff --git a/synthtool/gcp/templates/java_library/.kokoro/build.sh b/synthtool/gcp/templates/java_library/.kokoro/build.sh index 2ffb5ef7f..bcd1e410c 100755 --- a/synthtool/gcp/templates/java_library/.kokoro/build.sh +++ b/synthtool/gcp/templates/java_library/.kokoro/build.sh @@ -39,6 +39,7 @@ case ${JOB_TYPE} in test) mvn test -B bash ${KOKORO_GFILE_DIR}/codecov.sh + bash .kokoro/coerce_logs.sh ;; lint) mvn com.coveo:fmt-maven-plugin:check @@ -48,6 +49,7 @@ javadoc) ;; integration) mvn -B ${INTEGRATION_TEST_ARGS} -DtrimStackTrace=false -fae verify + bash .kokoro/coerce_logs.sh ;; *) ;; diff --git a/synthtool/gcp/templates/java_library/.kokoro/coerce_logs.sh b/synthtool/gcp/templates/java_library/.kokoro/coerce_logs.sh new file mode 100755 index 000000000..c5b9c8357 --- /dev/null +++ b/synthtool/gcp/templates/java_library/.kokoro/coerce_logs.sh @@ -0,0 +1,35 @@ +#!/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}/.. + +echo "coercing sponge logs..." +for xml in `find . -name *-sponge_log.xml` +do + echo "processing ${xml}" + class=$(basename ${xml} | cut -d- -f2) + dir=$(dirname ${xml})/${class} + text=$(dirname ${xml})/${class}-sponge_log.txt + mkdir -p ${dir} + mv ${xml} ${dir}/sponge_log.xml + mv ${text} ${dir}/sponge_log.txt +done \ No newline at end of file diff --git a/synthtool/gcp/templates/java_library/.kokoro/continuous/common.cfg b/synthtool/gcp/templates/java_library/.kokoro/continuous/common.cfg index 83a933974..82120d848 100644 --- a/synthtool/gcp/templates/java_library/.kokoro/continuous/common.cfg +++ b/synthtool/gcp/templates/java_library/.kokoro/continuous/common.cfg @@ -4,6 +4,7 @@ action { define_artifacts { regex: "**/*sponge_log.xml" + regex: "**/*sponge_log.txt" } } diff --git a/synthtool/gcp/templates/java_library/.kokoro/nightly/common.cfg b/synthtool/gcp/templates/java_library/.kokoro/nightly/common.cfg index 83a933974..82120d848 100644 --- a/synthtool/gcp/templates/java_library/.kokoro/nightly/common.cfg +++ b/synthtool/gcp/templates/java_library/.kokoro/nightly/common.cfg @@ -4,6 +4,7 @@ action { define_artifacts { regex: "**/*sponge_log.xml" + regex: "**/*sponge_log.txt" } } diff --git a/synthtool/gcp/templates/java_library/.kokoro/presubmit/common.cfg b/synthtool/gcp/templates/java_library/.kokoro/presubmit/common.cfg index 2413d561b..dd7dfe0ce 100644 --- a/synthtool/gcp/templates/java_library/.kokoro/presubmit/common.cfg +++ b/synthtool/gcp/templates/java_library/.kokoro/presubmit/common.cfg @@ -4,6 +4,7 @@ action { define_artifacts { regex: "**/*sponge_log.xml" + regex: "**/*sponge_log.txt" } } From a97940091047c70ab91820b73f5d6199a87aab2e Mon Sep 17 00:00:00 2001 From: Jeff Ching Date: Thu, 17 Oct 2019 10:13:07 -0700 Subject: [PATCH 2/3] fix: header format --- synthtool/gcp/templates/java_library/.kokoro/coerce_logs.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/synthtool/gcp/templates/java_library/.kokoro/coerce_logs.sh b/synthtool/gcp/templates/java_library/.kokoro/coerce_logs.sh index c5b9c8357..4b2171e54 100755 --- a/synthtool/gcp/templates/java_library/.kokoro/coerce_logs.sh +++ b/synthtool/gcp/templates/java_library/.kokoro/coerce_logs.sh @@ -1,4 +1,5 @@ -#!/bin/bash# Copyright 2019 Google LLC +#!/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. @@ -32,4 +33,4 @@ do mkdir -p ${dir} mv ${xml} ${dir}/sponge_log.xml mv ${text} ${dir}/sponge_log.txt -done \ No newline at end of file +done From 48e292892c21c80086078e5e5f87f5833b2e5ddc Mon Sep 17 00:00:00 2001 From: Jeff Ching Date: Thu, 17 Oct 2019 10:13:46 -0700 Subject: [PATCH 3/3] fix: header format --- .../java_library/.kokoro/coerce_logs.sh | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/synthtool/gcp/templates/java_library/.kokoro/coerce_logs.sh b/synthtool/gcp/templates/java_library/.kokoro/coerce_logs.sh index 4b2171e54..429767ab6 100755 --- a/synthtool/gcp/templates/java_library/.kokoro/coerce_logs.sh +++ b/synthtool/gcp/templates/java_library/.kokoro/coerce_logs.sh @@ -1,17 +1,17 @@ #!/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. +# +# 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.