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

storage: fix compatibility on fetching token for registry backend #1443

Merged
merged 2 commits into from
Oct 20, 2023

Conversation

imeoer
Copy link
Collaborator

@imeoer imeoer commented Oct 18, 2023

Details

The registry backend received an unauthorized error from Harbor registry
when fetching registry token by HTTP GET method, the bug is introduced
from https://github.com/dragonflyoss/image-service/pull/1425/files#diff-f7ce8f265a570c66eae48c85e0f5b6f29fdaec9cf2ee2eded95810fe320d80e1L263.

We should insert the basic auth header to ensure the compatibility of
fetching token by HTTP GET method.

This refers to containerd implementation: https://github.com/containerd/containerd/blob/dc7dba9c20f7210c38e8255487fc0ee12692149d/remotes/docker/auth/fetch.go#L187

The change has been tested for Harbor v2.9.

Types of changes

What types of changes does your PullRequest introduce? Put an x in all the boxes that apply:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation Update (if none of the other choices apply)

Checklist

Go over all the following points, and put an x in all the boxes that apply.

  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.

The registry backend received an unauthorized error from Harbor registry
when fetching registry token by HTTP GET method, the bug is introduced
from https://github.com/dragonflyoss/image-service/pull/1425/files#diff-f7ce8f265a570c66eae48c85e0f5b6f29fdaec9cf2ee2eded95810fe320d80e1L263.

We should insert the basic auth header to ensure the compatibility of
fetching token by HTTP GET method.

This refers to containerd implementation: https://github.com/containerd/containerd/blob/dc7dba9c20f7210c38e8255487fc0ee12692149d/remotes/docker/auth/fetch.go#L187

The change has been tested for Harbor v2.9.

Signed-off-by: Yan Song <yansong.ys@antgroup.com>
Regardless of whether debug compilation is enabled, we should
always print error messages. Otherwise, some error logs may be
lost, making it difficult to debug codes.

Signed-off-by: Yan Song <yansong.ys@antgroup.com>
@imeoer imeoer requested a review from a team as a code owner October 18, 2023 07:16
@imeoer imeoer requested review from jiangliu, gaius-qi and hsiangkao and removed request for a team October 18, 2023 07:16
@codecov
Copy link

codecov bot commented Oct 18, 2023

Codecov Report

Merging #1443 (2d43640) into master (5c63ba9) will decrease coverage by 0.03%.
The diff coverage is 19.23%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1443      +/-   ##
==========================================
- Coverage   46.29%   46.26%   -0.03%     
==========================================
  Files         123      123              
  Lines       38872    38878       +6     
  Branches    38872    38878       +6     
==========================================
- Hits        17995    17987       -8     
- Misses      19906    19918      +12     
- Partials      971      973       +2     
Files Coverage Δ
api/src/error.rs 67.74% <33.33%> (ø)
storage/src/backend/registry.rs 32.16% <17.39%> (-0.78%) ⬇️

... and 3 files with indirect coverage changes

@imeoer imeoer merged commit 9632d18 into dragonflyoss:master Oct 20, 2023
23 of 24 checks passed
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