Skip to content

error message of azcopy is no longer hidden #6187

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -73,25 +73,26 @@ class AzBashLib extends BashFunLib<AzBashLib> {
azcopy cp "$name" "$target/$name?$AZ_SAS" --block-blob-tier $AZCOPY_BLOCK_BLOB_TIER --block-size-mb $AZCOPY_BLOCK_SIZE_MB
fi
}

nxf_az_download() {
local source=$1
local target=$2
local basedir=$(dirname $2)
local ret
mkdir -p "$basedir"

ret=$(azcopy cp "$source?$AZ_SAS" "$target" 2>&1) || {
## if fails check if it was trying to download a directory
mkdir -p $target
azcopy cp "$source/*?$AZ_SAS" "$target" --recursive >/dev/null || {
rm -rf $target

# Try to download as file first, let azcopy handle the detection
if ! azcopy cp "$source?$AZ_SAS" "$target"; then
# If failed, remove any partial target and try as directory
rm -rf "$target"
mkdir -p "$target"
if ! azcopy cp "$source/*?$AZ_SAS" "$target" --recursive; then
rm -rf "$target"
>&2 echo "Unable to download path: $source"
exit 1
}
}
fi
fi
}
'''.stripIndent(true)
'''.stripIndent()
}

String render() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,18 +179,19 @@ class AzFileCopyStrategyTest extends Specification {
local source=$1
local target=$2
local basedir=$(dirname $2)
local ret
mkdir -p "$basedir"

ret=$(azcopy cp "$source?$AZ_SAS" "$target" 2>&1) || {
## if fails check if it was trying to download a directory
mkdir -p $target
azcopy cp "$source/*?$AZ_SAS" "$target" --recursive >/dev/null || {
rm -rf $target
# Try to download as file first, let azcopy handle the detection
if ! azcopy cp "$source?$AZ_SAS" "$target"; then
# If failed, remove any partial target and try as directory
rm -rf "$target"
mkdir -p "$target"
if ! azcopy cp "$source/*?$AZ_SAS" "$target" --recursive; then
rm -rf "$target"
>&2 echo "Unable to download path: $source"
exit 1
}
}
fi
fi
}

'''.stripIndent(true)
Expand Down Expand Up @@ -316,18 +317,19 @@ class AzFileCopyStrategyTest extends Specification {
local source=$1
local target=$2
local basedir=$(dirname $2)
local ret
mkdir -p "$basedir"

ret=$(azcopy cp "$source?$AZ_SAS" "$target" 2>&1) || {
## if fails check if it was trying to download a directory
mkdir -p $target
azcopy cp "$source/*?$AZ_SAS" "$target" --recursive >/dev/null || {
rm -rf $target
# Try to download as file first, let azcopy handle the detection
if ! azcopy cp "$source?$AZ_SAS" "$target"; then
# If failed, remove any partial target and try as directory
rm -rf "$target"
mkdir -p "$target"
if ! azcopy cp "$source/*?$AZ_SAS" "$target" --recursive; then
rm -rf "$target"
>&2 echo "Unable to download path: $source"
exit 1
}
}
fi
fi
}

'''.stripIndent(true)
Expand Down Expand Up @@ -477,18 +479,19 @@ class AzFileCopyStrategyTest extends Specification {
local source=$1
local target=$2
local basedir=$(dirname $2)
local ret
mkdir -p "$basedir"

ret=$(azcopy cp "$source?$AZ_SAS" "$target" 2>&1) || {
## if fails check if it was trying to download a directory
mkdir -p $target
azcopy cp "$source/*?$AZ_SAS" "$target" --recursive >/dev/null || {
rm -rf $target
# Try to download as file first, let azcopy handle the detection
if ! azcopy cp "$source?$AZ_SAS" "$target"; then
# If failed, remove any partial target and try as directory
rm -rf "$target"
mkdir -p "$target"
if ! azcopy cp "$source/*?$AZ_SAS" "$target" --recursive; then
rm -rf "$target"
>&2 echo "Unable to download path: $source"
exit 1
}
}
fi
fi
}

'''.stripIndent(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,19 @@ class AzBashLibTest extends Specification {
local source=$1
local target=$2
local basedir=$(dirname $2)
local ret
mkdir -p "$basedir"

ret=$(azcopy cp "$source?$AZ_SAS" "$target" 2>&1) || {
## if fails check if it was trying to download a directory
mkdir -p $target
azcopy cp "$source/*?$AZ_SAS" "$target" --recursive >/dev/null || {
rm -rf $target
# Try to download as file first, let azcopy handle the detection
if ! azcopy cp "$source?$AZ_SAS" "$target"; then
# If failed, remove any partial target and try as directory
rm -rf "$target"
mkdir -p "$target"
if ! azcopy cp "$source/*?$AZ_SAS" "$target" --recursive; then
rm -rf "$target"
>&2 echo "Unable to download path: $source"
exit 1
}
}
fi
fi
}
'''.stripIndent()
}
Expand Down Expand Up @@ -140,18 +141,19 @@ class AzBashLibTest extends Specification {
local source=$1
local target=$2
local basedir=$(dirname $2)
local ret
mkdir -p "$basedir"

ret=$(azcopy cp "$source?$AZ_SAS" "$target" 2>&1) || {
## if fails check if it was trying to download a directory
mkdir -p $target
azcopy cp "$source/*?$AZ_SAS" "$target" --recursive >/dev/null || {
rm -rf $target

# Try to download as file first, let azcopy handle the detection
if ! azcopy cp "$source?$AZ_SAS" "$target"; then
# If failed, remove any partial target and try as directory
rm -rf "$target"
mkdir -p "$target"
if ! azcopy cp "$source/*?$AZ_SAS" "$target" --recursive; then
rm -rf "$target"
>&2 echo "Unable to download path: $source"
exit 1
}
}
fi
fi
}
'''.stripIndent()
}
Expand Down Expand Up @@ -242,18 +244,19 @@ class AzBashLibTest extends Specification {
local source=$1
local target=$2
local basedir=$(dirname $2)
local ret
mkdir -p "$basedir"

ret=$(azcopy cp "$source?$AZ_SAS" "$target" 2>&1) || {
## if fails check if it was trying to download a directory
mkdir -p $target
azcopy cp "$source/*?$AZ_SAS" "$target" --recursive >/dev/null || {
rm -rf $target
# Try to download as file first, let azcopy handle the detection
if ! azcopy cp "$source?$AZ_SAS" "$target"; then
# If failed, remove any partial target and try as directory
rm -rf "$target"
mkdir -p "$target"
if ! azcopy cp "$source/*?$AZ_SAS" "$target" --recursive; then
rm -rf "$target"
>&2 echo "Unable to download path: $source"
exit 1
}
}
fi
fi
}
'''.stripIndent()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,14 @@ class BashWrapperBuilderWithAzTest extends Specification {
nxf_az_download() {
local source=$1
local target=$2
local basedir=$(dirname $2)
local ret
local basedir=$(dirname "$target")
mkdir -p "$basedir"

ret=$(azcopy cp "$source?$AZ_SAS" "$target" 2>&1) || {
## if fails check if it was trying to download a directory
mkdir -p $target
azcopy cp "$source/*?$AZ_SAS" "$target" --recursive >/dev/null || {
rm -rf $target
if ! azcopy cp "$source?$AZ_SAS" "$target"; then
# If failed, remove any partial target and try as directory
rm -rf "$target"; mkdir -p "$target"
if ! azcopy cp "$source/*?$AZ_SAS" "$target" --recursive; then
rm -rf "$target"
>&2 echo "Unable to download path: $source"
exit 1
}
Expand Down Expand Up @@ -216,15 +215,14 @@ class BashWrapperBuilderWithAzTest extends Specification {
nxf_az_download() {
local source=$1
local target=$2
local basedir=$(dirname $2)
local ret
local basedir=$(dirname "$target")
mkdir -p "$basedir"

ret=$(azcopy cp "$source?$AZ_SAS" "$target" 2>&1) || {
## if fails check if it was trying to download a directory
mkdir -p $target
azcopy cp "$source/*?$AZ_SAS" "$target" --recursive >/dev/null || {
rm -rf $target
if ! azcopy cp "$source?$AZ_SAS" "$target"; then
# If failed, remove any partial target and try as directory
rm -rf "$target"; mkdir -p "$target"
if ! azcopy cp "$source/*?$AZ_SAS" "$target" --recursive; then
rm -rf "$target"
>&2 echo "Unable to download path: $source"
exit 1
}
Expand Down
Loading