Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F8393658
update_docker_image.sh.erb
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
667 B
Subscribers
None
update_docker_image.sh.erb
View Options
#!/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
Details
Attached
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
Attached To
R205 puppet-puppetlabs-docker
Event Timeline
Log In to Comment