drop install_type almost everywhere

The only place where it stays is argument parsing where it gets ignored.

Hardcoded to 'source' to make merging both kolla and kolla-ansible
changes easier.

Change-Id: I6890a7ec7baf507f8acd75b42bbd0fb17c2e4511
Depends-On: https://review.opendev.org/c/openstack/kolla-ansible/+/837620
This commit is contained in:
Marcin Juszkiewicz 2022-04-11 12:32:19 +02:00
parent c4fda7baa3
commit 1b697cc69b
8 changed files with 68 additions and 85 deletions

View File

@ -57,7 +57,6 @@
nodeset: kolla-centos8-stream nodeset: kolla-centos8-stream
vars: vars:
base_distro: centos base_distro: centos
install_type: source
- job: - job:
name: kolla-build-centos8s-aarch64 name: kolla-build-centos8s-aarch64
@ -93,4 +92,3 @@
nodeset: kolla-centos8-stream nodeset: kolla-centos8-stream
vars: vars:
base_distro: centos base_distro: centos
install_type: source

View File

@ -35,7 +35,6 @@
nodeset: kolla-debian-bullseye nodeset: kolla-debian-bullseye
vars: vars:
base_distro: debian base_distro: debian
install_type: source
- job: - job:
name: kolla-build-debian-aarch64 name: kolla-build-debian-aarch64
@ -92,4 +91,3 @@
nodeset: kolla-debian-bullseye nodeset: kolla-debian-bullseye
vars: vars:
base_distro: debian base_distro: debian
install_type: source

View File

@ -55,7 +55,6 @@
nodeset: kolla-ubuntu-focal nodeset: kolla-ubuntu-focal
vars: vars:
base_distro: ubuntu base_distro: ubuntu
install_type: source
- job: - job:
name: kolla-build-ubuntu-aarch64 name: kolla-build-ubuntu-aarch64
@ -91,4 +90,3 @@
nodeset: kolla-ubuntu-focal nodeset: kolla-ubuntu-focal
vars: vars:
base_distro: ubuntu base_distro: ubuntu
install_type: source

View File

@ -168,5 +168,3 @@ scripts:
* **KOLLA_BASE_DISTRO**: ``base_distro`` used to build the image (e.g. centos, * **KOLLA_BASE_DISTRO**: ``base_distro`` used to build the image (e.g. centos,
ubuntu) ubuntu)
* **KOLLA_INSTALL_TYPE**: ``install_type`` used to build the image (binary,
source)

View File

@ -202,10 +202,11 @@ _CLI_OPTS = [
help='Format to write the final results in'), help='Format to write the final results in'),
cfg.StrOpt('tarballs-base', default=TARBALLS_BASE, cfg.StrOpt('tarballs-base', default=TARBALLS_BASE,
help='Base url to OpenStack tarballs'), help='Base url to OpenStack tarballs'),
# NOTE(hrw): deprecate argument in Zed, remove in A-cycle
cfg.StrOpt('type', short='t', default='source', cfg.StrOpt('type', short='t', default='source',
choices=INSTALL_TYPE_CHOICES, choices=INSTALL_TYPE_CHOICES,
dest='install_type', dest='install_type',
help=('The method of the OpenStack install.')), help=('Ignored, kept for script compatibility.')),
cfg.IntOpt('threads', short='T', default=8, min=1, cfg.IntOpt('threads', short='T', default=8, min=1,
help=('The number of threads to use while building.' help=('The number of threads to use while building.'
' (Note: setting to one will allow real time' ' (Note: setting to one will allow real time'

View File

@ -75,9 +75,9 @@ STATUS_ERRORS = (Status.CONNECTION_ERROR, Status.PUSH_ERROR,
LOG = utils.make_a_logger() LOG = utils.make_a_logger()
# The dictionary of unbuildable images supports keys in the format: # The dictionary of unbuildable images supports keys in the format:
# '<distro>+<installation_type>+<arch>' where each component is optional # '<distro>+<arch>' where each component is optional and can be omitted along
# and can be omitted along with the + separator which means that component # with the + separator which means that component is irrelevant. Otherwise all
# is irrelevant. Otherwise all must match for skip to happen. # must match for skip to happen.
UNBUILDABLE_IMAGES = { UNBUILDABLE_IMAGES = {
'aarch64': { 'aarch64': {
"bifrost-base", # someone need to get upstream working first "bifrost-base", # someone need to get upstream working first
@ -478,27 +478,26 @@ class BuildTask(DockerTask):
if image.status in STATUS_ERRORS: if image.status in STATUS_ERRORS:
return return
if self.conf.install_type == 'source': try:
try: plugins_am = make_an_archive(image.plugins, 'plugins')
plugins_am = make_an_archive(image.plugins, 'plugins') except ArchivingError:
except ArchivingError: self.logger.error(
self.logger.error( "Failed turning any plugins into a plugins archive")
"Failed turning any plugins into a plugins archive") return
return else:
else: self.logger.debug(
self.logger.debug( "Turned %s plugins into plugins archive",
"Turned %s plugins into plugins archive", plugins_am)
plugins_am) try:
try: additions_am = make_an_archive(image.additions, 'additions')
additions_am = make_an_archive(image.additions, 'additions') except ArchivingError:
except ArchivingError: self.logger.error(
self.logger.error( "Failed turning any additions into a additions archive")
"Failed turning any additions into a additions archive") return
return else:
else: self.logger.debug(
self.logger.debug( "Turned %s additions into additions archive",
"Turned %s additions into additions archive", additions_am)
additions_am)
# Pull the latest image for the base distro only # Pull the latest image for the base distro only
pull = self.conf.pull if image.parent is None else False pull = self.conf.pull if image.parent is None else False
@ -610,7 +609,6 @@ class KollaWorker(object):
self.base = conf.base self.base = conf.base
self.use_dumb_init = conf.use_dumb_init self.use_dumb_init = conf.use_dumb_init
self.base_tag = conf.base_tag self.base_tag = conf.base_tag
self.install_type = conf.install_type
self.tag = conf.tag self.tag = conf.tag
self.base_arch = conf.base_arch self.base_arch = conf.base_arch
self.debian_arch = self.base_arch self.debian_arch = self.base_arch
@ -649,7 +647,8 @@ class KollaWorker(object):
self.clean_package_cache = self.conf.clean_package_cache self.clean_package_cache = self.conf.clean_package_cache
self.image_prefix = self.base + '-' + self.install_type + '-' # TODO(hrw): to remove "source-" in a later patch
self.image_prefix = self.base + '-source-'
self.regex = conf.regex self.regex = conf.regex
self.image_statuses_bad = dict() self.image_statuses_bad = dict()
@ -834,7 +833,6 @@ class KollaWorker(object):
'docker_healthchecks': self.docker_healthchecks, 'docker_healthchecks': self.docker_healthchecks,
'supported_distro_name': supported_distro_name, 'supported_distro_name': supported_distro_name,
'image_prefix': self.image_prefix, 'image_prefix': self.image_prefix,
'install_type': self.install_type,
'namespace': self.namespace, 'namespace': self.namespace,
'openstack_release': self.openstack_release, 'openstack_release': self.openstack_release,
'tag': self.tag, 'tag': self.tag,
@ -924,9 +922,7 @@ class KollaWorker(object):
# mark unbuildable images and their children # mark unbuildable images and their children
base = self.base base = self.base
tag_element = r'(%s|%s|%s)' % (base, tag_element = r'(%s|%s)' % (base, self.base_arch)
self.install_type,
self.base_arch)
tag_re = re.compile(r'^%s(\+%s)*$' % (tag_element, tag_element)) tag_re = re.compile(r'^%s(\+%s)*$' % (tag_element, tag_element))
unbuildable_images = set() unbuildable_images = set()
@ -1159,41 +1155,40 @@ class KollaWorker(object):
logger=utils.make_a_logger(self.conf, image_name), logger=utils.make_a_logger(self.conf, image_name),
docker_client=self.dc) docker_client=self.dc)
if self.install_type == 'source': # NOTE(jeffrey4l): register the opts if the section didn't
# NOTE(jeffrey4l): register the opts if the section didn't # register in the kolla/common/config.py file
# register in the kolla/common/config.py file if image.name not in self.conf._groups:
if image.name not in self.conf._groups: self.conf.register_opts(common_config.get_source_opts(),
self.conf.register_opts(common_config.get_source_opts(), image.name)
image.name) image.source = process_source_installation(image, image.name)
image.source = process_source_installation(image, image.name) for plugin in [match.group(0) for match in
for plugin in [match.group(0) for match in (re.search('^{}-plugin-.+'.format(image.name),
(re.search('^{}-plugin-.+'.format(image.name), section) for section in
section) for section in all_sections) if match]:
all_sections) if match]: try:
try: self.conf.register_opts(
self.conf.register_opts( common_config.get_source_opts(),
common_config.get_source_opts(), plugin
plugin )
) except cfg.DuplicateOptError:
except cfg.DuplicateOptError: LOG.debug('Plugin %s already registered in config',
LOG.debug('Plugin %s already registered in config', plugin)
plugin) image.plugins.append(
image.plugins.append( process_source_installation(image, plugin))
process_source_installation(image, plugin)) for addition in [
for addition in [ match.group(0) for match in
match.group(0) for match in (re.search('^{}-additions-.+'.format(image.name),
(re.search('^{}-additions-.+'.format(image.name), section) for section in all_sections) if match]:
section) for section in all_sections) if match]: try:
try: self.conf.register_opts(
self.conf.register_opts( common_config.get_source_opts(),
common_config.get_source_opts(), addition
addition )
) except cfg.DuplicateOptError:
except cfg.DuplicateOptError: LOG.debug('Addition %s already registered in config',
LOG.debug('Addition %s already registered in config', addition)
addition) image.additions.append(
image.additions.append( process_source_installation(image, addition))
process_source_installation(image, addition))
self.images.append(image) self.images.append(image)

View File

@ -373,9 +373,6 @@ class KollaWorkerTest(base.TestCase):
build.KollaWorker(self.conf) build.KollaWorker(self.conf)
def test_build_image_list_adds_plugins(self): def test_build_image_list_adds_plugins(self):
self.conf.set_override('install_type', 'source')
kolla = build.KollaWorker(self.conf) kolla = build.KollaWorker(self.conf)
kolla.setup_working_dir() kolla.setup_working_dir()
kolla.find_dockerfiles() kolla.find_dockerfiles()
@ -401,8 +398,6 @@ class KollaWorkerTest(base.TestCase):
self.fail('Can not find the expected neutron arista plugin') self.fail('Can not find the expected neutron arista plugin')
def test_build_image_list_skips_disabled_plugins(self): def test_build_image_list_skips_disabled_plugins(self):
self.conf.set_override('install_type', 'source')
self.conf.set_override('enabled', False, self.conf.set_override('enabled', False,
'neutron-base-plugin-networking-baremetal') 'neutron-base-plugin-networking-baremetal')
@ -426,8 +421,6 @@ class KollaWorkerTest(base.TestCase):
def test_build_image_list_plugin_parsing(self): def test_build_image_list_plugin_parsing(self):
"""Ensure regex used to parse plugins adds them to the correct image""" """Ensure regex used to parse plugins adds them to the correct image"""
self.conf.set_override('install_type', 'source')
kolla = build.KollaWorker(self.conf) kolla = build.KollaWorker(self.conf)
kolla.setup_working_dir() kolla.setup_working_dir()
kolla.find_dockerfiles() kolla.find_dockerfiles()
@ -443,7 +436,6 @@ class KollaWorkerTest(base.TestCase):
self.fail('Expected to find the base image in this test') self.fail('Expected to find the base image in this test')
def test_set_time(self): def test_set_time(self):
self.conf.set_override('install_type', 'source')
kolla = build.KollaWorker(self.conf) kolla = build.KollaWorker(self.conf)
kolla.setup_working_dir() kolla.setup_working_dir()
kolla.set_time() kolla.set_time()
@ -543,7 +535,6 @@ class KollaWorkerTest(base.TestCase):
def test_build_distro_python_version_debian(self): def test_build_distro_python_version_debian(self):
"""check distro_python_version for Debian""" """check distro_python_version for Debian"""
self.conf.set_override('base', 'debian') self.conf.set_override('base', 'debian')
self.conf.set_override('install_type', 'source')
kolla = build.KollaWorker(self.conf) kolla = build.KollaWorker(self.conf)
self.assertEqual('3.9', kolla.distro_python_version) self.assertEqual('3.9', kolla.distro_python_version)
@ -569,7 +560,6 @@ class KollaWorkerTest(base.TestCase):
def test_build_distro_package_manager_debian(self): def test_build_distro_package_manager_debian(self):
"""check distro_package_manager apt for debian""" """check distro_package_manager apt for debian"""
self.conf.set_override('base', 'debian') self.conf.set_override('base', 'debian')
self.conf.set_override('install_type', 'source')
kolla = build.KollaWorker(self.conf) kolla = build.KollaWorker(self.conf)
self.assertEqual('apt', kolla.distro_package_manager) self.assertEqual('apt', kolla.distro_package_manager)
@ -588,7 +578,6 @@ class KollaWorkerTest(base.TestCase):
def test_base_package_type_debian(self): def test_base_package_type_debian(self):
"""check base_package_type deb for debian""" """check base_package_type deb for debian"""
self.conf.set_override('base', 'debian') self.conf.set_override('base', 'debian')
self.conf.set_override('install_type', 'source')
kolla = build.KollaWorker(self.conf) kolla = build.KollaWorker(self.conf)
self.assertEqual('deb', kolla.base_package_type) self.assertEqual('deb', kolla.base_package_type)

View File

@ -0,0 +1,6 @@
---
deprecations:
- |
Use of ``install_type`` argument is now deprecated. We no longer support
other values than ``source`` therefore handling of argument was dropped.
Please update your scripts as it will be removed in A-cycle.