Files
impala/bin/jenkins/get_maven_statistics.sh
Joe McDonnell d453d52aad Pin the json-smart version to 2.3
With some maven repositories, Impala builds have been
picking up json-smart with version 2.3-SNAPSHOT. This
is not intentional (and it doesn't reproduce with public
repositories). To improve the consistency of the build,
pin the json-smart version to 2.3 with appropriate
exclusions to prevent alternate versions.

This also fixes up bin/jenkins/get_maven_statistics.sh
to handle cases where maven didn't download anything.

Testing:
 - Ran core job

Change-Id: Iff92a61c9c3164e7e0c63c7569178415dcba9fb4
Reviewed-on: http://gerrit.cloudera.org:8080/16536
Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
Reviewed-by: Joe McDonnell <joemcdonnell@cloudera.com>
2020-10-03 19:58:29 +00:00

51 lines
2.0 KiB
Bash
Executable File

#!/usr/bin/env bash
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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.
# Expect maven log as the first argument.
# There are two requirements for the maven log:
# 1. It needs to be produced by a recent maven version (such as 3.5.4 installed by
# bin/bootstrap_system.sh). This is required because recent maven outputs line like:
# [INFO] Downloading from {repo}: {url}
# [INFO] Downloaded from {repo}: {url}
# Older maven (e.g. 3.3.9) omits the "from {repo}" part.
# 2. Maven needs to run in batch mode (-B). This keeps the output from using special
# characters to format things on the console (e.g. carriage return ^M).
set -euo pipefail
MVN_LOG=$1
# Dump how many artifacts were downloaded from each repo
echo "Number of artifacts downloaded from each repo:"
if grep -q "Downloaded from" "${MVN_LOG}"; then
cat "${MVN_LOG}" | grep "Downloaded from" | sed 's|.* Downloaded from ||' \
| cut -d: -f1 | sort | uniq -c
else
echo "No artifacts downloaded"
fi
# Dump how many artifacts we tried to download from each repo
echo
echo "Number of download attempts (successful or unsuccessful) per repo:"
if grep -q "Downloading from" "${MVN_LOG}"; then
cat "${MVN_LOG}" | grep "Downloading from" | sed 's|.* Downloading from ||' \
| cut -d: -f1 | sort | uniq -c
else
echo "No downloads attempted"
fi