check
returns the most recent LastModified timestamp
This allows us to version a whole bucket. Closes #5
This commit is contained in:
parent
252f337121
commit
5badf04978
2 changed files with 14 additions and 2 deletions
|
@ -68,3 +68,5 @@ Requires [Docker](https://www.docker.com/).
|
|||
* Exclude the `s3://` prefix/protocol for `bucket`.
|
||||
|
||||
1. Run `./test/out </full/path/to/dir>`.
|
||||
1. Run `./test/in </full/path/to/dir>`.
|
||||
1. Run `./test/check`.
|
||||
|
|
14
assets/check
14
assets/check
|
@ -4,5 +4,15 @@
|
|||
|
||||
set -e
|
||||
|
||||
# pretend that "the given version is already the latest"
|
||||
echo "[]"
|
||||
# parse incoming config data
|
||||
payload=`cat`
|
||||
bucket=$(echo "$payload" | jq -r '.source.bucket')
|
||||
|
||||
# export for `aws` cli
|
||||
export AWS_ACCESS_KEY_ID=$(echo "$payload" | jq -r '.source.access_key_id')
|
||||
export AWS_SECRET_ACCESS_KEY=$(echo "$payload" | jq -r '.source.secret_access_key')
|
||||
|
||||
# Consider the most recent LastModified timestamp as the most recent version.
|
||||
timestamps="$(aws s3api list-objects --bucket $bucket --query 'Contents[].{LastModified: LastModified}')"
|
||||
recent="$(echo $timestamps | jq -r 'max_by(.LastModified)')"
|
||||
echo "[$recent]"
|
||||
|
|
Loading…
Reference in a new issue