-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
34 lines (28 loc) · 1.04 KB
/
Makefile
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
OPERATOR_NAME=bucket-maker
REGION=asia-southeast1
GCLOUD_PROJECT := $(shell gcloud config get-value project)
PROJECT_NUMBER := $(shell gcloud projects list --filter="${GCLOUD_PROJECT}" --format="value(PROJECT_NUMBER)")
GCLOUD_DOCKER_URL=gcr.io/$(GCLOUD_PROJECT)/$(OPERATOR_NAME)
BUCKET_NAME := $(shell gcloud config get-value project)
TRIGGER_NAME=upload2gcs
build:
gcloud builds submit \
--project "${GCLOUD_PROJECT}" \
--tag "$(GCLOUD_DOCKER_URL)" \
.
create_trigger:
gcloud eventarc triggers create "${TRIGGER_NAME}" \
--location="${REGION}" \
--destination-run-service="${OPERATOR_NAME}" \
--event-filters="type=google.cloud.audit.log.v1.written" \
--event-filters="methodName=storage.objects.create" \
--event-filters="serviceName=storage.googleapis.com" \
--service-account=${PROJECT_NUMBER}[email protected]
deploy: build
gcloud run deploy "$(OPERATOR_NAME)" \
--quiet \
--project "$(GCLOUD_PROJECT)" \
--region "$(REGION)" \
--image "$(GCLOUD_DOCKER_URL)" \
--platform "managed"
create_trigger