Page MenuHomeSoftware Heritage

update_docker_image.sh.erb
No OneTemporary

update_docker_image.sh.erb

#!/bin/bash
#
# Pulls a docker image.
# Returns 0 if there a change.
# Returns 2 if there is no change.
# Returns 3 if something when wrong.
#
DOCKER_IMAGE=$1
BEFORE=$(docker inspect --type image --format='{{.Id}}' ${DOCKER_IMAGE} 2>/dev/null)
<%= @docker_command -%> pull ${DOCKER_IMAGE}
AFTER=$(docker inspect --type image --format='{{.Id}}' ${DOCKER_IMAGE} 2>/dev/null)
if [[ -z $AFTER ]]; then
echo "Docker image ${DOCKER_IMAGE} failed to pull!"
exit 3
elif [[ $BEFORE == $AFTER ]]; then
echo "No updates to ${DOCKER_IMAGE} available. Currently on ${AFTER}."
exit 2
else
echo "${DOCKER_IMAGE} updated. Changed from ${BEFORE} to ${AFTER}."
exit 0
fi

File Metadata

Mime Type
text/x-shellscript
Expires
Wed, Jun 4, 7:15 PM (4 d, 18 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3214130

Event Timeline