Skip to content

Commit f59139a

Browse files
authored
Merge pull request #52 from jenkins-infra/updatecli_main_1a75d6824f71fad61195d6848b584c18c23f7d908d116852c1203c3c9560a36d
Update `get-fileshare-signed-url.sh` file
2 parents 441cb58 + 39ad2f8 commit f59139a

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

get-fileshare-signed-url.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
# Ref: https://learn.microsoft.com/en-us/azure/storage/common/storage-sas-overview
88
# --
99
# Usage:
10-
# - Return a file share URL: ./get-fileshare-signed-url.sh
10+
# - Returns a file share URL which can be passed to 'azcopy' (URI always ends with a trailing slash, and a querystring may be present if a short-time lived token is needed):
11+
# - With a token (e.g. with Azure SP credential): https://<storage_name>.file.core.windows.net/<storage_fileshare>/?<token>
12+
# - Without a token (e.g. with credential-less authentication such as workload identity): https://<storage_name>.file.core.windows.net/<storage_fileshare>/
1113
# - Interact with a file share and azcopy: azcopy list "$(./get-fileshare-signed-url.sh)"
1214
# --
1315
# Required parameters defined as environment variables:
@@ -39,7 +41,9 @@ set +x
3941
AZURE_CONFIG_DIR="$(mktemp -d)"
4042
export AZURE_CONFIG_DIR
4143

42-
fileshare_url="https://${STORAGE_NAME}.file.core.windows.net/${STORAGE_FILESHARE}"
44+
45+
# Consumers expects a trailing slash, whether or not a token is appended
46+
fileshare_url="https://${STORAGE_NAME}.file.core.windows.net/${STORAGE_FILESHARE}/"
4347

4448
secret="${JENKINS_INFRA_FILESHARE_CLIENT_SECRET:-}"
4549
# Credential-less using user assigned identity, no need for any SAS token in the returned URL
@@ -86,4 +90,4 @@ token="$(az storage share generate-sas "${accountKeyArg[@]}" \
8690
[[ "${shouldLogout}" == "true" ]] && az logout
8791

8892
# Return signed URL
89-
echo "${fileshare_url}/?${token}"
93+
echo "${fileshare_url}?${token}"

0 commit comments

Comments
 (0)