311386a353
Add USM prestaging support. This commit introduces support for the --for-sw-deploy and --for-install prestaging options. The --for-install option is the default, and is the equivalent of the previous release prestaging behaviour - the subcloud ostree repo is prestaged in the platform-backup partition. The --for-sw-deploy option is the new prestaging behaviour for USM major and minor releases. This commit focuses on prestaging minor release updates. The --for-sw-deploy option requires synchronization of ostree commits and /opt/software/metadata contents from the system controller to the subcloud. See the header file of playbookconfig/src/playbooks/roles/prestage/ sync-software-metadata/tasks/main.yml for a detailed overview of the algorithm to synchronize the ostree commits and metadata from the system controller onto the subcloud. Notes on --release YY.MM and --release YY.MM.nn handling: - The --release value can either be a major release, in format YY.MM, or a specific minor release, in format YY.MM.nn. - If format is YY.MM, the behaviour is to prestage ALL minor releases present on the system controller to the subcloud. - If format is YY.MM.nn, the behaviour is to prestage ONLY the given minor release - Note: there is no sanity checking for dependent minor updates. If update YY.MM.nn is given but YY.MM.nn-1 is not present, the operation is currently allowed. This will be addressed in a future commit (see TODO below) - TODO: Future commit will expand on this behaviour for YY.MM.nn to prestage all missing commits up to and including the YY.MM.nn commit Unit tests for ostree-metadata-sync.sh: A local BATS unit test script is added to unit test the ostree-metadata-sync.sh script. The unit tests must be run manually - there is no zuul support for BATS testing. See the README.md file in the test directory for information on running the tests for this file. This commit also handles the metadata synchronization when a subcloud is installed. In this case, the /opt/software/metadata is synchronized during the subcloud install, so that when the subcloud pulls from the system controller feed ostree repo, the subcloud is bootstrapped with the correct /opt/software/metadata hierarchy. NOTE: this commit also turns off line-length checking for bashate. We do not enforce line-length for bash scripts in metal, since it arguably makes it more difficult to write bash scripts (due to challenges with quoting, etc.) Test Cases PASS - Verify when --release YY.MM is given, all minor releases are included for synchronizaton to the subcloud - Verify when there is only one release on system controller, the synchronization is skipped (there are no updates to synchronize) - For prestaging a minor release, verify the minor release appears in the correct location/state onthe subcloud: | System Controller state | Subcloud state | Subcloud result | | ----------------------- | -------------- | --------------- | | available | - | available | | deploying | - | available | | deployed | - | available | | deployed | deployed | deployed | | | | | - Verify prestaging --for-install - verify that prestaging works as in previous release: - ostree_repo staged in /opt/platform-backup Story: 2010676 Task: 50325 Signed-off-by: Kyle MacLeod <kyle.macleod@windriver.com> Change-Id: I4c67f03d0cfcf60e1bf78fc4c80ec18271fc49c1
85 lines
2.4 KiB
INI
85 lines
2.4 KiB
INI
[tox]
|
|
envlist = linters,pep8
|
|
minversion = 2.3
|
|
skipsdist = True
|
|
toxworkdir = /tmp/{env:USER}_ansible-playbookstox
|
|
|
|
[testenv]
|
|
install_command = pip install -U {opts} {packages}
|
|
setenv = VIRTUAL_ENV={envdir}
|
|
OS_STDOUT_CAPTURE=1
|
|
OS_STDERR_CAPTURE=1
|
|
OS_TEST_TIMEOUT=60
|
|
ANSIBLE_LOCAL_TEMP={toxworkdir}/.ansible/tmp
|
|
deps = -r{toxinidir}/requirements.txt
|
|
-r{toxinidir}/test-requirements.txt
|
|
|
|
[testenv:linters]
|
|
basepython = python3
|
|
allowlist_externals = bash
|
|
commands =
|
|
{[testenv:ansible-lint]commands}
|
|
bash -c "find {toxinidir} \
|
|
-not \( -type d -name .?\* -prune \) \
|
|
-type f \
|
|
-not -name \*~ \
|
|
-not -name \*.md \
|
|
-name \*.sh \
|
|
-print0 | xargs -r -n 1 -0 bashate -iE006 -v"
|
|
bash -c "find {toxinidir} \
|
|
-path '{toxinidir}/.tox' -a -prune \
|
|
-o -name '*.yaml' \
|
|
-o -name '*.yml' \
|
|
-print0 | xargs -0 yamllint"
|
|
|
|
[testenv:ansible-lint]
|
|
basepython = python3
|
|
allowlist_externals = bash
|
|
# ansible-lint error checks are suppressed/skipped through the .ansible-lint file
|
|
commands =
|
|
bash -c "ls playbookconfig/src/playbooks/*.yml | xargs --no-run-if-empty ansible-lint"
|
|
|
|
[testenv:pep8]
|
|
basepython = python3
|
|
usedevelop = False
|
|
description =
|
|
Run style checks.
|
|
|
|
|
|
commands =
|
|
flake8
|
|
|
|
|
|
[flake8]
|
|
# E123, E125 skipped as they are invalid PEP-8.
|
|
# E501 skipped because some of the code files include templates
|
|
# that end up quite wide
|
|
# H405: multi line docstring summary not separated with an empty line
|
|
show-source = True
|
|
ignore = E123,E125,E501,H405,W504
|
|
exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build,release-tag-*
|
|
|
|
|
|
[testenv:venv]
|
|
basepython = python3
|
|
commands = {posargs}
|
|
|
|
[bandit]
|
|
# The following bandit tests are being skipped:
|
|
# B108: Test for insecure usage of tmp file/directory
|
|
# B110: Try, Except, Pass detected.
|
|
# B404: Import of subprocess module
|
|
# B603: Test for use of subprocess without shell equals true
|
|
# B607: Test for starting a process with a partial path
|
|
# B608: Possible SQL injection vector through string-based query
|
|
#
|
|
# Note: 'skips' entry cannot be split across multiple lines
|
|
#
|
|
skips = B108,B110,B404,B603,B607,B608
|
|
exclude = tests
|
|
|
|
[testenv:bandit]
|
|
basepython = python3
|
|
deps = -r{toxinidir}/test-requirements.txt
|
|
commands = bandit --ini tox.ini -n 5 -r playbookconfig/src/playbooks/roles
|