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