-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcloudbuild.yaml
More file actions
21 lines (21 loc) · 1.06 KB
/
Copy pathcloudbuild.yaml
File metadata and controls
21 lines (21 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
steps:
# 2️⃣ Copy to VM via gcloud scp
- name: gcr.io/cloud-builders/gcloud
entrypoint: bash
args:
- -lc
- |
set -eu
echo "cleaning staging folder"
gcloud compute ssh "root@$__VM_NAME" --zone="$__VM_ZONE" --command="mkdir -p /root/airflow/cicd-staging"
gcloud compute ssh "root@$__VM_NAME" --zone="$__VM_ZONE" --command="cd /root/airflow/cicd-staging && rm -rfv *" && echo "cleaned staging folder"
echo "copying files to staging"
gcloud compute scp --recurse * "root@$__VM_NAME:/root/airflow/cicd-staging" --zone="$__VM_ZONE"
echo "copied files to staging"
echo "removing old files"
gcloud compute ssh "root@$__VM_NAME" --zone="$__VM_ZONE" --command="cd /root/airflow/dags && rm -rfv *"
echo "removed old files"
echo "copying file from staging to main"
gcloud compute ssh "root@$__VM_NAME" --zone="$__VM_ZONE" --command="cp -rv /root/airflow/cicd-staging/. /root/airflow/dags" && echo "copied files from staging to main"
options:
logging: CLOUD_LOGGING_ONLY