|
| 1 | +#!/bin/bash |
| 2 | +# Copyright 2019 Google LLC |
| 3 | +# |
| 4 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +# you may not use this file except in compliance with the License. |
| 6 | +# You may obtain a copy of the License at |
| 7 | +# |
| 8 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +# |
| 10 | +# Unless required by applicable law or agreed to in writing, software |
| 11 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +# See the License for the specific language governing permissions and |
| 14 | +# limitations under the License. |
| 15 | + |
| 16 | +# This script finds and moves sponge logs so that they can be found by placer |
| 17 | +# and are not flagged as flaky by sponge. |
| 18 | + |
| 19 | +set -eo pipefail |
| 20 | + |
| 21 | +## Get the directory of the build script |
| 22 | +scriptDir=$(realpath $(dirname "${BASH_SOURCE[0]}")) |
| 23 | +## cd to the parent directory, i.e. the root of the git repo |
| 24 | +cd ${scriptDir}/.. |
| 25 | + |
| 26 | +job=$(basename ${KOKORO_JOB_NAME}) |
| 27 | + |
| 28 | +echo "coercing sponge logs..." |
| 29 | +for xml in `find . -name *-sponge_log.xml` |
| 30 | +do |
| 31 | + echo "processing ${xml}" |
| 32 | + class=$(basename ${xml} | cut -d- -f2) |
| 33 | + dir=$(dirname ${xml})/${job}/${class} |
| 34 | + text=$(dirname ${xml})/${class}-sponge_log.txt |
| 35 | + mkdir -p ${dir} |
| 36 | + mv ${xml} ${dir}/sponge_log.xml |
| 37 | + mv ${text} ${dir}/sponge_log.txt |
| 38 | +done |
0 commit comments