Skip to content

Set X-Registry-Auth header on manifest push and bump to new API #536

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

dklimpel
Copy link
Contributor

@dklimpel dklimpel commented Apr 9, 2025

I was already unable to use the old API with Podman 4.9

The current implementation for image push:

def push(
self, repository: str, tag: Optional[str] = None, **kwargs
) -> Union[str, Iterator[Union[str, dict[str, Any]]]]:
"""Push Image or repository to the registry.
Args:
repository: Target repository for push
tag: Tag to push, if given
Keyword Args:
auth_config (Mapping[str, str]: Override configured credentials. Must include
username and password keys.
decode (bool): return data from server as dict[str, Any]. Ignored unless stream=True.
destination (str): alternate destination for image. (Podman only)
stream (bool): return output as blocking generator. Default: False.
tlsVerify (bool): Require TLS verification.
format (str): Manifest type (oci, v2s1, or v2s2) to use when pushing an image.
Default is manifest type of source, with fallbacks.
Raises:
APIError: when service returns an error
"""
auth_config: Optional[dict[str, str]] = kwargs.get("auth_config")
headers = {
# A base64url-encoded auth configuration
"X-Registry-Auth": encode_auth_header(auth_config) if auth_config else ""
}

@dklimpel dklimpel force-pushed the fix_push_manifest branch from 1eeb166 to e53a67a Compare April 9, 2025 06:23
@dklimpel
Copy link
Contributor Author

dklimpel commented Apr 9, 2025

/assign umohnani8

@jwhonce
Copy link
Member

jwhonce commented Apr 10, 2025

@dklimpel Please add a test. TIA

/approve

Copy link
Contributor

openshift-ci bot commented Apr 10, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dklimpel, jwhonce

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@dklimpel dklimpel force-pushed the fix_push_manifest branch from bb2cf26 to 16257d5 Compare April 12, 2025 10:22
Signed-off-by: dklimpel <[email protected]>
@dklimpel
Copy link
Contributor Author

I have added some tests.

The failing test of CI podman/tests/integration/test_pods.py::PodsIntegrationTest::test_pod_crud seems to be unrelated.

The tests detected a wrong return type of encode_auth_header.

@inknos
Copy link
Contributor

inknos commented Apr 14, 2025

/packit retest-failed

1 similar comment
@inknos
Copy link
Contributor

inknos commented Apr 14, 2025

/packit retest-failed

@inknos
Copy link
Contributor

inknos commented Apr 14, 2025

test flakes addressed, LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants