-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgcs.yml
More file actions
96 lines (92 loc) · 2.88 KB
/
gcs.yml
File metadata and controls
96 lines (92 loc) · 2.88 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
version: 2.1
description: |
Upload to Google Cloud Storage
executors:
cloud-sdk:
description: The docker container to use when running gcp-gcs commands
docker:
- image: google/cloud-sdk:413.0.0-alpine
commands:
gcs-auth:
description: Authenticate against Google Cloud Storage
parameters:
gcloud-service-key:
description: The gcloud service key
type: env_var_name
default: GCLOUD_SERVICE_KEY
google-project-id:
description: Environment variable name for the Google project ID to connect with via the gcloud CLI
type: env_var_name
default: GOOGLE_PROJECT_ID
steps:
- run:
name: Check Environment Variables
command: |
if [[ -z "${GCLOUD_SERVICE_KEY}" ]]; then
echo "GCLOUD_SERVICE_KEY is not set, will not be able to log into gcs."
exit 1
fi
if [[ -z "${GOOGLE_PROJECT_ID}" ]]; then
echo "GOOGLE_PROJECT_ID is not set, will not be able to log into gcs."
exit 1
fi
- run:
name: Authenticate and configure Docker
command: |
echo $GCLOUD_SERVICE_KEY | gcloud auth activate-service-account --key-file=-
gcloud --quiet config set project ${GOOGLE_PROJECT_ID}
rsync:
description: Sync files to Bucket
parameters:
bucket:
description: The google bucket to upload to
type: string
source:
description: Source
type: string
destination:
description: Destination
type: string
default: ''
options:
description: Options
type: string
default: ''
steps:
- run:
name: Sync files to storage
command: |
gsutil -m rsync <<parameters.options>> <<parameters.source>> gs://<<parameters.bucket>>/<<parameters.destination>>
gcs-rsync:
description: Authenticate and sync files to Bucket
parameters:
gcloud-service-key:
description: The gcloud service key
type: env_var_name
default: GCLOUD_SERVICE_KEY
google-project-id:
description: Environment variable name for the Google project ID to connect with via the gcloud CLI
type: env_var_name
default: GOOGLE_PROJECT_ID
bucket:
description: The google bucket to upload to
type: string
source:
description: Source
type: string
destination:
description: Destination
type: string
default: ''
options:
description: Options
type: string
default: ''
steps:
- gcs-auth:
google-project-id: <<parameters.google-project-id>>
- rsync:
bucket: <<parameters.bucket>>
source: <<parameters.source>>
destination: <<parameters.destination>>
options: <<parameters.options>>