diff options
| author | Michal Nasiadka <mnasiadka@gmail.com> | 2026-06-16 22:15:29 +0200 |
|---|---|---|
| committer | Michal Nasiadka <mnasiadka@gmail.com> | 2026-07-30 15:55:31 +0200 |
| commit | 71867b8e57273ffcc26f4fedd84919b2608da3f2 (patch) | |
| tree | a5b6b1a3d9f1d9c033db7312b033a055d54aedfc /kolla/image | |
| parent | 5d77668da8167435e4ac860392994f19ec733a46 (diff) | |
| download | kolla-71867b8e57273ffcc26f4fedd84919b2608da3f2.tar.gz kolla-71867b8e57273ffcc26f4fedd84919b2608da3f2.zip | |
Move PIP_* env variables to ARG and config
Leaving empty CI template_overrides file in case
we need to use it in future.
Change-Id: Ic46f1a594bcc330536bc78d93ece10e60622f6d4
Signed-off-by: Michal Nasiadka <mnasiadka@gmail.com>
Diffstat (limited to 'kolla/image')
| -rw-r--r-- | kolla/image/kolla_worker.py | 15 | ||||
| -rw-r--r-- | kolla/image/tasks.py | 9 |
2 files changed, 24 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) diff --git a/kolla/image/tasks.py b/kolla/image/tasks.py index 9eec24a8f..ba2ade743 100644 --- a/kolla/image/tasks.py +++ b/kolla/image/tasks.py @@ -304,6 +304,15 @@ class BuildTask(EngineTask): if proxy_var in os.environ and proxy_var not in buildargs: buildargs[proxy_var] = os.environ.get(proxy_var) + pip_vars = ( + ('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), + ) + for pip_var, value in pip_vars: + if value and pip_var not in buildargs: + buildargs[pip_var] = value + if not buildargs: return None return buildargs |
