Browse Source

Merge "Add standalone upgrade to emit release."

changes/90/614090/1
Zuul Gerrit Code Review 1 year ago
parent
commit
9ce91d02af
7 changed files with 444 additions and 26 deletions
  1. +2
    -1
      playbooks/tripleo-ci/templates/oooq_common_functions.sh.j2
  2. +65
    -2
      scripts/emit_releases_file/emit_releases_file.py
  3. +16
    -0
      scripts/emit_releases_file/test_release_file.py
  4. +336
    -22
      scripts/emit_releases_file/test_release_name.py
  5. +11
    -0
      scripts/emit_releases_file/test_unsupported_upgrades.py
  6. +12
    -0
      scripts/emit_releases_file/test_write_bash_script.py
  7. +2
    -1
      scripts/oooq_common_functions.sh

+ 2
- 1
playbooks/tripleo-ci/templates/oooq_common_functions.sh.j2 View File

@@ -140,8 +140,9 @@ get_extra_vars_from_release()
{
local release_name=$1
local release_hash=$2
local newest_release_hash=${3:-""}
local release_file=$LOCAL_WORKING_DIR/config/release/tripleo-ci/${DISTRIBUTION:-CentOS}-${DISTRIBUTION_MAJOR_VERSION:-7}/$release_name.yml
echo "--extra-vars @$release_file -e dlrn_hash=$release_hash -e get_build_command=$release_hash"
echo "--extra-vars @$release_file -e dlrn_hash=$release_hash -e get_build_command=$release_hash ${newest_release_hash:+-e dlrn_hash_newest=$newest_release_hash}"
}

# Enclose IPv6 addresses in brackets.


+ 65
- 2
scripts/emit_releases_file/emit_releases_file.py View File

@@ -1,3 +1,35 @@
"""
Helper script that generates environmental variables for upgrade/update.

From the stable-release parameter it calculate environmental variables
for mixed release.

It supports:
- overcloud-upgrade from stable_release ocata.
- overcloud-update, all releases.
- undercloud-upgrade from stable_release ocata.
- fast forward upgrade;
- newton->queens;
- standalone-upgrade from stable_release stein.

It exports those environmental variables in the OUTPUT_FILE:

- UNDERCLOUD_INSTALL_RELEASE
- UNDERCLOUD_INSTALL_HASH
- UNDERCLOUD_TARGET_RELEASE
- UNDERCLOUD_TARGET_HASH
- OVERCLOUD_DEPLOY_RELEASE
- OVERCLOUD_DEPLOY_HASH
- OVERCLOUD_TARGET_RELEASE
- OVERCLOUD_TARGET_HASH
- STANDALONE_DEPLOY_RELEASE
- STANDALONE_DEPLOY_NEWEST_HASH
- STANDALONE_DEPLOY_HASH
- STANDALONE_TARGET_RELEASE
- STANDALONE_TARGET_NEWEST_HASH
- STANDALONE_TARGET_HASH

"""
import argparse
import logging
import logging.handlers
@@ -10,10 +42,12 @@ import yaml
RELEASES = ['newton', 'ocata', 'pike', 'queens', 'rocky', 'master']
# Define long term releases
LONG_TERM_SUPPORT_RELEASES = ['queens']
UNSUPPORTED_STANDALONE = ['newton', 'ocata', 'pike', 'queens', 'rocky']

# NAMED DLRN HASHES
NEWTON_HASH_NAME = 'current-passed-ci'
CURRENT_HASH_NAME = 'current-tripleo'
NEWEST_HASH_NAME = 'current'
PROMOTION_HASH_NAME = 'tripleo-ci-testing'
PREVIOUS_HASH_NAME = 'previous-current-tripleo'

@@ -111,6 +145,11 @@ def compose_releases_dictionary(stable_release, featureset, upgrade_from,
not featureset.get('mixed_upgrade'):
raise RuntimeError("Overcloud upgrade has to be mixed upgrades")

if featureset.get('standalone_upgrade') and \
stable_release in UNSUPPORTED_STANDALONE:
raise RuntimeError(
"Standalone upgrade doesn't support {}".format(stable_release))

if featureset.get('ffu_overcloud_upgrade') and \
stable_release not in LONG_TERM_SUPPORT_RELEASES:
raise RuntimeError(
@@ -118,6 +157,7 @@ def compose_releases_dictionary(stable_release, featureset, upgrade_from,
"used in a fast forward upgrade. Current long-term support "
"releases: {}".format(stable_release, LONG_TERM_SUPPORT_RELEASES))

newest_hash = get_dlrn_hash(stable_release, NEWEST_HASH_NAME)
if stable_release == 'newton':
current_hash = get_dlrn_hash(stable_release, NEWTON_HASH_NAME)
elif is_periodic:
@@ -133,7 +173,13 @@ def compose_releases_dictionary(stable_release, featureset, upgrade_from,
'overcloud_deploy_release': stable_release,
'overcloud_deploy_hash': current_hash,
'overcloud_target_release': stable_release,
'overcloud_target_hash': current_hash
'overcloud_target_hash': current_hash,
'standalone_deploy_release': stable_release,
'standalone_deploy_hash': current_hash,
'standalone_deploy_newest_hash': newest_hash,
'standalone_target_release': stable_release,
'standalone_target_hash': current_hash,
'standalone_target_newest_hash': newest_hash,
}

if featureset.get('mixed_upgrade'):
@@ -164,6 +210,16 @@ def compose_releases_dictionary(stable_release, featureset, upgrade_from,
releases_dictionary['undercloud_install_release'] = install_release
releases_dictionary['undercloud_install_hash'] = install_hash

elif featureset.get('standalone_upgrade'):
logger.info('Doing an standalone upgrade')
install_release = get_relative_release(stable_release, -1)
install_hash = get_dlrn_hash(install_release, CURRENT_HASH_NAME)
install_newest_hash = get_dlrn_hash(install_release, NEWEST_HASH_NAME)
releases_dictionary['standalone_deploy_release'] = install_release
releases_dictionary['standalone_deploy_newest_hash'] = \
install_newest_hash
releases_dictionary['standalone_deploy_hash'] = install_hash

elif featureset.get('overcloud_update'):
logger.info('Doing an overcloud update')
previous_hash = get_dlrn_hash(stable_release, PREVIOUS_HASH_NAME)
@@ -198,7 +254,8 @@ def shim_convert_old_release_names(releases_names, is_periodic):
elif is_periodic:
for key in [
'undercloud_install_release', 'undercloud_target_release',
'overcloud_deploy_release', 'overcloud_target_release'
'overcloud_deploy_release', 'overcloud_target_release',
'standalone_deploy_release', 'standalone_target_release'
]:
modified_releases_name[
key] = "promotion-testing-hash-" + releases_names[key]
@@ -219,6 +276,12 @@ export OVERCLOUD_DEPLOY_RELEASE="{overcloud_deploy_release}"
export OVERCLOUD_DEPLOY_HASH="{overcloud_deploy_hash}"
export OVERCLOUD_TARGET_RELEASE="{overcloud_target_release}"
export OVERCLOUD_TARGET_HASH="{overcloud_target_hash}"
export STANDALONE_DEPLOY_RELEASE="{standalone_deploy_release}"
export STANDALONE_DEPLOY_HASH="{standalone_deploy_hash}"
export STANDALONE_DEPLOY_NEWEST_HASH="{standalone_deploy_newest_hash}"
export STANDALONE_TARGET_RELEASE="{standalone_target_release}"
export STANDALONE_TARGET_NEWEST_HASH="{standalone_target_newest_hash}"
export STANDALONE_TARGET_HASH="{standalone_target_hash}"
'''.format(**releases_dictionary)
with open(bash_file_name, 'w') as bash_file:
bash_file.write(bash_script)


+ 16
- 0
scripts/emit_releases_file/test_release_file.py View File

@@ -66,6 +66,10 @@ def test_converting_from_periodic_uc_upgrade_has_single_release_with_sufix():
'overcloud_deploy_hash': 'current-tripleo',
'overcloud_target_release': 'master',
'overcloud_target_hash': 'current-tripleo',
'standalone_deploy_release': 'rocky',
'standalone_deploy_hash': 'current-tripleo',
'standalone_target_release': 'master',
'standalone_target_hash': 'current-tripleo',
}
expected_releases_file = {
'undercloud_install_release': 'promotion-testing-hash-queens',
@@ -76,6 +80,10 @@ def test_converting_from_periodic_uc_upgrade_has_single_release_with_sufix():
'overcloud_deploy_hash': 'current-tripleo',
'overcloud_target_release': 'promotion-testing-hash-master',
'overcloud_target_hash': 'current-tripleo',
'standalone_deploy_release': 'promotion-testing-hash-rocky',
'standalone_deploy_hash': 'current-tripleo',
'standalone_target_release': 'promotion-testing-hash-master',
'standalone_target_hash': 'current-tripleo',
}
assert (shim_convert_old_release_names(releases_name, is_periodic=True) ==
expected_releases_file)
@@ -116,6 +124,10 @@ def test_converting_from_periodic_noop_has_single_release_with_sufix():
'overcloud_deploy_hash': 'current-tripleo',
'overcloud_target_release': 'master',
'overcloud_target_hash': 'current-tripleo',
'standalone_deploy_release': 'rocky',
'standalone_deploy_hash': 'current-tripleo',
'standalone_target_release': 'master',
'standalone_target_hash': 'current-tripleo',
}
expected_releases_file = {
'undercloud_install_release': 'promotion-testing-hash-master',
@@ -126,6 +138,10 @@ def test_converting_from_periodic_noop_has_single_release_with_sufix():
'overcloud_deploy_hash': 'current-tripleo',
'overcloud_target_release': 'promotion-testing-hash-master',
'overcloud_target_hash': 'current-tripleo',
'standalone_deploy_release': 'promotion-testing-hash-rocky',
'standalone_deploy_hash': 'current-tripleo',
'standalone_target_release': 'promotion-testing-hash-master',
'standalone_target_hash': 'current-tripleo',
}
assert (shim_convert_old_release_names(releases_name, is_periodic=True) ==
expected_releases_file)

+ 336
- 22
scripts/emit_releases_file/test_release_name.py View File

@@ -15,6 +15,12 @@ import pytest
'overcloud_deploy_hash': 'old-current-tripleo',
'overcloud_target_release': 'master',
'overcloud_target_hash': 'current-tripleo',
'standalone_deploy_release': 'master',
'standalone_deploy_newest_hash': 'current',
'standalone_deploy_hash': 'current-tripleo',
'standalone_target_release': 'master',
'standalone_target_newest_hash': 'current',
'standalone_target_hash': 'current-tripleo',
}), ('rocky', {
'undercloud_install_release': 'rocky',
'undercloud_install_hash': 'current-tripleo',
@@ -24,6 +30,12 @@ import pytest
'overcloud_deploy_hash': 'old-current-tripleo',
'overcloud_target_release': 'rocky',
'overcloud_target_hash': 'current-tripleo',
'standalone_deploy_release': 'rocky',
'standalone_deploy_newest_hash': 'current',
'standalone_deploy_hash': 'current-tripleo',
'standalone_target_release': 'rocky',
'standalone_target_newest_hash': 'current',
'standalone_target_hash': 'current-tripleo',
}), ('queens', {
'undercloud_install_release': 'queens',
'undercloud_install_hash': 'current-tripleo',
@@ -33,6 +45,12 @@ import pytest
'overcloud_deploy_hash': 'old-current-tripleo',
'overcloud_target_release': 'queens',
'overcloud_target_hash': 'current-tripleo',
'standalone_deploy_release': 'queens',
'standalone_deploy_newest_hash': 'current',
'standalone_deploy_hash': 'current-tripleo',
'standalone_target_release': 'queens',
'standalone_target_newest_hash': 'current',
'standalone_target_hash': 'current-tripleo',
}), ('pike', {
'undercloud_install_release': 'pike',
'undercloud_install_hash': 'current-tripleo',
@@ -42,11 +60,19 @@ import pytest
'overcloud_deploy_hash': 'old-current-tripleo',
'overcloud_target_release': 'pike',
'overcloud_target_hash': 'current-tripleo',
'standalone_deploy_release': 'pike',
'standalone_deploy_newest_hash': 'current',
'standalone_deploy_hash': 'current-tripleo',
'standalone_target_release': 'pike',
'standalone_target_newest_hash': 'current',
'standalone_target_hash': 'current-tripleo',
})])
def test_overcloud_upgrade_is_n_minus_one_to_n(mock_get_hash,
stable_release,
expected_releases):
mock_get_hash.side_effect = ['current-tripleo', 'old-current-tripleo']
mock_get_hash.side_effect = ['current',
'current-tripleo',
'old-current-tripleo']
featureset = {
'mixed_upgrade': True,
'overcloud_upgrade': True,
@@ -56,7 +82,8 @@ def test_overcloud_upgrade_is_n_minus_one_to_n(mock_get_hash,
featureset,
upgrade_from) == expected_releases)
mock_get_hash.assert_has_calls(
[mock.call(stable_release, 'current-tripleo'),
[mock.call(stable_release, 'current'),
mock.call(stable_release, 'current-tripleo'),
mock.call(expected_releases['overcloud_deploy_release'],
'current-tripleo')])

@@ -72,6 +99,12 @@ def test_overcloud_upgrade_is_n_minus_one_to_n(mock_get_hash,
'overcloud_deploy_hash': 'old-current-tripleo',
'overcloud_target_release': 'master',
'overcloud_target_hash': 'current-tripleo',
'standalone_deploy_release': 'master',
'standalone_deploy_newest_hash': 'current',
'standalone_deploy_hash': 'current-tripleo',
'standalone_target_release': 'master',
'standalone_target_newest_hash': 'current',
'standalone_target_hash': 'current-tripleo',
}), ('rocky', {
'undercloud_install_release': 'rocky',
'undercloud_install_hash': 'current-tripleo',
@@ -81,6 +114,12 @@ def test_overcloud_upgrade_is_n_minus_one_to_n(mock_get_hash,
'overcloud_deploy_hash': 'old-current-tripleo',
'overcloud_target_release': 'rocky',
'overcloud_target_hash': 'current-tripleo',
'standalone_deploy_release': 'rocky',
'standalone_deploy_newest_hash': 'current',
'standalone_deploy_hash': 'current-tripleo',
'standalone_target_release': 'rocky',
'standalone_target_newest_hash': 'current',
'standalone_target_hash': 'current-tripleo',
}), ('queens', {
'undercloud_install_release': 'queens',
'undercloud_install_hash': 'current-tripleo',
@@ -90,6 +129,12 @@ def test_overcloud_upgrade_is_n_minus_one_to_n(mock_get_hash,
'overcloud_deploy_hash': 'old-current-tripleo',
'overcloud_target_release': 'queens',
'overcloud_target_hash': 'current-tripleo',
'standalone_deploy_release': 'queens',
'standalone_deploy_newest_hash': 'current',
'standalone_deploy_hash': 'current-tripleo',
'standalone_target_release': 'queens',
'standalone_target_newest_hash': 'current',
'standalone_target_hash': 'current-tripleo',
}), ('pike', {
'undercloud_install_release': 'pike',
'undercloud_install_hash': 'current-tripleo',
@@ -99,11 +144,19 @@ def test_overcloud_upgrade_is_n_minus_one_to_n(mock_get_hash,
'overcloud_deploy_hash': 'old-current-tripleo',
'overcloud_target_release': 'pike',
'overcloud_target_hash': 'current-tripleo',
'standalone_deploy_release': 'pike',
'standalone_deploy_newest_hash': 'current',
'standalone_deploy_hash': 'current-tripleo',
'standalone_target_release': 'pike',
'standalone_target_newest_hash': 'current',
'standalone_target_hash': 'current-tripleo',
})])
def test_period_overcloud_upgrade_is_n_minus_one_to_n(mock_get_hash,
stable_release,
expected_releases):
mock_get_hash.side_effect = ['current-tripleo', 'old-current-tripleo']
mock_get_hash.side_effect = ['current',
'current-tripleo',
'old-current-tripleo']
featureset = {
'mixed_upgrade': True,
'overcloud_upgrade': True,
@@ -114,7 +167,8 @@ def test_period_overcloud_upgrade_is_n_minus_one_to_n(mock_get_hash,
upgrade_from,
is_periodic=True) == expected_releases)
mock_get_hash.assert_has_calls(
[mock.call(stable_release, 'tripleo-ci-testing'),
[mock.call(stable_release, 'current'),
mock.call(stable_release, 'tripleo-ci-testing'),
mock.call(expected_releases['overcloud_deploy_release'],
'current-tripleo')])

@@ -130,12 +184,20 @@ def test_period_overcloud_upgrade_is_n_minus_one_to_n(mock_get_hash,
'overcloud_deploy_hash': 'old-current-tripleo',
'overcloud_target_release': 'queens',
'overcloud_target_hash': 'current-tripleo',
'standalone_deploy_release': 'queens',
'standalone_deploy_newest_hash': 'current',
'standalone_deploy_hash': 'current-tripleo',
'standalone_target_release': 'queens',
'standalone_target_newest_hash': 'current',
'standalone_target_hash': 'current-tripleo',
}),
])
def test_ffu_overcloud_upgrade_is_n_minus_three_to_n(mock_get_hash,
stable_release,
expected_releases):
mock_get_hash.side_effect = ['current-tripleo', 'old-current-tripleo']
mock_get_hash.side_effect = ['current',
'current-tripleo',
'old-current-tripleo']
featureset = {
'mixed_upgrade': True,
'ffu_overcloud_upgrade': True,
@@ -145,7 +207,8 @@ def test_ffu_overcloud_upgrade_is_n_minus_three_to_n(mock_get_hash,
featureset,
upgrade_from) == expected_releases)
mock_get_hash.assert_has_calls(
[mock.call(stable_release, 'current-tripleo'),
[mock.call(stable_release, 'current'),
mock.call(stable_release, 'current-tripleo'),
mock.call(expected_releases['overcloud_deploy_release'],
'current-passed-ci')])

@@ -161,12 +224,20 @@ def test_ffu_overcloud_upgrade_is_n_minus_three_to_n(mock_get_hash,
'overcloud_deploy_hash': 'old-current-tripleo',
'overcloud_target_release': 'queens',
'overcloud_target_hash': 'current-tripleo',
'standalone_deploy_release': 'queens',
'standalone_deploy_newest_hash': 'current',
'standalone_deploy_hash': 'current-tripleo',
'standalone_target_release': 'queens',
'standalone_target_newest_hash': 'current',
'standalone_target_hash': 'current-tripleo',
}),
])
def test_period_ffu_overcloud_upgrade_is_n_minus_three_to_n(mock_get_hash,
stable_release,
expected_releases):
mock_get_hash.side_effect = ['current-tripleo', 'old-current-tripleo']
mock_get_hash.side_effect = ['current',
'current-tripleo',
'old-current-tripleo']
featureset = {
'mixed_upgrade': True,
'ffu_overcloud_upgrade': True,
@@ -177,7 +248,8 @@ def test_period_ffu_overcloud_upgrade_is_n_minus_three_to_n(mock_get_hash,
upgrade_from,
is_periodic=True) == expected_releases)
mock_get_hash.assert_has_calls(
[mock.call(stable_release, 'tripleo-ci-testing'),
[mock.call(stable_release, 'current'),
mock.call(stable_release, 'tripleo-ci-testing'),
mock.call(expected_releases['overcloud_deploy_release'],
'current-passed-ci')])

@@ -193,6 +265,12 @@ def test_period_ffu_overcloud_upgrade_is_n_minus_three_to_n(mock_get_hash,
'overcloud_deploy_hash': 'current-tripleo',
'overcloud_target_release': 'master',
'overcloud_target_hash': 'current-tripleo',
'standalone_deploy_release': 'master',
'standalone_deploy_newest_hash': 'current',
'standalone_deploy_hash': 'current-tripleo',
'standalone_target_release': 'master',
'standalone_target_newest_hash': 'current',
'standalone_target_hash': 'current-tripleo',
}),
('rocky', {
'undercloud_install_release': 'queens',
@@ -203,6 +281,12 @@ def test_period_ffu_overcloud_upgrade_is_n_minus_three_to_n(mock_get_hash,
'overcloud_deploy_hash': 'current-tripleo',
'overcloud_target_release': 'rocky',
'overcloud_target_hash': 'current-tripleo',
'standalone_deploy_release': 'rocky',
'standalone_deploy_newest_hash': 'current',
'standalone_deploy_hash': 'current-tripleo',
'standalone_target_release': 'rocky',
'standalone_target_newest_hash': 'current',
'standalone_target_hash': 'current-tripleo',
}),
('queens', {
'undercloud_install_release': 'pike',
@@ -213,6 +297,12 @@ def test_period_ffu_overcloud_upgrade_is_n_minus_three_to_n(mock_get_hash,
'overcloud_deploy_hash': 'current-tripleo',
'overcloud_target_release': 'queens',
'overcloud_target_hash': 'current-tripleo',
'standalone_deploy_release': 'queens',
'standalone_deploy_newest_hash': 'current',
'standalone_deploy_hash': 'current-tripleo',
'standalone_target_release': 'queens',
'standalone_target_newest_hash': 'current',
'standalone_target_hash': 'current-tripleo',
}),
('pike', {
'undercloud_install_release': 'ocata',
@@ -223,12 +313,20 @@ def test_period_ffu_overcloud_upgrade_is_n_minus_three_to_n(mock_get_hash,
'overcloud_deploy_hash': 'current-tripleo',
'overcloud_target_release': 'pike',
'overcloud_target_hash': 'current-tripleo',
'standalone_deploy_release': 'pike',
'standalone_deploy_newest_hash': 'current',
'standalone_deploy_hash': 'current-tripleo',
'standalone_target_release': 'pike',
'standalone_target_newest_hash': 'current',
'standalone_target_hash': 'current-tripleo',
}),
])
def test_undercloud_upgrade_is_n_minus_one_to_n(mock_get_hash,
stable_release,
expected_releases):
mock_get_hash.side_effect = ['current-tripleo', 'old-current-tripleo']
mock_get_hash.side_effect = ['current',
'current-tripleo',
'old-current-tripleo']
featureset = {
'undercloud_upgrade': True,
}
@@ -237,7 +335,8 @@ def test_undercloud_upgrade_is_n_minus_one_to_n(mock_get_hash,
featureset,
upgrade_from) == expected_releases)
mock_get_hash.assert_has_calls(
[mock.call(stable_release, 'current-tripleo'),
[mock.call(stable_release, 'current'),
mock.call(stable_release, 'current-tripleo'),
mock.call(expected_releases['undercloud_install_release'],
'current-tripleo')])

@@ -253,12 +352,20 @@ def test_undercloud_upgrade_is_n_minus_one_to_n(mock_get_hash,
'overcloud_deploy_hash': 'current-tripleo',
'overcloud_target_release': 'master',
'overcloud_target_hash': 'current-tripleo',
'standalone_deploy_release': 'master',
'standalone_deploy_newest_hash': 'current',
'standalone_deploy_hash': 'current-tripleo',
'standalone_target_release': 'master',
'standalone_target_newest_hash': 'current',
'standalone_target_hash': 'current-tripleo',
}),
])
def test_period_undercloud_upgrade_is_n_minus_one_to_n(mock_get_hash,
stable_release,
expected_releases):
mock_get_hash.side_effect = ['current-tripleo', 'old-current-tripleo']
mock_get_hash.side_effect = ['current',
'current-tripleo',
'old-current-tripleo']
featureset = {
'undercloud_upgrade': True,
}
@@ -268,11 +375,97 @@ def test_period_undercloud_upgrade_is_n_minus_one_to_n(mock_get_hash,
upgrade_from,
is_periodic=True) == expected_releases)
mock_get_hash.assert_has_calls(
[mock.call(stable_release, 'tripleo-ci-testing'),
[mock.call(stable_release, 'current'),
mock.call(stable_release, 'tripleo-ci-testing'),
mock.call(expected_releases['undercloud_install_release'],
'current-tripleo')])


@mock.patch('emit_releases_file.get_dlrn_hash')
@pytest.mark.parametrize('stable_release,expected_releases', [
('master', {
'undercloud_install_release': 'master',
'undercloud_install_hash': 'current-tripleo',
'undercloud_target_release': 'master',
'undercloud_target_hash': 'current-tripleo',
'overcloud_deploy_release': 'master',
'overcloud_deploy_hash': 'current-tripleo',
'overcloud_target_release': 'master',
'overcloud_target_hash': 'current-tripleo',
'standalone_deploy_release': 'rocky',
'standalone_deploy_newest_hash': 'old-current',
'standalone_deploy_hash': 'old-current-tripleo',
'standalone_target_release': 'master',
'standalone_target_newest_hash': 'current',
'standalone_target_hash': 'current-tripleo',
}),
])
def test_standalone_upgrade_is_n_minus_one_to_n(mock_get_hash,
stable_release,
expected_releases):
mock_get_hash.side_effect = ['current',
'current-tripleo',
'old-current-tripleo',
'old-current']
featureset = {
'standalone_upgrade': True,
}
upgrade_from = False
assert (compose_releases_dictionary(stable_release,
featureset,
upgrade_from) == expected_releases)
mock_get_hash.assert_has_calls(
[mock.call(stable_release, 'current'),
mock.call(stable_release, 'current-tripleo'),
mock.call(expected_releases['standalone_deploy_release'],
'current-tripleo'),
mock.call(expected_releases['standalone_deploy_release'],
'current')])


@mock.patch('emit_releases_file.get_dlrn_hash')
@pytest.mark.parametrize('stable_release,expected_releases', [
('master', {
'undercloud_install_release': 'master',
'undercloud_install_hash': 'current-tripleo',
'undercloud_target_release': 'master',
'undercloud_target_hash': 'current-tripleo',
'overcloud_deploy_release': 'master',
'overcloud_deploy_hash': 'current-tripleo',
'overcloud_target_release': 'master',
'overcloud_target_hash': 'current-tripleo',
'standalone_deploy_release': 'rocky',
'standalone_deploy_newest_hash': 'old-current',
'standalone_deploy_hash': 'old-current-tripleo',
'standalone_target_release': 'master',
'standalone_target_newest_hash': 'current',
'standalone_target_hash': 'current-tripleo',
}),
])
def test_period_standalone_upgrade_is_n_minus_one_to_n(mock_get_hash,
stable_release,
expected_releases):
mock_get_hash.side_effect = ['current',
'current-tripleo',
'old-current-tripleo',
'old-current']
featureset = {
'standalone_upgrade': True,
}
upgrade_from = False
assert (compose_releases_dictionary(stable_release,
featureset,
upgrade_from,
is_periodic=True) == expected_releases)
mock_get_hash.assert_has_calls(
[mock.call(stable_release, 'current'),
mock.call(stable_release, 'tripleo-ci-testing'),
mock.call(expected_releases['standalone_deploy_release'],
'current-tripleo'),
mock.call(expected_releases['standalone_deploy_release'],
'current')])


@mock.patch('emit_releases_file.get_dlrn_hash')
@pytest.mark.parametrize(
'stable_release,expected_releases',
@@ -285,6 +478,12 @@ def test_period_undercloud_upgrade_is_n_minus_one_to_n(mock_get_hash,
'overcloud_deploy_hash': 'previous-current-tripleo',
'overcloud_target_release': 'master',
'overcloud_target_hash': 'current-tripleo',
'standalone_deploy_newest_hash': 'current',
'standalone_deploy_hash': 'current-tripleo',
'standalone_deploy_release': 'master',
'standalone_target_newest_hash': 'current',
'standalone_target_hash': 'current-tripleo',
'standalone_target_release': 'master'
}), ('rocky', {
'undercloud_install_release': 'rocky',
'undercloud_install_hash': 'current-tripleo',
@@ -294,6 +493,12 @@ def test_period_undercloud_upgrade_is_n_minus_one_to_n(mock_get_hash,
'overcloud_deploy_hash': 'previous-current-tripleo',
'overcloud_target_release': 'rocky',
'overcloud_target_hash': 'current-tripleo',
'standalone_deploy_newest_hash': 'current',
'standalone_deploy_hash': 'current-tripleo',
'standalone_deploy_release': 'rocky',
'standalone_target_newest_hash': 'current',
'standalone_target_hash': 'current-tripleo',
'standalone_target_release': 'rocky'
}), ('queens', {
'undercloud_install_release': 'queens',
'undercloud_install_hash': 'current-tripleo',
@@ -303,15 +508,28 @@ def test_period_undercloud_upgrade_is_n_minus_one_to_n(mock_get_hash,
'overcloud_deploy_hash': 'previous-current-tripleo',
'overcloud_target_release': 'queens',
'overcloud_target_hash': 'current-tripleo',
'standalone_deploy_newest_hash': 'current',
'standalone_deploy_hash': 'current-tripleo',
'standalone_deploy_release': 'queens',
'standalone_target_newest_hash': 'current',
'standalone_target_hash': 'current-tripleo',
'standalone_target_release': 'queens',
}), ('pike', {
'undercloud_install_release': 'pike',
'undercloud_install_hash': 'current-tripleo',
'undercloud_target_release': 'pike',
'undercloud_target_hash': 'current-tripleo',
'overcloud_deploy_release': 'pike',
'standalone_deploy_newest_hash': 'current',
'overcloud_deploy_hash': 'previous-current-tripleo',
'overcloud_target_release': 'pike',
'overcloud_target_hash': 'current-tripleo',
'standalone_deploy_newest_hash': 'current',
'standalone_deploy_hash': 'current-tripleo',
'standalone_deploy_release': 'pike',
'standalone_target_newest_hash': 'current',
'standalone_target_hash': 'current-tripleo',
'standalone_target_release': 'pike'
}), ('ocata', {
'undercloud_install_release': 'ocata',
'undercloud_install_hash': 'current-tripleo',
@@ -321,11 +539,20 @@ def test_period_undercloud_upgrade_is_n_minus_one_to_n(mock_get_hash,
'overcloud_deploy_hash': 'previous-current-tripleo',
'overcloud_target_release': 'ocata',
'overcloud_target_hash': 'current-tripleo',
'overcloud_deploy_release': 'ocata',
'standalone_deploy_newest_hash': 'current',
'standalone_deploy_hash': 'current-tripleo',
'standalone_deploy_release': 'ocata',
'standalone_target_newest_hash': 'current',
'standalone_target_hash': 'current-tripleo',
'standalone_target_release': 'ocata'
})])
def test_overcloud_update_target_is_hash(mock_get_hash,
stable_release,
expected_releases):
mock_get_hash.side_effect = ['current-tripleo', 'previous-current-tripleo']
mock_get_hash.side_effect = ['current',
'current-tripleo',
'previous-current-tripleo']
featureset = {
'overcloud_update': True,
}
@@ -334,7 +561,8 @@ def test_overcloud_update_target_is_hash(mock_get_hash,
featureset,
upgrade_from) == expected_releases)
mock_get_hash.assert_has_calls(
[mock.call(stable_release, 'current-tripleo'),
[mock.call(stable_release, 'current'),
mock.call(stable_release, 'current-tripleo'),
mock.call(expected_releases['overcloud_deploy_release'],
'previous-current-tripleo')])

@@ -351,6 +579,12 @@ def test_overcloud_update_target_is_hash(mock_get_hash,
'overcloud_deploy_hash': 'previous-current-tripleo',
'overcloud_target_release': 'master',
'overcloud_target_hash': 'tripleo-ci-testing',
'standalone_deploy_newest_hash': 'current',
'standalone_deploy_hash': 'tripleo-ci-testing',
'standalone_deploy_release': 'master',
'standalone_target_newest_hash': 'current',
'standalone_target_hash': 'tripleo-ci-testing',
'standalone_target_release': 'master'
}), ('rocky', {
'undercloud_install_release': 'rocky',
'undercloud_install_hash': 'tripleo-ci-testing',
@@ -360,6 +594,12 @@ def test_overcloud_update_target_is_hash(mock_get_hash,
'overcloud_deploy_hash': 'previous-current-tripleo',
'overcloud_target_release': 'rocky',
'overcloud_target_hash': 'tripleo-ci-testing',
'standalone_deploy_newest_hash': 'current',
'standalone_deploy_hash': 'tripleo-ci-testing',
'standalone_deploy_release': 'rocky',
'standalone_target_newest_hash': 'current',
'standalone_target_hash': 'tripleo-ci-testing',
'standalone_target_release': 'rocky'
}), ('queens', {
'undercloud_install_release': 'queens',
'undercloud_install_hash': 'tripleo-ci-testing',
@@ -369,12 +609,20 @@ def test_overcloud_update_target_is_hash(mock_get_hash,
'overcloud_deploy_hash': 'previous-current-tripleo',
'overcloud_target_release': 'queens',
'overcloud_target_hash': 'tripleo-ci-testing',
'standalone_deploy_newest_hash': 'current',
'standalone_deploy_hash': 'tripleo-ci-testing',
'standalone_deploy_release': 'queens',
'standalone_target_newest_hash': 'current',
'standalone_target_hash': 'tripleo-ci-testing',
'standalone_target_release': 'queens'
})])
def test_period_overcloud_update_target_is_hash(mock_get_hash,
stable_release,
expected_releases):
mock_get_hash.side_effect = ['tripleo-ci-testing',
'previous-current-tripleo']
mock_get_hash.side_effect = ['current',
'tripleo-ci-testing',
'previous-current-tripleo',
'old-current']
featureset = {
'overcloud_update': True,
}
@@ -384,9 +632,10 @@ def test_period_overcloud_update_target_is_hash(mock_get_hash,
upgrade_from,
is_periodic=True) == expected_releases)
mock_get_hash.assert_has_calls(
[mock.call(stable_release, 'tripleo-ci-testing'),
[mock.call(stable_release, 'current'),
mock.call(stable_release, 'tripleo-ci-testing'),
mock.call(expected_releases['overcloud_deploy_release'],
'previous-current-tripleo')])
'previous-current-tripleo')])


@mock.patch('emit_releases_file.get_dlrn_hash')
@@ -400,6 +649,12 @@ def test_period_overcloud_update_target_is_hash(mock_get_hash,
'overcloud_deploy_hash': 'current-tripleo',
'overcloud_target_release': 'master',
'overcloud_target_hash': 'current-tripleo',
'standalone_deploy_hash': 'current-tripleo',
'standalone_deploy_newest_hash': 'current',
'standalone_deploy_release': 'master',
'standalone_target_newest_hash': 'current',
'standalone_target_hash': 'current-tripleo',
'standalone_target_release': 'master'
}), ('rocky', {
'undercloud_install_release': 'rocky',
'undercloud_install_hash': 'current-tripleo',
@@ -409,6 +664,13 @@ def test_period_overcloud_update_target_is_hash(mock_get_hash,
'overcloud_deploy_hash': 'current-tripleo',
'overcloud_target_release': 'rocky',
'overcloud_target_hash': 'current-tripleo',
'standalone_deploy_newest_hash': 'current',
'standalone_deploy_newest_hash': 'current',
'standalone_deploy_hash': 'current-tripleo',
'standalone_deploy_release': 'rocky',
'standalone_target_newest_hash': 'current',
'standalone_target_hash': 'current-tripleo',
'standalone_target_release': 'rocky'
}), ('queens', {
'undercloud_install_release': 'queens',
'undercloud_install_hash': 'current-tripleo',
@@ -418,6 +680,12 @@ def test_period_overcloud_update_target_is_hash(mock_get_hash,
'overcloud_deploy_hash': 'current-tripleo',
'overcloud_target_release': 'queens',
'overcloud_target_hash': 'current-tripleo',
'standalone_deploy_newest_hash': 'current',
'standalone_deploy_hash': 'current-tripleo',
'standalone_deploy_release': 'queens',
'standalone_target_newest_hash': 'current',
'standalone_target_hash': 'current-tripleo',
'standalone_target_release': 'queens'
}), ('pike', {
'undercloud_install_release': 'pike',
'undercloud_install_hash': 'current-tripleo',
@@ -427,6 +695,12 @@ def test_period_overcloud_update_target_is_hash(mock_get_hash,
'overcloud_deploy_hash': 'current-tripleo',
'overcloud_target_release': 'pike',
'overcloud_target_hash': 'current-tripleo',
'standalone_deploy_newest_hash': 'current',
'standalone_deploy_hash': 'current-tripleo',
'standalone_deploy_release': 'pike',
'standalone_target_newest_hash': 'current',
'standalone_target_hash': 'current-tripleo',
'standalone_target_release': 'pike'
}), ('ocata', {
'undercloud_install_release': 'ocata',
'undercloud_install_hash': 'current-tripleo',
@@ -436,17 +710,25 @@ def test_period_overcloud_update_target_is_hash(mock_get_hash,
'overcloud_deploy_hash': 'current-tripleo',
'overcloud_target_release': 'ocata',
'overcloud_target_hash': 'current-tripleo',
'standalone_deploy_newest_hash': 'current',
'standalone_deploy_hash': 'current-tripleo',
'standalone_deploy_release': 'ocata',
'standalone_target_newest_hash': 'current',
'standalone_target_hash': 'current-tripleo',
'standalone_target_release': 'ocata'
})])
def test_noop_target_is_the_same(mock_get_hash,
stable_release,
expected_releases):
mock_get_hash.return_value = 'current-tripleo'
mock_get_hash.side_effect = ['current', 'current-tripleo']
featureset = {}
upgrade_from = False
assert (compose_releases_dictionary(stable_release,
featureset,
upgrade_from) == expected_releases)
mock_get_hash.assert_called_once_with(stable_release, 'current-tripleo')
mock_get_hash.assert_has_calls(
[mock.call(stable_release, 'current'),
mock.call(stable_release, 'current-tripleo')])


@mock.patch('emit_releases_file.get_dlrn_hash')
@@ -460,6 +742,12 @@ def test_noop_target_is_the_same(mock_get_hash,
'overcloud_deploy_hash': 'tripleo-ci-testing',
'overcloud_target_release': 'master',
'overcloud_target_hash': 'tripleo-ci-testing',
'standalone_deploy_newest_hash': 'current',
'standalone_deploy_hash': 'tripleo-ci-testing',
'standalone_deploy_release': 'master',
'standalone_target_newest_hash': 'current',
'standalone_target_hash': 'tripleo-ci-testing',
'standalone_target_release': 'master'
}), ('rocky', {
'undercloud_install_release': 'rocky',
'undercloud_install_hash': 'tripleo-ci-testing',
@@ -469,6 +757,12 @@ def test_noop_target_is_the_same(mock_get_hash,
'overcloud_deploy_hash': 'tripleo-ci-testing',
'overcloud_target_release': 'rocky',
'overcloud_target_hash': 'tripleo-ci-testing',
'standalone_deploy_newest_hash': 'current',
'standalone_deploy_hash': 'tripleo-ci-testing',
'standalone_deploy_release': 'rocky',
'standalone_target_newest_hash': 'current',
'standalone_target_hash': 'tripleo-ci-testing',
'standalone_target_release': 'rocky'
}), ('queens', {
'undercloud_install_release': 'queens',
'undercloud_install_hash': 'tripleo-ci-testing',
@@ -478,6 +772,12 @@ def test_noop_target_is_the_same(mock_get_hash,
'overcloud_deploy_hash': 'tripleo-ci-testing',
'overcloud_target_release': 'queens',
'overcloud_target_hash': 'tripleo-ci-testing',
'standalone_deploy_newest_hash': 'current',
'standalone_deploy_hash': 'tripleo-ci-testing',
'standalone_deploy_release': 'queens',
'standalone_target_newest_hash': 'current',
'standalone_target_hash': 'tripleo-ci-testing',
'standalone_target_release': 'queens'
}), ('pike', {
'undercloud_install_release': 'pike',
'undercloud_install_hash': 'tripleo-ci-testing',
@@ -487,6 +787,12 @@ def test_noop_target_is_the_same(mock_get_hash,
'overcloud_deploy_hash': 'tripleo-ci-testing',
'overcloud_target_release': 'pike',
'overcloud_target_hash': 'tripleo-ci-testing',
'standalone_deploy_newest_hash': 'current',
'standalone_deploy_hash': 'tripleo-ci-testing',
'standalone_deploy_release': 'pike',
'standalone_target_newest_hash': 'current',
'standalone_target_hash': 'tripleo-ci-testing',
'standalone_target_release': 'pike'
}), ('ocata', {
'undercloud_install_release': 'ocata',
'undercloud_install_hash': 'tripleo-ci-testing',
@@ -496,15 +802,23 @@ def test_noop_target_is_the_same(mock_get_hash,
'overcloud_deploy_hash': 'tripleo-ci-testing',
'overcloud_target_release': 'ocata',
'overcloud_target_hash': 'tripleo-ci-testing',
'standalone_deploy_newest_hash': 'current',
'standalone_deploy_hash': 'tripleo-ci-testing',
'standalone_deploy_release': 'ocata',
'standalone_target_newest_hash': 'current',
'standalone_target_hash': 'tripleo-ci-testing',
'standalone_target_release': 'ocata'
})])
def test_periodic_noop_target_is_the_same(mock_get_hash,
stable_release,
expected_releases):
mock_get_hash.return_value = 'tripleo-ci-testing'
mock_get_hash.side_effect = ['current', 'tripleo-ci-testing']
featureset = {}
upgrade_from = False
assert (compose_releases_dictionary(stable_release,
featureset,
upgrade_from,
is_periodic=True) == expected_releases)
mock_get_hash.assert_called_once_with(stable_release, 'tripleo-ci-testing')
mock_get_hash.assert_has_calls(
[mock.call(stable_release, 'current'),
mock.call(stable_release, 'tripleo-ci-testing')])

+ 11
- 0
scripts/emit_releases_file/test_unsupported_upgrades.py View File

@@ -62,6 +62,17 @@ def test_ffu_overcloud_upgrade_only_supported_from_newton(stable_release):
compose_releases_dictionary(stable_release, featureset, upgrade_from)


@pytest.mark.parametrize('stable_release',
['newton', 'ocata', 'pike', 'queens', 'rocky'])
def test_standalone_upgrade_only_supported_from_stein(stable_release):
featureset = {
'standalone_upgrade': True,
}
upgrade_from = False
with pytest.raises(RuntimeError):
compose_releases_dictionary(stable_release, featureset, upgrade_from)


def test_fail_with_wrong_release():
with pytest.raises(RuntimeError):
compose_releases_dictionary('foobar', {}, False)

+ 12
- 0
scripts/emit_releases_file/test_write_bash_script.py View File

@@ -28,6 +28,12 @@ def releases_dictionary():
'overcloud_deploy_hash': 'current-tripleo',
'overcloud_target_release': 'master',
'overcloud_target_hash': 'current-tripleo',
'standalone_deploy_release': 'master',
'standalone_deploy_newest_hash': 'current',
'standalone_deploy_hash': 'current-tripleo',
'standalone_target_release': 'master',
'standalone_target_newest_hash': 'current',
'standalone_target_hash': 'current-tripleo',
}


@@ -40,6 +46,12 @@ def releases_dictionary():
'overcloud_deploy_hash',
'overcloud_target_release',
'overcloud_target_hash',
'standalone_deploy_release',
'standalone_deploy_newest_hash',
'standalone_deploy_hash',
'standalone_target_release',
'standalone_target_newest_hash',
'standalone_target_hash',
])
def test_missing_key_fails(releases_dictionary, deleted_key):
wrong_releases_dictionary = releases_dictionary.pop(deleted_key)


+ 2
- 1
scripts/oooq_common_functions.sh View File

@@ -158,6 +158,7 @@ get_extra_vars_from_release()
{
local release_name=$1
local release_hash=$2
local newest_release_hash=${3:-""}
local release_file=$LOCAL_WORKING_DIR/config/release/tripleo-ci/${DISTRIBUTION:-CentOS}-${DISTRIBUTION_MAJOR_VERSION:-7}/$release_name.yml
echo "--extra-vars @$release_file -e dlrn_hash=$release_hash -e get_build_command=$release_hash"
echo "--extra-vars @$release_file -e dlrn_hash=$release_hash -e get_build_command=$release_hash ${newest_release_hash:+-e dlrn_hash_newest=$newest_release_hash}"
}

Loading…
Cancel
Save