| 319 | return self._result(self._post(url, params=params), True) |
| 320 | |
| 321 | def _set_auth_headers(self, headers): |
| 322 | log.debug('Looking for auth config') |
| 323 | |
| 324 | # If we don't have any auth data so far, try reloading the config |
| 325 | # file one more time in case anything showed up in there. |
| 326 | if not self._auth_configs or self._auth_configs.is_empty: |
| 327 | log.debug("No auth config in memory - loading from filesystem") |
| 328 | self._auth_configs = auth.load_config( |
| 329 | credstore_env=self.credstore_env |
| 330 | ) |
| 331 | |
| 332 | # Send the full auth configuration (if any exists), since the build |
| 333 | # could use any (or all) of the registries. |
| 334 | if self._auth_configs: |
| 335 | auth_data = self._auth_configs.get_all_credentials() |
| 336 | |
| 337 | # See https://github.com/docker/docker-py/issues/1683 |
| 338 | if (auth.INDEX_URL not in auth_data and |
| 339 | auth.INDEX_NAME in auth_data): |
| 340 | auth_data[auth.INDEX_URL] = auth_data.get(auth.INDEX_NAME, {}) |
| 341 | |
| 342 | log.debug( |
| 343 | "Sending auth config (%s)", |
| 344 | ', '.join(repr(k) for k in auth_data), |
| 345 | ) |
| 346 | |
| 347 | if auth_data: |
| 348 | headers['X-Registry-Config'] = auth.encode_header( |
| 349 | auth_data |
| 350 | ) |
| 351 | else: |
| 352 | log.debug('No auth config found') |
| 353 | |
| 354 | |
| 355 | def process_dockerfile(dockerfile, path): |