ContainerRegistryClient#
AUTH_FILES = ['${XDG_CONFIG_HOME}/containers/auth.json', '${HOME}/.docker/config.json', '${REGISTRY_AUTH_FILE}']
module-attribute
#
Default authentication files to search for credentials in container registry client.
AuthTokenWrapper
dataclass
#
Carrier of the auth token for container registry.
Source code in pubtools/sign/clients/registry.py
26 27 28 29 30 |
|
ContainerRegistryClient
#
Client for interacting with container registries.
Source code in pubtools/sign/clients/registry.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 |
|
session
property
#
Get the session object.
Returns:
Type | Description |
---|---|
Session
|
requests.Session: The session object for making HTTP requests. |
__init__(username=None, password=None, auth_file=None, retries=5, log_level='INFO')
#
Initialize.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
username
|
Optional[str]
|
Username for authentication. |
None
|
password
|
Optional[str]
|
Password for authentication. |
None
|
auth_file
|
Optional[str]
|
Path to the auth file. |
None
|
retries
|
int
|
Number of retries for HTTP requests. |
5
|
Source code in pubtools/sign/clients/registry.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
|
authenticate_to_registry(image_reference, auth_header)
#
Ask for auth token based on given auth header.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
image_reference
|
str
|
Image reference to resolve authentication for. |
required |
auth_header
|
str
|
Authentication header from the registry. |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
Union[str, Any]
|
Authentication token. |
Source code in pubtools/sign/clients/registry.py
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
|
check_container_image_exists(image_reference, auth_token)
#
Check if the given container image exists.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
image_reference
|
str
|
Image reference to check. |
required |
auth_token
|
AuthTokenWrapper
|
Authentication token. |
required |
Returns:
Type | Description |
---|---|
bool
|
Tuple[bool, str]: [True, ""] if the image exists, |
str
|
Tuple[False, |
Source code in pubtools/sign/clients/registry.py
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 |
|
resolve_authentication(image_reference)
#
Resolve authentication for the given image reference.
When username and password are provided in registry client, they are used.
Otherwise AUTH_FILES
are search for specific authentication
entry based on host of image reference.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
image_reference
|
str
|
Image reference to resolve authentication for. |
required |
Returns:
Type | Description |
---|---|
Tuple[str, str]
|
Tuple[str, str]: Username and password for authentication. |
Source code in pubtools/sign/clients/registry.py
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
|