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

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/