Skip to content

Commit adb929c

Browse files
authored
Added functionality to use azcopy sync and SAS for blobs (#46)
1 parent 897837e commit adb929c

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

get_azure_share_sas/get_azure_share_sas.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ sas=$(
2828
--https-only \
2929
--permissions acdlpruw \
3030
--resource-types sco \
31-
--services f | cut -d'"' -f2
31+
--services fb | cut -d'"' -f2
3232
)
3333

3434
authorized_destination="$destination?$sas"

run_azcopy/action.yaml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: Run azcopy
2-
description: Copy files with azcopy
2+
description: Copy/Sync files with azcopy
33

44
branding:
55
icon: 'battery-charging'
@@ -14,13 +14,25 @@ inputs:
1414
required: true
1515
description: Destination directory or SAS token
1616

17+
mode:
18+
required: false
19+
default: "copy"
20+
description: azcopy action mode (copy or sync)
21+
1722
put_md5:
1823
required: false
1924
default: "true"
2025
description: |
2126
Create an MD5 hash of each file, and save the hash as the Content-MD5 property
2227
of the destination blob or file. (By default the hash is NOT created.) Only available when uploading.
2328
29+
delete_destination:
30+
required: false
31+
default: "false"
32+
description: |
33+
When mode="sync", if the 'delete_destination' flag is set to true, then sync will delete files and blobs
34+
at the destination that aren't present at the source.
35+
2436
runs:
2537
using: "composite"
2638
steps:
@@ -30,4 +42,6 @@ runs:
3042
env:
3143
SOURCE: ${{ inputs.source }}
3244
TARGET: ${{ inputs.target }}
45+
MODE: ${{ inputs.mode }}
3346
PUT_MD5: ${{ inputs.put_md5 }}
47+
DELETE_DESTINATION: ${{ inputs.delete_destination }}

run_azcopy/run_azcopy.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,7 @@ AZCOPY_OPTIONS=("--recursive" "--overwrite" "true")
2121
if [[ "$(echo "$PUT_MD5" | tr '[:upper:]' '[:lower:]')" == 'true' ]]; then
2222
AZCOPY_OPTIONS+=("--put-md5")
2323
fi;
24-
./azcopy copy "$SOURCE" "$TARGET" "${AZCOPY_OPTIONS[@]}"
24+
if [[ "$(echo "$DELETE_DESTINATION" | tr '[:upper:]' '[:lower:]')" == 'true' ]]; then
25+
AZCOPY_OPTIONS+=("--delete-destination" "true")
26+
fi;
27+
./azcopy "$MODE" "$SOURCE" "$TARGET" "${AZCOPY_OPTIONS[@]}"

0 commit comments

Comments
 (0)