Skip to content

Add option to run deploy only if image update available#7

Open
arne-kroeger wants to merge 1 commit into
wowu:mainfrom
arne-kroeger:main
Open

Add option to run deploy only if image update available#7
arne-kroeger wants to merge 1 commit into
wowu:mainfrom
arne-kroeger:main

Conversation

@arne-kroeger
Copy link
Copy Markdown

This commit adds an option to run the deploy only if the referenced image has an update from remote.

This can be used to minimize load if update not necessary or script is running in crons.

@c4710n
Copy link
Copy Markdown

c4710n commented Oct 13, 2023

This would be more solid by comparing docker config --hash output and com.docker.compose.config-hash container label.

Two related links:

Comment thread docker-rollout
container_id=$(docker ps --filter "label=com.docker.compose.service=$SERVICE" --format "{{.ID}}")

old_image_id=$(docker inspect --format='{{.Image}}' "$container_id")
new_image_id=$(docker manifest inspect "$image_name" | jq -r '.config.digest')
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To loose dependency on jq this line should be:

new_image_id=$(docker inspect "$image_name" --format "{{.Id}}")

Comment thread docker-rollout

checkForUpdates() {
if ! command -v jq > /dev/null 2>&1; then
echo "jq is required for update-only"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be great to not depend on jq

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants