Merge "CI: Avoid tox"

This commit is contained in:
Zuul 2020-04-04 16:31:27 +00:00 committed by Gerrit Code Review
commit baec0b913a
9 changed files with 22 additions and 227 deletions

View File

@ -72,3 +72,4 @@
extra-vars:
kolla_logs_dir: "{{ zuul_output_dir }}/logs/kolla"
kolla_build_logs_dir: "{{ kolla_logs_dir }}/build"
virtualenv_path: "/tmp/kolla-virtualenv"

View File

@ -49,7 +49,6 @@
nodeset: kolla-centos8
voting: false
vars:
action: build
base_distro: centos
install_type: binary
@ -67,7 +66,6 @@
parent: kolla-base
nodeset: kolla-centos8
vars:
action: build
base_distro: centos
install_type: source

View File

@ -24,7 +24,6 @@
nodeset: kolla-debian-buster
voting: false
vars:
action: build
base_distro: debian
install_type: source
@ -34,7 +33,6 @@
nodeset: kolla-debian-buster-aarch64
voting: false
vars:
action: build
base_distro: debian
install_type: source
@ -44,7 +42,6 @@
nodeset: kolla-debian-buster
voting: false
vars:
action: build
base_distro: debian
install_type: binary

View File

@ -37,7 +37,6 @@
nodeset: kolla-ubuntu-bionic
voting: false
vars:
action: build
base_distro: ubuntu
install_type: binary
@ -55,7 +54,6 @@
parent: kolla-base
nodeset: kolla-ubuntu-bionic
vars:
action: build
base_distro: ubuntu
install_type: source

View File

@ -18,7 +18,18 @@
path: "{{ kolla_build_logs_dir }}"
state: directory
- name: Ensure tox is installed
pip:
name: tox
- name: Install Python3 setuptools and family
package:
name:
- python3-pip
- python3-setuptools
- python3-virtualenv
- python3-wheel
become: true
- name: Install kolla
pip:
name: .
chdir: "{{ zuul.project.src_dir }}"
virtualenv: "{{ virtualenv_path }}"
virtualenv_python: python3

View File

@ -32,7 +32,5 @@
src: "{{ zuul.executor.work_root }}/{{ zuul.project.src_dir }}/tests/templates/template_overrides.j2"
dest: /etc/kolla/template_overrides.j2
- name: Run tox
command: tox -e {{ action }}-{{ base_distro }}-{{ install_type }}
args:
chdir: "{{ zuul.project.src_dir }}"
- name: Run kolla-build
command: "{{ virtualenv_path }}/bin/kolla-build"

View File

@ -5,6 +5,11 @@ namespace = kolla
{% set tag_suffix = '-aarch64' if ansible_architecture == 'aarch64' else '' %}
tag = {{ (zuul.tag if zuul.pipeline == "release" else zuul.branch | basename) ~ tag_suffix }}
{% endif %}
base = {{ base_distro }}
{% if base_tag is defined %}
base_tag = {{ base_tag }}
{% endif %}
install_type = {{ install_type }}
push = false
logs_dir = {{ kolla_build_logs_dir }}
template_override = /etc/kolla/template_overrides.j2

View File

@ -1,133 +0,0 @@
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import multiprocessing
import os
import sys
from unittest.mock import patch
from oslo_log import fixture as log_fixture
from oslo_log import log as logging
from oslotest import base
import testtools
sys.path.append(
os.path.abspath(os.path.join(os.path.dirname(__file__), '../tools')))
from kolla.image import build # noqa
LOG = logging.getLogger(__name__)
class BuildTest(object):
excluded_images = []
def setUp(self):
super(BuildTest, self).setUp()
self.useFixture(log_fixture.SetLogLevel([__name__],
logging.logging.INFO))
self.threads = multiprocessing.cpu_count()
if self.threads < 4:
self.threads = 4
self.build_args = [__name__, '--threads', str(self.threads)]
@testtools.skipUnless(os.environ.get('DOCKER_BUILD_TEST'),
'Skip the docker build test')
def runTest(self):
with patch.object(sys, 'argv', self.build_args):
LOG.info("Running with args %s", self.build_args)
(bad_results, good_results, unmatched_results,
skipped_results, unbuildable_results) = build.run_build()
failures = 0
for image, result in bad_results.items():
if result != 'error':
continue
failures = failures + 1
LOG.critical(">>> Expected image '%s' to succeed!", image)
for image in unmatched_results:
LOG.warning(">>> Image '%s' was not matched", image)
self.assertEqual(0, failures, "%d failure(s) occurred" % failures)
class BuildTestCentosBinary(BuildTest, base.BaseTestCase):
def setUp(self):
super(BuildTestCentosBinary, self).setUp()
self.build_args.extend(["--base", "centos",
"--type", "binary"])
class BuildTestCentosSource(BuildTest, base.BaseTestCase):
def setUp(self):
super(BuildTestCentosSource, self).setUp()
self.build_args.extend(["--base", "centos",
"--type", "source"])
class BuildTestCentos8Binary(BuildTest, base.BaseTestCase):
def setUp(self):
super(BuildTestCentos8Binary, self).setUp()
# TODO(mgoddard): Remove --base-tag argument when CentOS 8 is the
# default.
self.build_args.extend(["--base", "centos",
"--base-tag", "8",
"--type", "binary"])
class BuildTestCentos8Source(BuildTest, base.BaseTestCase):
def setUp(self):
super(BuildTestCentos8Source, self).setUp()
# TODO(mgoddard): Remove --base-tag argument when CentOS 8 is the
# default.
self.build_args.extend(["--base", "centos",
"--base-tag", "8",
"--type", "source"])
class BuildTestUbuntuBinary(BuildTest, base.BaseTestCase):
def setUp(self):
super(BuildTestUbuntuBinary, self).setUp()
self.build_args.extend(["--base", "ubuntu",
"--type", "binary"])
class BuildTestUbuntuSource(BuildTest, base.BaseTestCase):
def setUp(self):
super(BuildTestUbuntuSource, self).setUp()
self.build_args.extend(["--base", "ubuntu",
"--type", "source"])
class BuildTestDebianBinary(BuildTest, base.BaseTestCase):
def setUp(self):
super(BuildTestDebianBinary, self).setUp()
self.build_args.extend(["--base", "debian",
"--type", "binary"])
class BuildTestDebianSource(BuildTest, base.BaseTestCase):
def setUp(self):
super(BuildTestDebianSource, self).setUp()
self.build_args.extend(["--base", "debian",
"--type", "source"])

80
tox.ini
View File

@ -88,86 +88,6 @@ commands =
sphinx-build -W --keep-going -b latex doc/source doc/build/pdf
make -C doc/build/pdf
[testenv:build-centos-binary]
whitelist_externals = find
bash
setenv =
DOCKER_BUILD_TEST=1
commands =
find . -type f -name "*.py[c|o]" -delete -o -type l -name "*.py[c|o]" -delete
bash -c "if [ ! -d .stestr ]; then stestr init; fi"
stestr run test_build.BuildTestCentosBinary
[testenv:build-centos-source]
whitelist_externals = find
bash
setenv =
DOCKER_BUILD_TEST=1
commands =
find . -type f -name "*.py[c|o]" -delete -o -type l -name "*.py[c|o]" -delete
bash -c "if [ ! -d .stestr ]; then stestr init; fi"
stestr run test_build.BuildTestCentosSource
[testenv:build-centos8-binary]
whitelist_externals = find
bash
setenv =
DOCKER_BUILD_TEST=1
commands =
find . -type f -name "*.py[c|o]" -delete -o -type l -name "*.py[c|o]" -delete
bash -c "if [ ! -d .stestr ]; then stestr init; fi"
stestr run test_build.BuildTestCentos8Binary
[testenv:build-centos8-source]
whitelist_externals = find
bash
setenv =
DOCKER_BUILD_TEST=1
commands =
find . -type f -name "*.py[c|o]" -delete -o -type l -name "*.py[c|o]" -delete
bash -c "if [ ! -d .stestr ]; then stestr init; fi"
stestr run test_build.BuildTestCentos8Source
[testenv:build-ubuntu-binary]
whitelist_externals = find
bash
setenv =
DOCKER_BUILD_TEST=1
commands =
find . -type f -name "*.py[c|o]" -delete -o -type l -name "*.py[c|o]" -delete
bash -c "if [ ! -d .stestr ]; then stestr init; fi"
stestr run test_build.BuildTestUbuntuBinary
[testenv:build-ubuntu-source]
whitelist_externals = find
bash
setenv =
DOCKER_BUILD_TEST=1
commands =
find . -type f -name "*.py[c|o]" -delete -o -type l -name "*.py[c|o]" -delete
bash -c "if [ ! -d .stestr ]; then stestr init; fi"
stestr run test_build.BuildTestUbuntuSource
[testenv:build-debian-binary]
whitelist_externals = find
bash
setenv =
DOCKER_BUILD_TEST=1
commands =
find . -type f -name "*.py[c|o]" -delete -o -type l -name "*.py[c|o]" -delete
bash -c "if [ ! -d .stestr ]; then stestr init; fi"
stestr run test_build.BuildTestDebianBinary
[testenv:build-debian-source]
whitelist_externals = find
bash
setenv =
DOCKER_BUILD_TEST=1
commands =
find . -type f -name "*.py[c|o]" -delete -o -type l -name "*.py[c|o]" -delete
bash -c "if [ ! -d .stestr ]; then stestr init; fi"
stestr run test_build.BuildTestDebianSource
[testenv:genconfig]
whitelist_externals = which
commands=