Skip to content

Commit 601dfb7

Browse files
committed
Print the S3 bucket name on validation failure
1 parent 7ef2ec0 commit 601dfb7

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

operations/_scripts/generate/check_bucket_name.sh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,49 +9,49 @@ set -e
99
function checkBucket() {
1010
# check length of bucket name
1111
if [[ ${#1} -lt 3 || ${#1} -gt 63 ]]; then
12-
echo "::error::Bucket name must be between 3 and 63 characters long."
12+
echo "::error::Bucket name '$1' must be between 3 and 63 characters long."
1313
exit 1
1414
fi
1515

1616
# check that bucket name consists only of lowercase letters, numbers, dots (.), and hyphens (-)
1717
if [[ ! $1 =~ ^[a-z0-9.-]+$ ]]; then
18-
echo "::error::Bucket name can only consist of lowercase letters, numbers, dots (.), and hyphens (-)."
18+
echo "::error::Bucket name '$1' can only consist of lowercase letters, numbers, dots (.), and hyphens (-)."
1919
exit 1
2020
fi
2121

2222
# check that bucket name begins and ends with a letter or number
2323
if [[ ! $1 =~ ^[a-zA-Z0-9] ]]; then
24-
echo "::error::Bucket name must begin with a letter or number."
24+
echo "::error::Bucket name '$1' must begin with a letter or number."
2525
exit 1
2626
fi
2727
if [[ ! $1 =~ [a-zA-Z0-9]$ ]]; then
28-
echo "::error::Bucket name must end with a letter or number."
28+
echo "::error::Bucket name '$1' must end with a letter or number."
2929
exit 1
3030
fi
3131

3232
# check that bucket name does not contain two adjacent periods
3333
if [[ $1 =~ \.\. ]]; then
34-
echo "::error::Bucket name cannot contain two adjacent periods."
34+
echo "::error::Bucket name '$1' cannot contain two adjacent periods."
3535
exit 1
3636
fi
3737

3838
# check that bucket name is not formatted as an IP address
3939
if [[ $1 =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
40-
echo "::error::Bucket name cannot be formatted as an IP address."
40+
echo "::error::Bucket name '$1' cannot be formatted as an IP address."
4141
exit 1
4242
fi
4343

4444
# check that bucket name does not start with the prefix xn--
4545
if [[ $1 =~ ^xn-- ]]; then
46-
echo "::error::Bucket name cannot start with the prefix xn--."
46+
echo "::error::Bucket name '$1' cannot start with the prefix xn--."
4747
exit 1
4848
fi
4949

5050
# check that bucket name does not end with the suffix -s3alias
5151
if [[ $1 =~ -s3alias$ ]]; then
52-
echo "::error::Bucket name cannot end with the suffix -s3alias."
52+
echo "::error::Bucket name '$1' cannot end with the suffix -s3alias."
5353
exit 1
5454
fi
5555
}
5656

57-
checkBucket $1
57+
checkBucket $1

0 commit comments

Comments
 (0)