You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ch...@apache.org on 2023/06/21 13:53:02 UTC
[commons-release-plugin] branch master updated: fix(signature-validator.sh): sed fixes
This is an automated email from the ASF dual-hosted git repository.
chtompki pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-release-plugin.git
The following commit(s) were added to refs/heads/master by this push:
new b9a62db fix(signature-validator.sh): sed fixes
b9a62db is described below
commit b9a62db45206af4b21f406839c7c63a3f2219879
Author: Rob Tompkins <ch...@apache.org>
AuthorDate: Wed Jun 21 09:52:47 2023 -0400
fix(signature-validator.sh): sed fixes
---
src/main/resources/signature-validator.sh | 66 ++++++++++++++++---------------
1 file changed, 34 insertions(+), 32 deletions(-)
diff --git a/src/main/resources/signature-validator.sh b/src/main/resources/signature-validator.sh
old mode 100644
new mode 100755
index 23a31af..0e86ca9
--- a/src/main/resources/signature-validator.sh
+++ b/src/main/resources/signature-validator.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/bash -x
###########
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
@@ -30,7 +30,7 @@
#
# From here you run ./signature-validation.sh and it will create a directory "artifacts-for-validation-deletable-post-validation
# in which all of the binaries generated by a release are copied and then it checks to see that all of the signatures and hashes
-# are in fact correct for the artifacts.
+# are infact correct for the artifacts.
#
###########
@@ -51,43 +51,44 @@ SOURCE_DIR=${BASEDIR}/source
BASE_NEXUS_URL="$1"
function clean_and_build_validation_dir() {
- mkdir -p ${VALIDATION_DIR}
+ mkdir -p ${VALIDATION_DIR}
}
function copy_in_checked_out_artifacts() {
- cp ${BASEDIR}/binaries/commons* ${VALIDATION_DIR}
- cp ${BASEDIR}/source/commons* ${VALIDATION_DIR}
+ cp ${BASEDIR}/binaries/commons* ${VALIDATION_DIR}
+ cp ${BASEDIR}/source/commons* ${VALIDATION_DIR}
}
function download_nexus_artifacts_to_validation_directory() {
- # Curls html page and does text modification to put artifacts in semicolon delimited list
- # ...(ugly but works, debug by removing pipes one at a time)
- echo "INFO: Downloading artifacts from nexus"
- NEXUS_ARTIFACTS=$(curl ${BASE_NEXUS_URL} \
- | grep "${BASE_NEXUS_URL}" \
- | cut -d '>' -f3 \
- | sed "s|</a|;|g" \
- | sed ':a;N;$!ba;s/\n/ /g' \
+ # Curls html page and does text modification to put artifacts in semicolon delimited list
+ # ...(ugly but works, debug by removing pipes one at a time)
+ echo "INFO: Downloading artifacts from nexus"
+
+ echo ${BASE_NEXUS_URL}
+ NEXUS_ARTIFACTS=$(curl ${BASE_NEXUS_URL} \
+ | grep "${BASE_NEXUS_URL}" \
+ | cut -d '>' -f3 \
+ | sed "s|</a|;|g" \
+ | sed -e ':a' -e 'N' -e '$!ba' -e 's/\n/ /g' \
| sed 's/ //g'
- )
-
- IFS=';' read -r -a array <<< "${NEXUS_ARTIFACTS}"
-
- for element in "${array[@]}"
- do
- ARTIFACT_NAME=$(echo $element | cut -d '/' -f7)
- echo $ARTIFACT_NAME
- URL="${BASE_NEXUS_URL}${element}"
- curl $URL -o ${VALIDATION_DIR}/$ARTIFACT_NAME
- done
+ )
+ IFS=';' read -r -a array <<< "${NEXUS_ARTIFACTS}"
+
+ for element in "${array[@]}"
+ do
+ ARTIFACT_NAME=$(echo $element | cut -d '/' -f7)
+ echo $ARTIFACT_NAME
+ URL="${BASE_NEXUS_URL}${element}"
+ curl $URL -o ${VALIDATION_DIR}/$ARTIFACT_NAME
+ done
}
function validate_signatures() {
- echo "INFO: Validating Signatures in ${VALIDATION_DIR}"
- ALL_ARTIFACTS=$(ls -Al ${VALIDATION_DIR} \
- | awk -F':[0-9]* ' '/:/{print $2}' \
- | sed ':a;N;$!ba;s/\n/;/g'
- )
+ echo "INFO: Validating Signatures in ${VALIDATION_DIR}"
+ ALL_ARTIFACTS=$(ls -Al ${VALIDATION_DIR} \
+ | awk -F':[0-9]* ' '/:/{print $2}' \
+ | sed -e ':a' -e 'N' -e '$!ba' -e 's/\n/;/g' \
+ )
ARTIFACTS_FOR_VALIDATION=()
@@ -101,12 +102,12 @@ function validate_signatures() {
fi
done
- for element in "${ARTIFACTS_FOR_VALIDATION[@]}"
+ for element in "${ARTIFACTS_FOR_VALIDATION[@]}"
do
if [[ ${element} =~ ^.*tar.gz.*$ || ${element} =~ ^.*zip.*$ ]];
then
ARTIFACT_SHA512=$(openssl sha512 ${VALIDATION_DIR}/$element | cut -d '=' -f2 | cut -d ' ' -f2)
- FILE_SHA512=$(cut -d$'\r' -f1 ${VALIDATION_DIR}/$element.sha512 | cut -d ' ' -f1)
+ FILE_SHA512=$(cut -d$'\r' -f1 ${VALIDATION_DIR}/$element.sha512)
if test "${ARTIFACT_SHA512}" != "${FILE_SHA512}"
then
echo "$element failed sha512 check"
@@ -156,4 +157,5 @@ echo $(clean_and_build_validation_dir)
echo $(copy_in_checked_out_artifacts)
echo $(download_nexus_artifacts_to_validation_directory)
echo $(validate_signatures)
-#clean_up_afterwards
\ No newline at end of file
+#clean_up_afterwards
+