Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: gracefully skip pinned images #1277

Merged
merged 3 commits into from
May 27, 2022
Merged

fix: gracefully skip pinned images #1277

merged 3 commits into from
May 27, 2022

Conversation

piksel
Copy link
Member

@piksel piksel commented Apr 28, 2022

This PR adds a check when pulling images to see whether it's a pinned image hash, and skips the image with a message identifying the problem.

Before:

INFO[0001] Running a one time update.
WARN[0002] Could not do a head request for "sha256:fa5269854a5e615e51a72b17ad3fd1e01268f278a6684c8ed3c5f0cdce3f230b", falling back to regular pull.  container=/shatest1 image="sha256:fa5269854a5e615e51a72b17ad3fd1e01268f278a6684c8ed3c5f0cdce3f230b"
WARN[0002] Reason: registry responded to head request with "401 Unauthorized", auth: "Bearer realm=\"https://auth.docker.io/token\",service=\"registry.docker.io\",scope=\"repository:library/sha256:pull\",error=\"insufficient_scope\""  container=/shatest1 image="sha256:fa5269854a5e615e51a72b17ad3fd1e01268f278a6684c8ed3c5f0cdce3f230b"
INFO[0003] Unable to update container "/shatest1": Error response from daemon: pull access denied for sha256, repository does not exist or may require 'docker login': denied: requested access to the resource is denied. Proceeding to next.
INFO[0003] Session done                                  Failed=0 Scanned=1 Updated=0 notify=no
INFO[0003] Waiting for the notification goroutine to finish  notify=no

After:

INFO[0001] Running a one time update.
INFO[0001] Unable to update container "/shatest1": container uses a pinned image, and cannot be updated by watchtower. Proceeding to next.
INFO[0001] Session done                                  Failed=0 Scanned=1 Updated=0 notify=no
INFO[0001] Waiting for the notification goroutine to finish  notify=no

Additionally, this puts all the options for the docker client wrapper in a struct for increased legibility.

@piksel piksel requested a review from simskij as a code owner April 28, 2022 08:41
@codecov
Copy link

codecov bot commented Apr 28, 2022

Codecov Report

Merging #1277 (20806d4) into main (56368a7) will increase coverage by 0.51%.
The diff coverage is 50.00%.

@@            Coverage Diff             @@
##             main    #1277      +/-   ##
==========================================
+ Coverage   63.13%   63.65%   +0.51%     
==========================================
  Files          23       23              
  Lines        1530     1527       -3     
==========================================
+ Hits          966      972       +6     
+ Misses        474      465       -9     
  Partials       90       90              
Impacted Files Coverage Δ
pkg/container/client.go 30.80% <50.00%> (+2.88%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 56368a7...20806d4. Read the comment docs.

@piksel piksel merged commit e983beb into main May 27, 2022
@piksel piksel deleted the fix/graceful-sticky-fails branch May 27, 2022 10:16
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.

None yet

2 participants