summaryrefslogtreecommitdiff
path: root/scripts/01-create-bucket.sh
blob: c7251ba01b118a6d9d5f01cc98383eee420412f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/sh

if [ ${DEBUG:+1} ]; then
    set -exo pipefail
fi

path="$1"

if [ -z "$path" ] || [ ! -e "$path" ]; then
    path=$(find . -name 'order_products.csv' -print -quit)

    if [ -z "$path" ]; then
        echo ">>>> Path not found..."
        exit 1
    fi
fi

gcloud storage buckets create gs://${BUCKET_NAME} --location=eu
gcloud storage buckets add-iam-policy-binding gs://${BUCKET_NAME} \
    --member="serviceAccount:${SERVICE_ACCOUNT}@${PROJECT}.iam.gserviceaccount.com" \
    --role="roles/storage.objectCreator"
gcloud storage cp $path gs://${BUCKET_NAME}/input/