Fix date handling for ISO8601 dates
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Florian Brinker 2021-05-10 22:03:02 +02:00
parent 6595011075
commit 7acbe3d55e
1 changed files with 16 additions and 6 deletions

View File

@ -1,13 +1,23 @@
#!/usr/bin/env bash #!/usr/bin/env bash
commitdate=$(curl -sL "https://api.github.com/repos/resoai/TileBoard/commits/master" | jq -r ".commit.author.date") docker_tag_exists() {
commitdays=$(( ( $(date --utc +%s) - $(date --utc -d $commitdate +%s) ) / 86400 )) repo="${1-fbrinker/tileboard}"
echo "Last commit was $commitdays days ago." tag="${2-nightly}"
curl --silent -f -lSL "https://hub.docker.com/v2/repositories/$repo/tags/$tag" > /dev/null 2>&1
}
if [ $commitdays -lt 2 ] ; then commitdate=$(curl -sL "https://api.github.com/repos/resoai/TileBoard/commits/master" | jq -r ".commit.author.date" | sed 's/T/ /; s/Z//')
echo "There ARE recent changes in the repository." commitdays=$(( ( $(date --utc +%s) - $(date --utc -d "$commitdate" +%s) ) / 86400 ))
echo "Last commit was $commitdate and is $commitdays days ago."
if [ $commitdays -lt 2 ]; then
echo "Found recent commits in the repository."
echo "Continuing with pipeline..."
elif [ !docker_tag_exists ]; then
echo "Missing an nightly build."
echo "Continuing with pipeline..."
else else
echo "There are NO recent changes in the repository." echo "No recent commits found."
echo "Aborting pipeline." echo "Aborting pipeline."
exit 78 # drone.io exit code to stop but success the pipeline exit 78 # drone.io exit code to stop but success the pipeline
fi fi