diff options
| author | Zuul <zuul@review.opendev.org> | 2026-07-30 21:22:19 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2026-07-30 21:22:19 +0000 |
| commit | 495b6b8fe437a06f32575b7308192ffc4f76f7b9 (patch) | |
| tree | 2a3e1131ae44f7376ed92f2610d9409597f5a0df /kolla/image/kolla_worker.py | |
| parent | 4b869009c3336ab0f68353e71fcef30dd4cf44b3 (diff) | |
| parent | 71867b8e57273ffcc26f4fedd84919b2608da3f2 (diff) | |
| download | kolla-495b6b8fe437a06f32575b7308192ffc4f76f7b9.tar.gz kolla-495b6b8fe437a06f32575b7308192ffc4f76f7b9.zip | |
Merge "Move PIP_* env variables to ARG and config"
Diffstat (limited to 'kolla/image/kolla_worker.py')
| -rw-r--r-- | kolla/image/kolla_worker.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/kolla/image/kolla_worker.py b/kolla/image/kolla_worker.py index 1dc37e2a6..b54e81bea 100644 --- a/kolla/image/kolla_worker.py +++ b/kolla/image/kolla_worker.py @@ -411,6 +411,21 @@ class KollaWorker(object): env.globals.update(self._get_methods()) template = env.get_template(template_name) content = template.render(values, env=os.environ) + pip_args = [ + 'ARG {}'.format(k) + for k, v in ( + ('PIP_INDEX_URL', self.conf.pip_index_url), + ('PIP_TRUSTED_HOST', self.conf.pip_trusted_host), + ('PIP_EXTRA_INDEX_URL', self.conf.pip_extra_index_url), + ) if v + ] + if pip_args: + lines = content.split('\n') + for i, line in enumerate(lines): + if line.startswith('FROM '): + lines[i + 1:i + 1] = pip_args + break + content = '\n'.join(lines) content_path = os.path.join(path, 'Dockerfile') with open(content_path, 'w') as f: LOG.debug("Rendered %s into:", tpl_path) |
