-
Notifications
You must be signed in to change notification settings - Fork 1
112 lines (101 loc) · 4.52 KB
/
gcloud-deploy.yml
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# Deploy the production cloud functions if pushing to the `main` branch or the test cloud functions if pushing to the
# `test` branch.
name: gcloud-deploy
on:
push:
branches:
- main
- test
jobs:
get-prefix:
runs-on: ubuntu-latest
outputs:
name_prefix: ${{ steps.prefix.outputs.name_prefix }}
dataset_name_prefix: ${{ steps.prefix.outputs.dataset_name_prefix }}
steps:
- name: Get prefix (test- or nothing for production)
id: prefix
run: |
echo ${{ github.ref }}
if [ "${{ github.ref }}" = "refs/heads/main" ]; then
echo "name_prefix=" >> $GITHUB_OUTPUT
echo "dataset_name_prefix=" >> $GITHUB_OUTPUT
else
echo "name_prefix=test-" >> $GITHUB_OUTPUT
echo "dataset_name_prefix=test_" >> $GITHUB_OUTPUT
fi
deploy-add-sensor-type:
permissions:
contents: "read"
id-token: "write"
runs-on: ubuntu-latest
needs: get-prefix
steps:
- id: checkout
uses: actions/checkout@v2
- id: auth
uses: google-github-actions/auth@v0
with:
workload_identity_provider: "projects/885434704038/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider"
service_account: "data-gateway-ci-testing@aerosense-twined.iam.gserviceaccount.com"
- uses: google-github-actions/deploy-cloud-functions@v0
with:
description: Allows addition of a new sensor type whose values will be accepted into the database
entry_point: add_sensor_type
env_vars: BIG_QUERY_DATASET_NAME=${{ needs.get-prefix.outputs.dataset_name_prefix }}greta,COMPUTE_PROVIDER=GOOGLE_CLOUD_FUNCTION,DESTINATION_PROJECT_NAME=aerosense-twined
name: ${{ needs.get-prefix.outputs.name_prefix }}add-sensor-type
runtime: python39
region: europe-west6
service_account_email: as-ingress@aerosense-twined.iam.gserviceaccount.com
source_dir: cloud_functions
deploy-create-installation:
permissions:
contents: "read"
id-token: "write"
runs-on: ubuntu-latest
needs: get-prefix
steps:
- id: checkout
uses: actions/checkout@v2
- id: auth
uses: google-github-actions/auth@v0
with:
workload_identity_provider: "projects/885434704038/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider"
service_account: "data-gateway-ci-testing@aerosense-twined.iam.gserviceaccount.com"
- uses: google-github-actions/deploy-cloud-functions@v0
with:
description: Allows creation of a new installation
entry_point: create_installation
env_vars: BIG_QUERY_DATASET_NAME=${{ needs.get-prefix.outputs.dataset_name_prefix }}greta,COMPUTE_PROVIDER=GOOGLE_CLOUD_FUNCTION,DESTINATION_PROJECT_NAME=aerosense-twined
name: ${{ needs.get-prefix.outputs.name_prefix }}create-installation
runtime: python39
region: europe-west6
service_account_email: as-ingress@aerosense-twined.iam.gserviceaccount.com
source_dir: cloud_functions
deploy-ingress-eu:
permissions:
contents: "read"
id-token: "write"
runs-on: ubuntu-latest
needs: get-prefix
steps:
- id: checkout
uses: actions/checkout@v2
- id: auth
uses: google-github-actions/auth@v0
with:
workload_identity_provider: "projects/885434704038/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider"
service_account: "data-gateway-ci-testing@aerosense-twined.iam.gserviceaccount.com"
- uses: google-github-actions/deploy-cloud-functions@v0
with:
entry_point: upload_window
env_vars: BIG_QUERY_DATASET_NAME=${{ needs.get-prefix.outputs.dataset_name_prefix }}greta,COMPUTE_PROVIDER=GOOGLE_CLOUD_FUNCTION,DESTINATION_PROJECT_NAME=aerosense-twined,DESTINATION_BUCKET_NAME=data-gateway-processed-data,SOURCE_PROJECT_NAME=aerosense-twined
event_trigger_type: google.storage.object.finalize
event_trigger_resource: projects/_/buckets/${{ needs.get-prefix.outputs.name_prefix }}aerosense-ingress-eu
event_trigger_service: storage.googleapis.com
memory_mb: 1024
name: ${{ needs.get-prefix.outputs.name_prefix }}ingress-eu
region: europe-west6
runtime: python39
service_account_email: as-ingress@aerosense-twined.iam.gserviceaccount.com
source_dir: cloud_functions