Resolve prefix variables.
This commit is contained in:
parent
fbde2c688d
commit
6851911e4a
4 changed files with 11 additions and 3 deletions
|
@ -6,7 +6,7 @@ source "$(dirname $0)/common.sh"
|
||||||
|
|
||||||
payload=`cat`
|
payload=`cat`
|
||||||
bucket=$(get_bucket)
|
bucket=$(get_bucket)
|
||||||
prefix="$(echo "$payload" | jq -r '.params.prefix // ""')"
|
prefix=$(get_prefix)
|
||||||
|
|
||||||
export_aws_vars
|
export_aws_vars
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,14 @@ get_bucket() {
|
||||||
echo $bucket
|
echo $bucket
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get_prefix() {
|
||||||
|
local prefix=$(echo "$payload" | jq -r '.params.prefix // ""')
|
||||||
|
if [ -n "$prefix" ]; then
|
||||||
|
prefix=$(eval $prefix) # Resolve variables like $BUILD_NAME, etc.
|
||||||
|
fi
|
||||||
|
echo $prefix
|
||||||
|
}
|
||||||
|
|
||||||
export_aws_vars() {
|
export_aws_vars() {
|
||||||
local access_key_id=$(echo "$payload" | jq -r '.source.access_key_id // empty')
|
local access_key_id=$(echo "$payload" | jq -r '.source.access_key_id // empty')
|
||||||
local secret_access_key=$(echo "$payload" | jq -r '.source.secret_access_key // empty')
|
local secret_access_key=$(echo "$payload" | jq -r '.source.secret_access_key // empty')
|
||||||
|
|
|
@ -16,7 +16,7 @@ source "$(dirname $0)/common.sh"
|
||||||
|
|
||||||
payload=`cat`
|
payload=`cat`
|
||||||
bucket=$(get_bucket)
|
bucket=$(get_bucket)
|
||||||
prefix=$(echo "$payload" | jq -r '.params.prefix // ""')
|
prefix=$(get_prefix)
|
||||||
options=$(echo "$payload" | jq -r '.params.options // [] | join(" ")')
|
options=$(echo "$payload" | jq -r '.params.options // [] | join(" ")')
|
||||||
skip_download=$(echo "$payload" | jq -r '.params.skip_download // false')
|
skip_download=$(echo "$payload" | jq -r '.params.skip_download // false')
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ source "$(dirname $0)/common.sh"
|
||||||
|
|
||||||
payload=`cat`
|
payload=`cat`
|
||||||
bucket=$(get_bucket)
|
bucket=$(get_bucket)
|
||||||
prefix=$(echo "$payload" | jq -r '.params.prefix // ""')
|
prefix=$(get_prefix)
|
||||||
options=$(echo "$payload" | jq -r '.params.options // [] | join(" ")')
|
options=$(echo "$payload" | jq -r '.params.options // [] | join(" ")')
|
||||||
source_dir=$(echo "$payload" | jq -r '.params.source_dir // "."')
|
source_dir=$(echo "$payload" | jq -r '.params.source_dir // "."')
|
||||||
test -z "$source_dir" && { echo "Must supply params.source_dir" >&2; exit 1; }
|
test -z "$source_dir" && { echo "Must supply params.source_dir" >&2; exit 1; }
|
||||||
|
|
Loading…
Reference in a new issue