From 40587d8090eac51a3a1cc3a7e8aca0ba9324529b Mon Sep 17 00:00:00 2001 From: James Adams Date: Wed, 6 Nov 2024 15:49:55 +0000 Subject: [PATCH 1/3] releasing: maven-illuminate is no longer needed Modern maven versions now colour their output. --- src/releasing/maven-illuminate.sh | 137 ------------------------------ src/releasing/releaser.sh | 11 ++- 2 files changed, 5 insertions(+), 143 deletions(-) delete mode 100644 src/releasing/maven-illuminate.sh diff --git a/src/releasing/maven-illuminate.sh b/src/releasing/maven-illuminate.sh deleted file mode 100644 index 4f22af4b9d..0000000000 --- a/src/releasing/maven-illuminate.sh +++ /dev/null @@ -1,137 +0,0 @@ -#!/usr/bin/env bash - -# Check for bash (and that we haven't already been sourced). -[ -z "$BASH_VERSION" -o -n "$MAVEN_COLOR_SCRIPT_SOURCED" ] && return - -# Formatting constants -export BRIGHT=`tput bold` -export UNDERLINE_ON=`tput smul` -export UNDERLINE_OFF=`tput rmul` -export TEXT_BLACK=`tput setaf 0` -export TEXT_RED=`tput setaf 1` -export TEXT_GREEN=`tput setaf 2` -export TEXT_YELLOW=`tput setaf 3` -export TEXT_BLUE=`tput setaf 4` -export TEXT_MAGENTA=`tput setaf 5` -export TEXT_CYAN=`tput setaf 6` -export TEXT_WHITE=`tput setaf 7` -export BACKGROUND_BLACK=`tput setab 0` -export BACKGROUND_RED=`tput setab 1` -export BACKGROUND_GREEN=`tput setab 2` -export BACKGROUND_YELLOW=`tput setab 3` -export BACKGROUND_BLUE=`tput setab 4` -export BACKGROUND_MAGENTA=`tput setab 5` -export BACKGROUND_CYAN=`tput setab 6` -export BACKGROUND_WHITE=`tput setab 7` -export RESET_FORMATTING=`tput sgr0` - -# Variables for output colors -export GENERIC_COLOR=${BRIGHT}${TEXT_BLACK} -export HEADER_COLOR=${TEXT_BLUE} -export BASIC_INFO_COLOR=${BRIGHT}${TEXT_BLACK} - -export SUCCESS_COLOR=${BRIGHT}${TEXT_GREEN} -export WARN_COLOR=${BRIGHT}${TEXT_YELLOW} -export FAIL_COLOR=${BRIGHT}${TEXT_RED} -export ERROR_COLOR=${BRIGHT}${TEXT_RED} - -export TEST_RUN_COLOR=${BRIGHT}${TEXT_GREEN} -export TEST_SKIP_COLOR=${BRIGHT}${TEXT_YELLOW} -export TEST_FAIL_COLOR=${BRIGHT}${TEXT_RED} -export TEST_ERROR_COLOR=${BRIGHT}${TEXT_RED} - -# Wrapper function for Maven's mvn command. -mvn-color() -{ - # echo " WARN " | perl -n -e "print if s/(.*\ warn\ .*)/\1/gi" looser matching - # Filter mvn output using sed - mvn $@ | sed -e "s/\(\[INFO\]\ -------.*\)/${HEADER_COLOR}\1${RESET_FORMATTING}/g" \ - -e "s/\(\[INFO\]\ Building\ .*\)/${HEADER_COLOR}\1${RESET_FORMATTING}/g" \ - -e "s/\(^---.*\)/${HEADER_COLOR}\1${RESET_FORMATTING}/g" \ - -e "s/\(^\ T\ E\ S\ T\ S\)/${HEADER_COLOR}\1${RESET_FORMATTING}/g" \ - -e "s/\(^Running .*\)/${BASIC_INFO_COLOR}\1${RESET_FORMATTING}/g" \ - -e "s/\(.*Test.*:.*\.\..*\)/${TEST_FAIL_COLOR}\1${RESET_FORMATTING}/g" \ - -e "s/\(.* test.*:.*\.\..*\)/${TEST_FAIL_COLOR}\1${RESET_FORMATTING}/g" \ - -e "s/\(\[INFO\]\ ---\ .*\)/${BASIC_INFO_COLOR}\1${RESET_FORMATTING}/g" \ - -e "s/\(\[INFO\]\ BUILD\ SUCCESS\)/${SUCCESS_COLOR}\1${RESET_FORMATTING}/g" \ - -e "s/\(\[INFO\]\ BUILD\ FAILURE\)/${FAIL_COLOR}\1${RESET_FORMATTING}/g" \ - -e "s/\(\[INFO\]\ Total\ time:\ .*\)/${HEADER_COLOR}\1${RESET_FORMATTING}/g" \ - -e "s/\(\[INFO\]\ Finished\ at:\ .*\)/${HEADER_COLOR}\1${RESET_FORMATTING}/g" \ - -e "s/\(\[INFO\]\ Final\ Memory:\ .*\)/${HEADER_COLOR}\1${RESET_FORMATTING}/g" \ - -e "s/\(\[WARNING\].*\)/${WARN_COLOR}\1${RESET_FORMATTING}/g" \ - -e "s/\(.*\ WARN\ .*\)/${WARN_COLOR}\1${RESET_FORMATTING}/g" \ - -e "s/\(.*\ warn\ .*\)/${WARN_COLOR}\1${RESET_FORMATTING}/g" \ - -e "s/\(.*\ Warn\ .*\)/${WARN_COLOR}\1${RESET_FORMATTING}/g" \ - -e "s/\(\[ERROR\].*\)/${ERROR_COLOR}\1${RESET_FORMATTING}/g" \ - -e "s/\(.*\ ERROR\ .*\)/${ERROR_COLOR}\1${RESET_FORMATTING}/g" \ - -e "s/\(.*\ error\ .*\)/${ERROR_COLOR}\1${RESET_FORMATTING}/g" \ - -e "s/\(.*\ Error\ .*\)/${ERROR_COLOR}\1${RESET_FORMATTING}/g" \ - -e "s/Tests run: \([^,]*\), Failures: \([^,]*\), Errors: \([^,]*\), Skipped: \([^,]*\), Time elapsed: \([^,]*\)/${GENERIC_COLOR}Tests run: ${RESET_FORMATTING}${TEST_RUN_COLOR}\1${RESET_FORMATTING}${GENERIC_COLOR}, Failures: ${RESET_FORMATTING}${TEST_FAIL_COLOR}\2${RESET_FORMATTING}${GENERIC_COLOR}, Errors: ${RESET_FORMATTING}${TEST_ERROR_COLOR}\3${RESET_FORMATTING}${GENERIC_COLOR}, Skipped: ${RESET_FORMATTING}${TEST_SKIP_COLOR}\4${RESET_FORMATTING}${GENERIC_COLOR}, Time elapsed: \5${RESET_FORMATTING}/g" \ - -e "s/\(.*\)/${GENERIC_COLOR}\1${RESET_FORMATTING}/g" - - # Make sure formatting is reset - echo -ne ${RESET_FORMATTING} -} - -# Wrapper function for Maven's mvn command to reduce verbose output -mvn-color-compact() -{ - # Filter mvn output using sed - mvn $@ | sed -n -e "s/\(\[INFO\]\ -------.*\)/${HEADER_COLOR}\1${RESET_FORMATTING}/gp" \ - -n -e "s/\(\[INFO\]\ Building\ .*\)/${HEADER_COLOR}\1${RESET_FORMATTING}/gp" \ - -n -e "s/\(^---.*\)/${HEADER_COLOR}\1${RESET_FORMATTING}/gp" \ - -n -e "s/\(^\ T\ E\ S\ T\ S\)/${HEADER_COLOR}\1${RESET_FORMATTING}/gp" \ - -n -e "s/\(^Running .*\)/${BASIC_INFO_COLOR}\1${RESET_FORMATTING}/gp" \ - -n -e "s/\(.*Test.*:.*\.\..*\)/${TEST_FAIL_COLOR}\1${RESET_FORMATTING}/gp" \ - -n -e "s/\(.* test.*:.*\.\..*\)/${TEST_FAIL_COLOR}\1${RESET_FORMATTING}/gp" \ - -n -e "s/\(\[INFO\]\ ---\ .*\)/${BASIC_INFO_COLOR}\1${RESET_FORMATTING}/gp" \ - -n -e "s/\(\[INFO\]\ BUILD\ SUCCESS\)/${SUCCESS_COLOR}\1${RESET_FORMATTING}/gp" \ - -n -e "s/\(\[INFO\]\ BUILD\ FAILURE\)/${FAIL_COLOR}\1${RESET_FORMATTING}/gp" \ - -n -e "s/\(\[INFO\]\ Total\ time:\ .*\)/${HEADER_COLOR}\1${RESET_FORMATTING}/gp" \ - -n -e "s/\(\[INFO\]\ Finished\ at:\ .*\)/${HEADER_COLOR}\1${RESET_FORMATTING}/gp" \ - -n -e "s/\(\[INFO\]\ Final\ Memory:\ .*\)/${HEADER_COLOR}\1${RESET_FORMATTING}/gp" \ - -n -e "s/\(\[WARNING\].*\)/${WARN_COLOR}\1${RESET_FORMATTING}/gp" \ - -n -e "s/\(.*\ WARN\ .*\)/${WARN_COLOR}\1${RESET_FORMATTING}/gp" \ - -n -e "s/\(.*\ warn\ .*\)/${WARN_COLOR}\1${RESET_FORMATTING}/gp" \ - -n -e "s/\(.*\ Warn\ .*\)/${WARN_COLOR}\1${RESET_FORMATTING}/gp" \ - -n -e "s/\(\[ERROR\].*\)/${ERROR_COLOR}\1${RESET_FORMATTING}/gp" \ - -n -e "s/\(.*\ ERROR\ .*\)/${ERROR_COLOR}\1${RESET_FORMATTING}/gp" \ - -n -e "s/\(.*\ error\ .*\)/${ERROR_COLOR}\1${RESET_FORMATTING}/gp" \ - -n -e "s/\(.*\ Error\ .*\)/${ERROR_COLOR}\1${RESET_FORMATTING}/gp" \ - -n -e "s/Tests run: \([^,]*\), Failures: \([^,]*\), Errors: \([^,]*\), Skipped: \([^,]*\), Time elapsed: \([^,]*\)/${GENERIC_COLOR}Tests run: ${RESET_FORMATTING}${TEST_RUN_COLOR}\1${RESET_FORMATTING}${GENERIC_COLOR}, Failures: ${RESET_FORMATTING}${TEST_FAIL_COLOR}\2${RESET_FORMATTING}${GENERIC_COLOR}, Errors: ${RESET_FORMATTING}${TEST_ERROR_COLOR}\3${RESET_FORMATTING}${GENERIC_COLOR}, Skipped: ${RESET_FORMATTING}${TEST_SKIP_COLOR}\4${RESET_FORMATTING}${GENERIC_COLOR}, Time elapsed: \5${RESET_FORMATTING}/gp" - - # Make sure formatting is reset - echo -ne ${RESET_FORMATTING} -} - -# Wrapper function for Maven's mvn command to reduce verbose output -mvn-color-super-compact() -{ - # Filter mvn output using sed - mvn $@ | sed -n -e "s/\(\[INFO\]\ Building\ .*\)/${HEADER_COLOR}\1${RESET_FORMATTING}/gp" \ - -n -e "s/\(^Running .*\)/${BASIC_INFO_COLOR}\1${RESET_FORMATTING}/gp" \ - -n -e "s/\(.*Test.*:.*\.\..*\)/${TEST_FAIL_COLOR}\1${RESET_FORMATTING}/gp" \ - -n -e "s/\(.* test.*:.*\.\..*\)/${TEST_FAIL_COLOR}\1${RESET_FORMATTING}/gp" \ - -n -e "s/\(\[INFO\]\ BUILD\ SUCCESS\)/${SUCCESS_COLOR}\1${RESET_FORMATTING}/gp" \ - -n -e "s/\(\[INFO\]\ BUILD\ FAILURE\)/${FAIL_COLOR}\1${RESET_FORMATTING}/gp" \ - -n -e "s/\(\[WARNING\].*\)/${WARN_COLOR}\1${RESET_FORMATTING}/gp" \ - -n -e "s/\(.*\ WARN\ .*\)/${WARN_COLOR}\1${RESET_FORMATTING}/gp" \ - -n -e "s/\(.*\ warn\ .*\)/${WARN_COLOR}\1${RESET_FORMATTING}/gp" \ - -n -e "s/\(.*\ Warn\ .*\)/${WARN_COLOR}\1${RESET_FORMATTING}/gp" \ - -n -e "s/\(\[ERROR\].*\)/${ERROR_COLOR}\1${RESET_FORMATTING}/gp" \ - -n -e "s/\(.*\ ERROR\ .*\)/${ERROR_COLOR}\1${RESET_FORMATTING}/gp" \ - -n -e "s/\(.*\ error\ .*\)/${ERROR_COLOR}\1${RESET_FORMATTING}/gp" \ - -n -e "s/\(.*\ Error\ .*\)/${ERROR_COLOR}\1${RESET_FORMATTING}/gp" \ - -n -e "s/Tests run: \([^,]*\), Failures: \([^,]*\), Errors: \([^,]*\), Skipped: \([^,]*\), Time elapsed: \([^,]*\)/${GENERIC_COLOR}T: ${RESET_FORMATTING}${TEST_RUN_COLOR}\1${RESET_FORMATTING}${GENERIC_COLOR}, F: ${RESET_FORMATTING}${TEST_FAIL_COLOR}\2${RESET_FORMATTING}${GENERIC_COLOR}, E: ${RESET_FORMATTING}${TEST_ERROR_COLOR}\3${RESET_FORMATTING}${GENERIC_COLOR}, S: ${RESET_FORMATTING}${TEST_SKIP_COLOR}\4${RESET_FORMATTING}/gp" - - # Make sure formatting is reset - echo -ne ${RESET_FORMATTING} -} - -# Override the mvn command with the colorized one. -alias mvn="mvn-color" -# Add a mvnc command to provide less verbose output -alias mvn-c="mvn-color-compact" -alias mvn-sc="mvn-color-super-compact" - -export MAVEN_COLOR_SCRIPT_SOURCED=true \ No newline at end of file diff --git a/src/releasing/releaser.sh b/src/releasing/releaser.sh index 0870305d9b..36ee7d060a 100755 --- a/src/releasing/releaser.sh +++ b/src/releasing/releaser.sh @@ -27,7 +27,6 @@ else fi shopt -s expand_aliases -source maven-illuminate.sh # Update the Quattor version used by template-library-examples (SCDB-based) to the one being released update_examples () { @@ -62,11 +61,11 @@ publish_templates() { tag=$2 cd configuration-modules-$1 git checkout $tag - mvn-c clean compile + mvn -e clean compile # ugly hack if [ -d ncm-metaconfig ]; then cd ncm-metaconfig - mvn-c clean test + mvn -e clean test cd .. fi components_root=${LIBRARY_CORE_DIR}/components @@ -97,7 +96,7 @@ publish_aii() { ( cd aii || return git checkout "aii-$tag" - mvn-c -q clean compile + mvn -e -q clean compile # Copy dedicated AII templates cp -r aii-core/target/pan/quattor/aii/* "${dest_root}" @@ -113,7 +112,7 @@ publish_aii() { ( cd configuration-modules-core || return git checkout "configuration-modules-core-$tag" - mvn-c -q clean compile + mvn -e -q clean compile # Copy shared AII/core component templates for component in freeipa opennebula; do rm -Rf "${dest_root:?}/${component}" @@ -267,7 +266,7 @@ if gpg-agent; then for r in $REPOS_MVN; do echo_info "---------------- Releasing $r ----------------" cd $r - mvn-c -q -DautoVersionSubmodules=true -Dgpg.useagent=true -Darguments=-Dgpg.useagent=true -B -DreleaseVersion=$VERSION clean release:prepare + mvn -e -q -DautoVersionSubmodules=true -Dgpg.useagent=true -Darguments=-Dgpg.useagent=true -B -DreleaseVersion=$VERSION clean release:prepare if [[ $? -gt 0 ]]; then echo_error "RELEASE FAILURE" exit 1 From 3d4511bbaba683714b557bb1fe5372a7f2e1faa4 Mon Sep 17 00:00:00 2001 From: James Adams Date: Wed, 6 Nov 2024 15:50:57 +0000 Subject: [PATCH 2/3] releasing: template-library-monitoring is archived It is read-only so cannot be released. --- src/releasing/releaser.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/releasing/releaser.sh b/src/releasing/releaser.sh index 36ee7d060a..837ac73988 100755 --- a/src/releasing/releaser.sh +++ b/src/releasing/releaser.sh @@ -1,7 +1,7 @@ #!/bin/bash REPOS_MVN="release aii CAF CCM cdp-listend configuration-modules-core configuration-modules-grid LC ncm-cdispd ncm-ncd ncm-query ncm-lib-blockdevices" -REPOS_ONE_TAG="template-library-core template-library-standard template-library-examples template-library-monitoring" +REPOS_ONE_TAG="template-library-core template-library-standard template-library-examples" REPOS_BRANCH_TAG="template-library-os template-library-grid template-library-openstack" RELEASE="" BUILD="" From ff49f772ba18631abbc33e3f5b99c19acde233c7 Mon Sep 17 00:00:00 2001 From: James Adams Date: Wed, 6 Nov 2024 16:16:43 +0000 Subject: [PATCH 3/3] releasing: prevent globbing and word splitting of VERSION --- src/releasing/releaser.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/releasing/releaser.sh b/src/releasing/releaser.sh index 837ac73988..6475d206b2 100755 --- a/src/releasing/releaser.sh +++ b/src/releasing/releaser.sh @@ -266,7 +266,7 @@ if gpg-agent; then for r in $REPOS_MVN; do echo_info "---------------- Releasing $r ----------------" cd $r - mvn -e -q -DautoVersionSubmodules=true -Dgpg.useagent=true -Darguments=-Dgpg.useagent=true -B -DreleaseVersion=$VERSION clean release:prepare + mvn -e -q -DautoVersionSubmodules=true -Dgpg.useagent=true -Darguments=-Dgpg.useagent=true -B -DreleaseVersion="$VERSION" clean release:prepare if [[ $? -gt 0 ]]; then echo_error "RELEASE FAILURE" exit 1