Browse Source

Fix check script for stdout redirection

master
Luciano Silva 8 years ago
parent
commit
a370f293d8
  1. 3
      assets/check
  2. 16
      assets/common.sh

3
assets/check

@ -11,8 +11,6 @@ payload=$(mktemp $TMPDIR/concoure-curl-resource-request.XXXXXX)
cat > $payload <&0 cat > $payload <&0
cat $payload
url=$(jq -r '.source.url // ""' < $payload) url=$(jq -r '.source.url // ""' < $payload)
# username=$(jq -r '.source.username // ""' < $payload) # username=$(jq -r '.source.username // ""' < $payload)
# password=$(jq -r '.source.password // ""' < $payload) # password=$(jq -r '.source.password // ""' < $payload)
@ -31,6 +29,5 @@ trueValue="true"
[ -n "$skip_ssl_verification" ] && [ "${skip_ssl_verification,,}" = "${trueValue,,}" ] && args_security="$args_security -k"; [ -n "$skip_ssl_verification" ] && [ "${skip_ssl_verification,,}" = "${trueValue,,}" ] && args_security="$args_security -k";
final_url=$(echo "$args_security" " $url") final_url=$(echo "$args_security" " $url")
echo $final_url
check_version "$final_url" >&3 check_version "$final_url" >&3

16
assets/common.sh

@ -1,19 +1,5 @@
set -e set -e
exec 3>&1 # make stdout available as fd 3 for the result
exec 1>&2 # redirect all output to stderr for logging
# in_file_with_version() {
# local artifacts_url=$1
# local regex="(?<uri>$2)"
# local version=$3
#
# result=$(artifactory_files "$artifacts_url" "$regex")
# echo $result | jq --arg v "$version" '[foreach .[] as $item ([]; $item ; if $item.version == $v then $item else empty end)]'
#
# }
#
# retrieve current file version # retrieve current file version
# e.g. curl -R -I $1 # e.g. curl -R -I $1
check_version() { check_version() {
@ -32,5 +18,5 @@ check_version() {
local dateString=$(date +"$dateVersionFormat" -D %d\ %b\ %Y\ %H:%M:%S\ GMT -d "$tmpDateString") local dateString=$(date +"$dateVersionFormat" -D %d\ %b\ %Y\ %H:%M:%S\ GMT -d "$tmpDateString")
fi fi
echo "[{\"ref\":\"$dateString\"}]" | jq .
echo "{\"version\":\"$dateString\"}" | jq --slurp .
} }
Loading…
Cancel
Save