Remove --include-header and --include-footer parameter

In Newton, kolla moved to Dockerfile customization, and
the parameters --included-header and --include-footer
were marked deprecated.  This patch set removes them
in the Ocata release.

Change-Id: I3263c305bf619ab47a31cf4eafe5d4fcfa4aec17
Closes-Bug: #1643967
This commit is contained in:
Tin Lam 2016-11-25 00:14:20 -06:00
parent a8a1c4cc3d
commit 661f2a45c2
4 changed files with 13 additions and 44 deletions

View File

@ -145,21 +145,14 @@ the best use of the docker cache.
type = local type = local
location = /tmp/ironic.tar.gz location = /tmp/ironic.tar.gz
To build RHEL containers, it is necessary to use the ``-i`` (include header) To build RHEL containers, it is necessary to include registration with RHN
feature to include registration with RHN of the container runtime operating of the container runtime operating system. To obtain a RHN
system. To obtain a RHN username/password/pool id, contact Red Hat. username/password/pool id, contact Red Hat. Use a template's header block
overrides file, add the following::
First create a file called ``rhel-include``:
::
RUN subscription-manager register --user=<user-name> --password=<password> \ RUN subscription-manager register --user=<user-name> --password=<password> \
&& subscription-manager attach --pool <pool-id> && subscription-manager attach --pool <pool-id>
Then build RHEL containers::
kolla-build -b rhel -i ./rhel-include
Dockerfile Customisation Dockerfile Customisation
======================== ========================
@ -371,32 +364,22 @@ insecure registry. See
Building behind a proxy Building behind a proxy
----------------------- -----------------------
The build script supports augmenting the Dockerfiles under build via so called We can insert http_proxy settings into the images to
`header` and `footer` files. Statements in the `header` file are included at
the top of the `base` image, while those in `footer` are included at the bottom
of every Dockerfile in the build.
A common use case for this is to insert http_proxy settings into the images to
fetch packages during build, and then unset them at the end to avoid having fetch packages during build, and then unset them at the end to avoid having
them carry through to the environment of the final images. Note however, it's them carry through to the environment of the final images. Note however, it's
not possible to drop the info completely using this method; it will still be not possible to drop the info completely using this method; it will still be
visible in the layers of the image. visible in the layers of the image.
To use this feature, create a file called ``.header``, with the following To set the proxy settings, we can add this to the template's header block::
content for example::
ENV http_proxy=https://evil.corp.proxy:80 ENV http_proxy=https://evil.corp.proxy:80
ENV https_proxy=https://evil.corp.proxy:80 ENV https_proxy=https://evil.corp.proxy:80
Then create another file called ``.footer``, with the following content:: To unset the proxy settings, we can add this to the template's footer block::
ENV http_proxy="" ENV http_proxy=""
ENV https_proxy="" ENV https_proxy=""
Finally, pass them to the build script using the ``-i`` and ``-I`` flags::
kolla-build -i .header -I .footer
Besides this configuration options, the script will automatically read these Besides this configuration options, the script will automatically read these
environment variables. If the host system proxy parameters match the ones environment variables. If the host system proxy parameters match the ones
going to be used, no other input parameters will be needed. These are the going to be used, no other input parameters will be needed. These are the

View File

@ -76,18 +76,6 @@ _CLI_OPTS = [
help='Turn on debugging log level'), help='Turn on debugging log level'),
cfg.DictOpt('build-args', cfg.DictOpt('build-args',
help='Set docker build time variables'), help='Set docker build time variables'),
cfg.StrOpt('include-header', short='i',
deprecated_for_removal=True,
deprecated_reason=('Use a header block within a template'
' overrides file instead'),
help=('Path to custom file to be added at '
'beginning of base Dockerfile')),
cfg.StrOpt('include-footer', short='I',
deprecated_for_removal=True,
deprecated_reason=('Use a footer block within a template'
' overrides file instead'),
help=('Path to custom file to be added at '
'end of Dockerfiles for final images')),
cfg.BoolOpt('keep', default=False, cfg.BoolOpt('keep', default=False,
help='Keep failed intermediate containers'), help='Keep failed intermediate containers'),
cfg.BoolOpt('list-dependencies', short='l', cfg.BoolOpt('list-dependencies', short='l',

8
kolla/image/build.py Normal file → Executable file
View File

@ -526,8 +526,6 @@ class KollaWorker(object):
self.image_prefix = self.base + '-' + self.install_type + '-' self.image_prefix = self.base + '-' + self.install_type + '-'
self.include_header = conf.include_header
self.include_footer = conf.include_footer
self.regex = conf.regex self.regex = conf.regex
self.image_statuses_bad = dict() self.image_statuses_bad = dict()
self.image_statuses_good = dict() self.image_statuses_good = dict()
@ -669,12 +667,6 @@ class KollaWorker(object):
env.filters.update(self._get_filters()) env.filters.update(self._get_filters())
env.globals.update(self._get_methods()) env.globals.update(self._get_methods())
template = env.get_template(template_name) template = env.get_template(template_name)
if self.include_header:
with open(self.include_header, 'r') as f:
values['include_header'] = f.read()
if self.include_footer:
with open(self.include_footer, 'r') as f:
values['include_footer'] = f.read()
content = template.render(values) content = template.render(values)
content_path = os.path.join(path, 'Dockerfile') content_path = os.path.join(path, 'Dockerfile')
with open(content_path, 'w') as f: with open(content_path, 'w') as f:

View File

@ -0,0 +1,6 @@
---
upgrade:
- The --include-header and --include-footer parameters were deprecated
as of the Newton release. They should be move use header and footer
block in template overrides file. The two parameters are removed in
the Ocata-release.