-
Notifications
You must be signed in to change notification settings - Fork 0
66 lines (59 loc) · 1.91 KB
/
Copy pathsync-data.yaml
File metadata and controls
66 lines (59 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
name: "Sync Data"
# Note on authentication:
#
# This action uses OIDC federated credentials for authenticating with Azure.
#
# In Azure there is a managed identity which has been created and is set to allow federated
# credentials from this repo when the environment is "sync-data".
#
# That managed identity has been granted Storage Blob Data Contributor role to the storage account
# which is being synced with azcopy.
#
# So long as those credentials are in place, this action should be able to authenticate with Azure
# and sync data between the specified container. These permissions do not expire.
on:
workflow_dispatch:
inputs:
from:
required: true
type: string
default: "dev"
to:
required: true
type: string
default: "vX.Y"
workflow_call:
inputs:
from:
required: true
type: string
to:
required: true
type: string
permissions:
id-token: write
contents: read
jobs:
sync-data:
name: "Sync Data"
runs-on: ubuntu-latest
environment: sync-data
steps:
- name: Azure Login
uses: azure/login@v3
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: Download azcopy
run: |
curl -s -L https://aka.ms/downloadazcopy-v10-linux | tar zx --strip-components 1
# NOTE: storage ep should end in a /, so we do not need a slash between ep and container
- name: Sync Data
env:
AZCOPY_AUTO_LOGIN_TYPE: AZCLI
run: |
echo "Syncing from ${{ inputs.from }} to ${{ inputs.to }}"
./azcopy sync --recursive \
"${{ secrets.AZ_STORAGE_EP }}${{ secrets.AZ_STORAGE_CONTAINER }}/${{ inputs.from }}" \
"${{ secrets.AZ_STORAGE_EP }}${{ secrets.AZ_STORAGE_CONTAINER }}/${{ inputs.to }}"