Reputation: 80
I am currently running a pipeline that relies on Google Cloud Platform for building a file. we want to automate the last step which is the file upload.
- "gcloud compute ssh build-server-turnoff-when-unused --zone=europe-west4-a --command 'cd /mnt/disks/sdb/Project/ci_dev/tmp/deploy/images/project && curl -F 'image=@*.raucb' http://upload.url.com/upload'"
Now the issue is that it looks that curl -F doesn't accept wildcards, is it possible to get this done?
Upvotes: 1
Views: 1286
Reputation: 347
Note that your command has two sets of ' ' one inside another without backspaces
In any case,
gcloud compute ssh build-server-turnoff-when-unused --zone=europe-west4-a --command "bash -c 'cd /mnt/disks/sdb/Project/ci_dev/tmp/deploy/images/project && for fileimg in *.raucb; do curl -F image="\${fileimg}" http://upload.url.com/upload ; done '"
Notes:
cd &&
instead of cd ;
so that if cd fails, the for does not run"
inside single '
inside double "
to avoid excess escaping (alternate quotes trick)for fileimg in *.raucb
the var $fileimg will contain full filename\$
or it gets interpreted by parent shellUpvotes: 1