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
vars:
base_distro: centos
install_type: source
- job:
name: kolla-build-centos8s-aarch64
@ -93,4 +92,3 @@
nodeset: kolla-centos8-stream
vars:
base_distro: centos
install_type: source

View File

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

View File

@ -55,7 +55,6 @@
nodeset: kolla-ubuntu-focal
vars:
base_distro: ubuntu
install_type: source
- job:
name: kolla-build-ubuntu-aarch64
@ -91,4 +90,3 @@
nodeset: kolla-ubuntu-focal
vars:
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,
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'),
cfg.StrOpt('tarballs-base', default=TARBALLS_BASE,
help='Base url to OpenStack tarballs'),
# NOTE(hrw): deprecate argument in Zed, remove in A-cycle
cfg.StrOpt('type', short='t', default='source',
choices=INSTALL_TYPE_CHOICES,
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,
help=('The number of threads to use while building.'
' (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()
# The dictionary of unbuildable images supports keys in the format:
# '<distro>+<installation_type>+<arch>' where each component is optional
# and can be omitted along with the + separator which means that component
# is irrelevant. Otherwise all must match for skip to happen.
# '<distro>+<arch>' where each component is optional and can be omitted along
# with the + separator which means that component is irrelevant. Otherwise all
# must match for skip to happen.
UNBUILDABLE_IMAGES = {
'aarch64': {
"bifrost-base", # someone need to get upstream working first
@ -478,27 +478,26 @@ class BuildTask(DockerTask):
if image.status in STATUS_ERRORS:
return
if self.conf.install_type == 'source':
try:
plugins_am = make_an_archive(image.plugins, 'plugins')
except ArchivingError:
self.logger.error(
"Failed turning any plugins into a plugins archive")
return
else:
self.logger.debug(
"Turned %s plugins into plugins archive",
plugins_am)
try:
additions_am = make_an_archive(image.additions, 'additions')
except ArchivingError:
self.logger.error(
"Failed turning any additions into a additions archive")
return
else:
self.logger.debug(
"Turned %s additions into additions archive",
additions_am)
try:
plugins_am = make_an_archive(image.plugins, 'plugins')
except ArchivingError:
self.logger.error(
"Failed turning any plugins into a plugins archive")
return
else:
self.logger.debug(
"Turned %s plugins into plugins archive",
plugins_am)
try:
additions_am = make_an_archive(image.additions, 'additions')
except ArchivingError:
self.logger.error(
"Failed turning any additions into a additions archive")
return
else:
self.logger.debug(
"Turned %s additions into additions archive",
additions_am)
# Pull the latest image for the base distro only
pull = self.conf.pull if image.parent is None else False
@ -610,7 +609,6 @@ class KollaWorker(object):
self.base = conf.base
self.use_dumb_init = conf.use_dumb_init
self.base_tag = conf.base_tag
self.install_type = conf.install_type
self.tag = conf.tag
self.base_arch = conf.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.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.image_statuses_bad = dict()
@ -834,7 +833,6 @@ class KollaWorker(object):
'docker_healthchecks': self.docker_healthchecks,
'supported_distro_name': supported_distro_name,
'image_prefix': self.image_prefix,
'install_type': self.install_type,
'namespace': self.namespace,
'openstack_release': self.openstack_release,
'tag': self.tag,
@ -924,9 +922,7 @@ class KollaWorker(object):
# mark unbuildable images and their children
base = self.base
tag_element = r'(%s|%s|%s)' % (base,
self.install_type,
self.base_arch)
tag_element = r'(%s|%s)' % (base, self.base_arch)
tag_re = re.compile(r'^%s(\+%s)*$' % (tag_element, tag_element))
unbuildable_images = set()
@ -1159,41 +1155,40 @@ class KollaWorker(object):
logger=utils.make_a_logger(self.conf, image_name),
docker_client=self.dc)
if self.install_type == 'source':
# NOTE(jeffrey4l): register the opts if the section didn't
# register in the kolla/common/config.py file
if image.name not in self.conf._groups:
self.conf.register_opts(common_config.get_source_opts(),
image.name)
image.source = process_source_installation(image, image.name)
for plugin in [match.group(0) for match in
(re.search('^{}-plugin-.+'.format(image.name),
section) for section in
all_sections) if match]:
try:
self.conf.register_opts(
common_config.get_source_opts(),
plugin
)
except cfg.DuplicateOptError:
LOG.debug('Plugin %s already registered in config',
plugin)
image.plugins.append(
process_source_installation(image, plugin))
for addition in [
match.group(0) for match in
(re.search('^{}-additions-.+'.format(image.name),
section) for section in all_sections) if match]:
try:
self.conf.register_opts(
common_config.get_source_opts(),
addition
)
except cfg.DuplicateOptError:
LOG.debug('Addition %s already registered in config',
addition)
image.additions.append(
process_source_installation(image, addition))
# NOTE(jeffrey4l): register the opts if the section didn't
# register in the kolla/common/config.py file
if image.name not in self.conf._groups:
self.conf.register_opts(common_config.get_source_opts(),
image.name)
image.source = process_source_installation(image, image.name)
for plugin in [match.group(0) for match in
(re.search('^{}-plugin-.+'.format(image.name),
section) for section in
all_sections) if match]:
try:
self.conf.register_opts(
common_config.get_source_opts(),
plugin
)
except cfg.DuplicateOptError:
LOG.debug('Plugin %s already registered in config',
plugin)
image.plugins.append(
process_source_installation(image, plugin))
for addition in [
match.group(0) for match in
(re.search('^{}-additions-.+'.format(image.name),
section) for section in all_sections) if match]:
try:
self.conf.register_opts(
common_config.get_source_opts(),
addition
)
except cfg.DuplicateOptError:
LOG.debug('Addition %s already registered in config',
addition)
image.additions.append(
process_source_installation(image, addition))
self.images.append(image)

View File

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