stdlib/aws/s3: replaced sync with cp by default to avoid cache issues
Signed-off-by: Sam Alba <sam.alba@gmail.com>
This commit is contained in:
parent
eadd075254
commit
35fb7e0cfc
@ -28,6 +28,9 @@ import (
|
|||||||
// Always write the object to S3
|
// Always write the object to S3
|
||||||
always: *true | false @dagger(input)
|
always: *true | false @dagger(input)
|
||||||
|
|
||||||
|
// Upload method
|
||||||
|
uploadMethod: *"cp" | "sync"
|
||||||
|
|
||||||
// URL of the uploaded S3 object
|
// URL of the uploaded S3 object
|
||||||
url: {
|
url: {
|
||||||
string
|
string
|
||||||
@ -49,6 +52,7 @@ import (
|
|||||||
if delete {
|
if delete {
|
||||||
OPT_DELETE: "1"
|
OPT_DELETE: "1"
|
||||||
}
|
}
|
||||||
|
UPLOAD_METHOD: uploadMethod
|
||||||
}
|
}
|
||||||
|
|
||||||
mount: "/source": from: source
|
mount: "/source": from: source
|
||||||
@ -62,12 +66,22 @@ import (
|
|||||||
"-c",
|
"-c",
|
||||||
#"""
|
#"""
|
||||||
opts=()
|
opts=()
|
||||||
if [ -d /source ]; then
|
case "$UPLOAD_METHOD" in
|
||||||
op=sync
|
sync)
|
||||||
fi
|
[ -n "$OPT_DELETE" ] && opts+="--delete"
|
||||||
|
opts+="--exact-timestamps"
|
||||||
|
;;
|
||||||
|
cp)
|
||||||
|
opts+="--recursive"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "not supported command"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
[ -n "$OPT_CONTENT_TYPE" ] && opts+="--content-type $OPT_CONTENT_TYPE"
|
[ -n "$OPT_CONTENT_TYPE" ] && opts+="--content-type $OPT_CONTENT_TYPE"
|
||||||
[ -n "$OPT_DELETE" ] && opts+="--delete"
|
[ -n "$OPT_DELETE" ] && opts+="--delete"
|
||||||
aws s3 sync ${opts[@]} /source "$TARGET"
|
aws s3 "$UPLOAD_METHOD" ${opts[@]} /source "$TARGET"
|
||||||
echo -n "$TARGET" \
|
echo -n "$TARGET" \
|
||||||
| sed -E 's=^s3://([^/]*)/=https://\1.s3.amazonaws.com/=' \
|
| sed -E 's=^s3://([^/]*)/=https://\1.s3.amazonaws.com/=' \
|
||||||
> /url
|
> /url
|
||||||
|
Reference in New Issue
Block a user