diff --git a/SOURCES/0001-Update-welcome-message-767.patch b/SOURCES/0001-Update-welcome-message-767.patch new file mode 100644 index 0000000..cb47eab --- /dev/null +++ b/SOURCES/0001-Update-welcome-message-767.patch @@ -0,0 +1,40 @@ +From a8cb5e0de9e994693a28cf96524b690437ab4f26 Mon Sep 17 00:00:00 2001 +From: ina vasilevskaya +Date: Wed, 23 Mar 2022 12:34:20 +0100 +Subject: [PATCH 1/9] Update welcome message (#767) + +A necessary change that should finally represent the changes of +the previous quarters: several jobs disablement and new CI +introduction. +No more e2e and internal copr build jobs, /rerun command finally +documented. + +OAMG-5822 +--- + .github/workflows/pr-welcome-msg.yml | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/.github/workflows/pr-welcome-msg.yml b/.github/workflows/pr-welcome-msg.yml +index 468caf4..51d8d88 100644 +--- a/.github/workflows/pr-welcome-msg.yml ++++ b/.github/workflows/pr-welcome-msg.yml +@@ -20,11 +20,14 @@ jobs: + body: | + ## **Thank you for contributing to the Leapp project!** + Please note that every PR needs to comply with the [Leapp Guidelines](https://leapp.readthedocs.io/en/latest/contributing.html#) and must pass all tests in order to be mergable. +- If you want to re-run tests or request review, you can use following commands as a comment: +- - **leapp-ci build** to run copr build and e2e tests in **OAMG CI** ++ If you want to request a review or rebuild a package in copr, you can use following commands as a comment: + - **review please** to notify leapp developers of review request + - **/packit copr-build** to submit a public copr build using packit + ++ To launch regression testing public members of oamg organization can leave the following comment: ++ - **/rerun** to schedule tests using this pr build and leapp-repository*master* as artifacts ++ - **/rerun 42** to schedule tests using this pr build and leapp-repository*PR42* as artifacts ++ + Please [open ticket](https://url.corp.redhat.com/oamg-ci-issue) in case you experience technical problem with the CI. (RH internal only) + + **Note:** In case there are problems with tests not being triggered automatically on new PR/commit or pending for a long time, please consider rerunning the CI by commenting **leapp-ci build** (might require several comments). If the problem persists, contact leapp-infra. +-- +2.35.3 + diff --git a/SOURCES/0002-Switch-to-the-official-composite-action-for-tft.patch b/SOURCES/0002-Switch-to-the-official-composite-action-for-tft.patch new file mode 100644 index 0000000..fd81565 --- /dev/null +++ b/SOURCES/0002-Switch-to-the-official-composite-action-for-tft.patch @@ -0,0 +1,110 @@ +From ec3c86388ae1eb2056e17210a9d02459817e6154 Mon Sep 17 00:00:00 2001 +From: Inessa Vasilevskaya +Date: Fri, 11 Feb 2022 10:38:42 +0100 +Subject: [PATCH 2/9] Switch to the official composite action for tft + +Looks like phracek's github action is mature enough +https://github.com/sclorg/testing-farm-as-github-action to +perform that switch. Status update enablement is not part +of this patch. + +In order to enable wait-for-result functionality the single +tmt-tests workflow will have to be split into 2 distinct +7to8 and 8to9 workflows (to be done in following commits). +This will cause massive refactoring, probably +involving moving artifacts preparation into one workflow and +creating a specific repository_dispatch event to trigger +7to8 and 8to9 with test artifacts as inputs. + +OAMG-6493 +--- + .github/workflows/tmt-tests.yml | 51 +++++++++++++++++++++------------ + 1 file changed, 33 insertions(+), 18 deletions(-) + +diff --git a/.github/workflows/tmt-tests.yml b/.github/workflows/tmt-tests.yml +index 1d19fd6..ed77774 100644 +--- a/.github/workflows/tmt-tests.yml ++++ b/.github/workflows/tmt-tests.yml +@@ -93,7 +93,6 @@ jobs: + }) + + - name: If leapp_repository_pr was specified in the comment - trigger copr build +- # TODO: XXX FIXME This should schedule copr build for leapp but for now it will be just setting an env var + id: leapp_repository_pr + if: ${{ steps.leapp_repository_pr_regex_match.outputs.match != '' }} + run: | +@@ -151,38 +150,54 @@ jobs: + - name: Schedule regression testing for 7to8 + id: run_test_7to8 + env: +- ARTIFACTS: ${{ format('{0},{1}', steps.leapp_repository_pr_regex_match.outputs.match != '' && steps.copr_build_leapp_repository.outputs.copr_id || steps.get_latest_lpr_copr_build_id.outputs.copr_id, steps.copr_build.outputs.copr_id) }} +- uses: oamg/testing-farm-service-action@main ++ ARTIFACTS: ${{ format('{0};{1}', steps.leapp_repository_pr_regex_match.outputs.match != '' && steps.copr_build_leapp_repository.outputs.copr_id || steps.get_latest_lpr_copr_build_id.outputs.copr_id, steps.copr_build.outputs.copr_id) }} ++ uses: sclorg/testing-farm-as-github-action@v1 + with: + # required +- tft_server: ${{ secrets.TF_ENDPOINT }} +- tft_token: ${{ secrets.TF_API_KEY }} +- compose: ${{ secrets.COMPOSE_RHEL79 }} +- artifacts: ${{ env.ARTIFACTS }} ++ api_url: ${{ secrets.TF_ENDPOINT }} ++ api_key: ${{ secrets.TF_API_KEY }} ++ git_url: 'https://gitlab.cee.redhat.com/oamg/tmt-plans' ++ github_token: ${{ secrets.GITHUB_TOKEN }} + # optional +- tests_regex: "^(?!.*c2r)(?!.*sap)(?!.*8to9)" ++ tf_scope: 'private' ++ tmt_plan_regex: "^(?!.*c2r)(?!.*sap)(?!.*8to9)" ++ compose: ${{ secrets.COMPOSE_RHEL79 }} + arch: 'x86_64' + copr: 'epel-7-x86_64' ++ copr_artifacts: ${{ env.ARTIFACTS }} + debug: ${{ secrets.ACTIONS_STEP_DEBUG }} +- test_name: '7to8' + tmt_context: 'distro=rhel-7' ++ pull_request_status_name: '7to8' ++ create_issue_comment: 'true' ++ # NOTE(ivasilev) In order to update pr status this workflow has to be massively refactored with artifacts ++ # preparation moved out to a different workflow and the rest split into 2 workflows - 7to8 and 8to9 that are ++ # triggered on a specific repository dispatch event. ++ update_pull_request_status: 'false' + + - name: Schedule regression testing for 8to9 + id: run_test_8to9 + env: +- ARTIFACTS: ${{ format('{0},{1}', steps.leapp_repository_pr_regex_match.outputs.match != '' && steps.copr_build_leapp_repository.outputs.copr_id || steps.get_latest_lpr_copr_build_id.outputs.copr_id, steps.copr_build.outputs.copr_id) }} +- uses: oamg/testing-farm-service-action@main ++ ARTIFACTS: ${{ format('{0};{1}', steps.leapp_repository_pr_regex_match.outputs.match != '' && steps.copr_build_leapp_repository.outputs.copr_id || steps.get_latest_lpr_copr_build_id.outputs.copr_id, steps.copr_build.outputs.copr_id) }} ++ uses: sclorg/testing-farm-as-github-action@v1 + with: + # required +- tft_server: ${{ secrets.TF_ENDPOINT }} +- tft_token: ${{ secrets.TF_API_KEY }} +- compose: ${{ secrets.COMPOSE_RHEL86 }} +- artifacts: ${{ env.ARTIFACTS }} ++ api_url: ${{ secrets.TF_ENDPOINT }} ++ api_key: ${{ secrets.TF_API_KEY }} ++ git_url: 'https://gitlab.cee.redhat.com/oamg/tmt-plans' ++ github_token: ${{ secrets.GITHUB_TOKEN }} + # optional +- tests_regex: "^(?!.*c2r)(?!.*sap)(?!.*7to8)" ++ tf_scope: 'private' ++ tmt_plan_regex: "^(?!.*c2r)(?!.*sap)(?!.*7to8)" ++ compose: ${{ secrets.COMPOSE_RHEL86 }} + arch: 'x86_64' + copr: 'epel-8-x86_64' ++ copr_artifacts: ${{ env.ARTIFACTS }} + debug: ${{ secrets.ACTIONS_STEP_DEBUG }} +- test_name: '8to9' +- env_vars: 'TARGET_RELEASE=9.0;TARGET_KERNEL=el9;RHSM_SKU=RH00069;RHSM_REPOS=rhel-8-for-x86_64-appstream-beta-rpms,rhel-8-for-x86_64-baseos-beta-rpms;LEAPP_EXEC_ENV_VARS=LEAPP_DEVEL_TARGET_PRODUCT_TYPE=beta' ++ variables: 'TARGET_RELEASE=9.0;TARGET_KERNEL=el9;RHSM_SKU=RH00069;RHSM_REPOS=rhel-8-for-x86_64-appstream-beta-rpms,rhel-8-for-x86_64-baseos-beta-rpms;LEAPP_EXEC_ENV_VARS=LEAPP_DEVEL_TARGET_PRODUCT_TYPE=beta' + tmt_context: 'distro=rhel-8' ++ pull_request_status_name: '8to9' ++ create_issue_comment: 'true' ++ # NOTE(ivasilev) In order to update pr status this workflow has to be massively refactored with artifacts ++ # preparation moved out to a different workflow and the rest split into 2 workflows - 7to8 and 8to9 that are ++ # triggered on a specific repository dispatch event. ++ update_pull_request_status: 'false' +-- +2.35.3 + diff --git a/SOURCES/0003-Use-v1.2.9-version-of-github-action.patch b/SOURCES/0003-Use-v1.2.9-version-of-github-action.patch new file mode 100644 index 0000000..ac527ae --- /dev/null +++ b/SOURCES/0003-Use-v1.2.9-version-of-github-action.patch @@ -0,0 +1,36 @@ +From 8e746739e448456aca4426ead38a222b90f6711d Mon Sep 17 00:00:00 2001 +From: Inessa Vasilevskaya +Date: Mon, 21 Mar 2022 12:31:59 +0100 +Subject: [PATCH 3/9] Use v1.2.9 version of github action + +This has been tested and declared working, so lets use +this one for greater stability instead of v1 +--- + .github/workflows/tmt-tests.yml | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/.github/workflows/tmt-tests.yml b/.github/workflows/tmt-tests.yml +index ed77774..4bfb191 100644 +--- a/.github/workflows/tmt-tests.yml ++++ b/.github/workflows/tmt-tests.yml +@@ -151,7 +151,7 @@ jobs: + id: run_test_7to8 + env: + ARTIFACTS: ${{ format('{0};{1}', steps.leapp_repository_pr_regex_match.outputs.match != '' && steps.copr_build_leapp_repository.outputs.copr_id || steps.get_latest_lpr_copr_build_id.outputs.copr_id, steps.copr_build.outputs.copr_id) }} +- uses: sclorg/testing-farm-as-github-action@v1 ++ uses: sclorg/testing-farm-as-github-action@v1.2.9 + with: + # required + api_url: ${{ secrets.TF_ENDPOINT }} +@@ -178,7 +178,7 @@ jobs: + id: run_test_8to9 + env: + ARTIFACTS: ${{ format('{0};{1}', steps.leapp_repository_pr_regex_match.outputs.match != '' && steps.copr_build_leapp_repository.outputs.copr_id || steps.get_latest_lpr_copr_build_id.outputs.copr_id, steps.copr_build.outputs.copr_id) }} +- uses: sclorg/testing-farm-as-github-action@v1 ++ uses: sclorg/testing-farm-as-github-action@v1.2.9 + with: + # required + api_url: ${{ secrets.TF_ENDPOINT }} +-- +2.35.3 + diff --git a/SOURCES/0004-testing-Start-using-GH-Actions-for-unit-tests-719.patch b/SOURCES/0004-testing-Start-using-GH-Actions-for-unit-tests-719.patch new file mode 100644 index 0000000..7880761 --- /dev/null +++ b/SOURCES/0004-testing-Start-using-GH-Actions-for-unit-tests-719.patch @@ -0,0 +1,531 @@ +From 2869a3ba3dda450f05e0045849db7a32bbb1787c Mon Sep 17 00:00:00 2001 +From: Vinzenz 'evilissimo' Feenstra +Date: Mon, 28 Mar 2022 11:21:04 +0200 +Subject: [PATCH 4/9] testing: Start using GH Actions for unit tests (#719) + +This patch applies all necessary changes to make tests run on +GitHub Actions. +As part of this patch we are transitioning like in leapp-repository +to ubi based containers running on podman. This will gives us the closest +resemblance to the target environments. Tests for fedora & others can be +eventually added as well. For now this patch focuses on our main targets +as the tests have not been working for some time. + +Also as part of this patch some minor flake8 fixes have been applied, +and the answerstore test has been fixed. + +Signed-off-by: Vinzenz Feenstra +--- + .github/workflows/unit-tests.yml | 38 +++++++++++++++++++ + Makefile | 6 --- + leapp/actors/__init__.py | 1 - + leapp/messaging/answerstore.py | 3 -- + leapp/repository/manager.py | 1 - + requirements-tests.txt | 10 ++--- + res/container-tests/Containerfile.ubi7 | 35 +++++++++++++++++ + res/container-tests/Containerfile.ubi8 | 38 +++++++++++++++++++ + res/container-tests/Containerfile.ubi9 | 36 ++++++++++++++++++ + res/docker-tests/Dockerfile | 19 ---------- + res/docker-tests/Dockerfile.centos7 | 19 ---------- + res/docker-tests/Dockerfile.centos8 | 18 --------- + .../workflow-api-tests/apis/v1/__init__.py | 11 +++++- + .../workflow-api-tests/apis/v1/depcheck.py | 2 +- + .../workflow-api-tests/apis/v1/testapi.py | 2 +- + .../workflow-api-tests/apis/v2/__init__.py | 14 ++++++- + .../data/workflow-api-tests/apis/v2/newapi.py | 1 + + .../workflow-api-tests/apis/v2/testapi.py | 2 +- + .../workflow-api-tests/apis/v3/__init__.py | 12 +++++- + tests/scripts/test_answerstore.py | 4 ++ + 20 files changed, 192 insertions(+), 80 deletions(-) + create mode 100644 .github/workflows/unit-tests.yml + create mode 100644 res/container-tests/Containerfile.ubi7 + create mode 100644 res/container-tests/Containerfile.ubi8 + create mode 100644 res/container-tests/Containerfile.ubi9 + delete mode 100644 res/docker-tests/Dockerfile + delete mode 100644 res/docker-tests/Dockerfile.centos7 + delete mode 100644 res/docker-tests/Dockerfile.centos8 + +diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml +new file mode 100644 +index 0000000..123a73e +--- /dev/null ++++ b/.github/workflows/unit-tests.yml +@@ -0,0 +1,38 @@ ++name: Unit Tests ++on: ++ push: ++ branches: ++ - master ++ pull_request: ++ branches: ++ - master ++ ++jobs: ++ test: ++ name: Run unit tests in containers ++ runs-on: ubuntu-latest ++ strategy: ++ fail-fast: false ++ matrix: ++ scenarios: ++ - name: Run unit tests with python3.9 on el8 ++ python: python3.9 ++ container: ubi8 ++ - name: Run unit tests with python 3.6 on el8 ++ python: python3.6 ++ container: ubi8 ++ - name: Run unit tests with python2.7 on el7 ++ python: python2.7 ++ container: ubi7 ++ ++ steps: ++ - name: Checkout code ++ uses: actions/checkout@v2 ++ with: ++ fetch-depth: '0' ++ - name: Set master to origin/master ++ if: github.ref != 'refs/heads/master' ++ run: | ++ git branch -f master origin/master ++ - name: ${{matrix.scenarios.name}} ++ run: script -e -c /bin/bash -c 'TERM=xterm podman build --security-opt=seccomp=unconfined -t leapp-tests -f res/container-tests/Containerfile.${{matrix.scenarios.container}} res/container-tests && PYTHON_VENV=${{matrix.scenarios.python}} REPOSITORIES=${{matrix.scenarios.repos}} podman run --security-opt=seccomp=unconfined --rm -ti -v ${PWD}:/payload --env=PYTHON_VENV --env=REPOSITORIES leapp-tests' +diff --git a/Makefile b/Makefile +index 4d500e9..611d255 100644 +--- a/Makefile ++++ b/Makefile +@@ -123,10 +123,6 @@ install: + install -dm 0755 ${LIBDIR} + umask 177 && $(PYTHON_VENV) -c "import sqlite3; sqlite3.connect('${LIBDIR}/audit.db').executescript(open('res/audit-layout.sql', 'r').read())" + +-install-container-test: +- docker pull registry.centos.org/${CONTAINER} +- docker build -t leapp-tests -f res/docker-tests/Dockerfile.$(subst :,,${CONTAINER}) res/docker-tests +- + install-test: + ifeq ($(shell id -u), 0) + pip install -r requirements-tests.txt +@@ -136,8 +132,6 @@ else + pip install -r requirements-tests.txt + endif + +-container-test: +- docker run --rm -ti -v ${PWD}:/payload leapp-tests + + test: lint + @ $(ENTER_VENV) \ +diff --git a/leapp/actors/__init__.py b/leapp/actors/__init__.py +index 5c7e9df..c472b84 100644 +--- a/leapp/actors/__init__.py ++++ b/leapp/actors/__init__.py +@@ -183,7 +183,6 @@ class Actor(object): + """ Returns all actor tools paths related to the actor and common actors tools paths. """ + return self.actor_tools_paths + self.common_tools_paths + +- + def get_folder_path(self, name): + """ + Finds the first matching folder path within :py:attr:`files_paths`. +diff --git a/leapp/messaging/answerstore.py b/leapp/messaging/answerstore.py +index c03317c..3e55e8a 100644 +--- a/leapp/messaging/answerstore.py ++++ b/leapp/messaging/answerstore.py +@@ -40,7 +40,6 @@ class AnswerStore(object): + # So don't even bother updating this to some more 'pythonic' coding style + self._storage[scope] = dialog_scope + +- + @classmethod + def _load_ini(cls, inifile): + """ +@@ -59,7 +58,6 @@ class AnswerStore(object): + raise CommandError('Failed to load answer file {inifile} with the following errors: {errors}'.format( + inifile=inifile, errors=exc.message)) + +- + def update(self, answer_file, allow_missing=False): + """ + Update answerfile with all answers from answerstore that have correspondent sections in the file. +@@ -81,7 +79,6 @@ class AnswerStore(object): + conf.write(afile) + return not_updated + +- + def load(self, answer_file): + """ + Loads an answer file from the given location and updates the loaded data with it. +diff --git a/leapp/repository/manager.py b/leapp/repository/manager.py +index 10b7bba..7d6cb22 100644 +--- a/leapp/repository/manager.py ++++ b/leapp/repository/manager.py +@@ -45,7 +45,6 @@ class RepositoryManager(object): + actors.append(actor) + return actors + +- + def lookup_workflow(self, name): + """ + Find workflow in all loaded repositories +diff --git a/requirements-tests.txt b/requirements-tests.txt +index 97d6453..74c3955 100644 +--- a/requirements-tests.txt ++++ b/requirements-tests.txt +@@ -1,10 +1,10 @@ + -r requirements.txt + -e . + ++flake8 ++isort + jsonschema==3.2.0 + mock +-pyrsistent==0.16.1 +-pytest==3.6.4 +-pytest-flake8 +-pytest-cov==2.9.0 +-pytest-pylint==0.14.1 ++pylint ++pytest-cov ++pytest==4.6.11 +diff --git a/res/container-tests/Containerfile.ubi7 b/res/container-tests/Containerfile.ubi7 +new file mode 100644 +index 0000000..bc434b9 +--- /dev/null ++++ b/res/container-tests/Containerfile.ubi7 +@@ -0,0 +1,35 @@ ++FROM registry.access.redhat.com/ubi7/ubi:7.9 ++ ++VOLUME /payload ++ ++RUN yum -y install python27-python-pip && \ ++ scl enable python27 -- pip install -U --target /usr/lib/python2.7/site-packages/ pip==20.3.0 && \ ++ python -m pip install --ignore-installed pip==20.3.4 virtualenv ++ ++WORKDIR /payload ++ENTRYPOINT virtualenv testenv && \ ++ source testenv/bin/activate && \ ++ pip install -U setuptools && \ ++ pip install -U funcsigs && \ ++ pip install -U -r requirements-tests.txt && \ ++ pip install -U . && \ ++ export LINTABLES=$(find . -name '*.py' | grep -E -e '^\./leapp\/' -e '^\./tests/scripts/' | sort -u ) && \ ++ echo '==================================================' && \ ++ echo '==================================================' && \ ++ echo '=============== Running pylint ===============' && \ ++ echo '==================================================' && \ ++ echo '==================================================' && \ ++ # echo $LINTABLES | xargs pylint --py3k && echo '===> pylint PASSED' && \ ++ echo 'TEMPORARILY DISABLED' && \ ++ echo '==================================================' && \ ++ echo '==================================================' && \ ++ echo '=============== Running flake8 ===============' && \ ++ echo '==================================================' && \ ++ echo '==================================================' && \ ++ flake8 $LINTABLES && echo '===> flake8 PASSED' && \ ++ echo '==================================================' && \ ++ echo '==================================================' && \ ++ echo '=============== Running tests ===============' && \ ++ echo '==================================================' && \ ++ echo '==================================================' && \ ++ py.test -vv --cov-report term-missing --cov=leapp tests/scripts/*.py +diff --git a/res/container-tests/Containerfile.ubi8 b/res/container-tests/Containerfile.ubi8 +new file mode 100644 +index 0000000..2b8db2f +--- /dev/null ++++ b/res/container-tests/Containerfile.ubi8 +@@ -0,0 +1,38 @@ ++FROM registry.access.redhat.com/ubi8/ubi:latest ++ ++VOLUME /payload ++ ++ENV PYTHON_VENV "python3.6" ++ ++RUN yum update -y && \ ++ yum install python3 python39 python3-virtualenv make -y && \ ++ yum -y install python3-pip && \ ++ python3 -m pip install --upgrade pip==20.3.4 ++ ++WORKDIR /payload ++ENTRYPOINT virtualenv testenv -p "/usr/bin/$PYTHON_VENV" && \ ++ source testenv/bin/activate && \ ++ pip install -U setuptools && \ ++ pip install -U funcsigs && \ ++ pip install -U -r requirements-tests.txt && \ ++ pip install -U . && \ ++ export LINTABLES=$(find . -name '*.py' | grep -E -e '^\./leapp\/' -e '^\./tests/scripts/' | sort -u ) && \ ++ echo '==================================================' && \ ++ echo '==================================================' && \ ++ echo '=============== Running pylint ===============' && \ ++ echo '==================================================' && \ ++ echo '==================================================' && \ ++ # echo $LINTABLES | xargs pylint && echo '===> pylint PASSED' && \ ++ echo 'TEMPORARILY DISABLED' && \ ++ echo '==================================================' && \ ++ echo '==================================================' && \ ++ echo '=============== Running flake8 ===============' && \ ++ echo '==================================================' && \ ++ echo '==================================================' && \ ++ flake8 $LINTABLES && echo '===> flake8 PASSED' && \ ++ echo '==================================================' && \ ++ echo '==================================================' && \ ++ echo '=============== Running tests ===============' && \ ++ echo '==================================================' && \ ++ echo '==================================================' && \ ++ py.test -vv --cov-report term-missing --cov=leapp tests/scripts/*.py +diff --git a/res/container-tests/Containerfile.ubi9 b/res/container-tests/Containerfile.ubi9 +new file mode 100644 +index 0000000..4f31335 +--- /dev/null ++++ b/res/container-tests/Containerfile.ubi9 +@@ -0,0 +1,36 @@ ++FROM registry.access.redhat.com/ubi8/ubi:latest ++ ++VOLUME /payload ++ ++RUN yum update -y && \ ++ yum install python3 python39 python3-virtualenv make -y && \ ++ yum -y install python3-pip && \ ++ python3 -m pip install --upgrade pip==20.3.4 ++ ++WORKDIR /payload ++ENTRYPOINT virtualenv testenv -p "/usr/bin/$PYTHON_VENV" && \ ++ source testenv/bin/activate && \ ++ pip install -U setuptools && \ ++ pip install -U funcsigs && \ ++ pip install -U -r requirements-tests.txt && \ ++ pip install -U . && \ ++ export LINTABLES=$(find . -name '*.py' | grep -E -e '^\./leapp\/' -e '^\./tests/scripts/' | sort -u ) && \ ++ echo '==================================================' && \ ++ echo '==================================================' && \ ++ echo '=============== Running pylint ===============' && \ ++ echo '==================================================' && \ ++ echo '==================================================' && \ ++ # echo $LINTABLES | xargs pylint && echo '===> pylint PASSED' && \ ++ echo 'TEMPORARILY DISABLED' && \ ++ echo '==================================================' && \ ++ echo '==================================================' && \ ++ echo '=============== Running flake8 ===============' && \ ++ echo '==================================================' && \ ++ echo '==================================================' && \ ++ flake8 $LINTABLES && echo '===> flake8 PASSED' && \ ++ echo '==================================================' && \ ++ echo '==================================================' && \ ++ echo '=============== Running tests ===============' && \ ++ echo '==================================================' && \ ++ echo '==================================================' && \ ++ py.test -vv --cov-report term-missing --cov=leapp tests/scripts/*.py +diff --git a/res/docker-tests/Dockerfile b/res/docker-tests/Dockerfile +deleted file mode 100644 +index 18ce6cb..0000000 +--- a/res/docker-tests/Dockerfile ++++ /dev/null +@@ -1,19 +0,0 @@ +-FROM registry.centos.org/centos:7 +- +-VOLUME /payload +- +-RUN yum update -y && \ +- yum install python-virtualenv make -y && \ +- yum -y install epel-release && \ +- yum -y install python-pip python3-pip && \ +- python2 -m pip install --upgrade pip==20.3.4 && \ +- python3 -m pip install --upgrade pip==20.3.4 +- +-WORKDIR /payload +-ENTRYPOINT virtualenv testenv && \ +- source testenv/bin/activate && \ +- pip install -U setuptools && \ +- pip install -U funcsigs && \ +- pip install -U -r requirements-tests.txt && \ +- pip install -U . && \ +- py.test tests/scripts +diff --git a/res/docker-tests/Dockerfile.centos7 b/res/docker-tests/Dockerfile.centos7 +deleted file mode 100644 +index 18ce6cb..0000000 +--- a/res/docker-tests/Dockerfile.centos7 ++++ /dev/null +@@ -1,19 +0,0 @@ +-FROM registry.centos.org/centos:7 +- +-VOLUME /payload +- +-RUN yum update -y && \ +- yum install python-virtualenv make -y && \ +- yum -y install epel-release && \ +- yum -y install python-pip python3-pip && \ +- python2 -m pip install --upgrade pip==20.3.4 && \ +- python3 -m pip install --upgrade pip==20.3.4 +- +-WORKDIR /payload +-ENTRYPOINT virtualenv testenv && \ +- source testenv/bin/activate && \ +- pip install -U setuptools && \ +- pip install -U funcsigs && \ +- pip install -U -r requirements-tests.txt && \ +- pip install -U . && \ +- py.test tests/scripts +diff --git a/res/docker-tests/Dockerfile.centos8 b/res/docker-tests/Dockerfile.centos8 +deleted file mode 100644 +index 8eadbca..0000000 +--- a/res/docker-tests/Dockerfile.centos8 ++++ /dev/null +@@ -1,18 +0,0 @@ +-FROM registry.centos.org/centos:8 +- +-VOLUME /payload +- +-RUN yum update -y && \ +- yum install python3-virtualenv make -y && \ +- yum -y install epel-release && \ +- yum -y install python3-pip && \ +- python3 -m pip install --upgrade pip==20.3.4 +- +-WORKDIR /payload +-ENTRYPOINT virtualenv testenv && \ +- source testenv/bin/activate && \ +- pip install -U setuptools && \ +- pip install -U funcsigs && \ +- pip install -U -r requirements-tests.txt && \ +- pip install -U . && \ +- py.test tests/scripts +diff --git a/tests/data/workflow-api-tests/apis/v1/__init__.py b/tests/data/workflow-api-tests/apis/v1/__init__.py +index cf2cb98..ef59b4d 100644 +--- a/tests/data/workflow-api-tests/apis/v1/__init__.py ++++ b/tests/data/workflow-api-tests/apis/v1/__init__.py +@@ -1,2 +1,11 @@ +-from leapp.workflows.api.v1.testapi import TestAPI + from leapp.workflows.api.v1.depcheck import DepCheckAPI1, DepCheckAPI2, DepCheckAPI3, DepCheckAPI4 ++from leapp.workflows.api.v1.testapi import TestAPI ++ ++ ++__all__ = ( ++ DepCheckAPI1, ++ DepCheckAPI2, ++ DepCheckAPI3, ++ DepCheckAPI4, ++ TestAPI ++) +diff --git a/tests/data/workflow-api-tests/apis/v1/depcheck.py b/tests/data/workflow-api-tests/apis/v1/depcheck.py +index e76e1b0..4ef350f 100644 +--- a/tests/data/workflow-api-tests/apis/v1/depcheck.py ++++ b/tests/data/workflow-api-tests/apis/v1/depcheck.py +@@ -17,8 +17,8 @@ DepCheckAPI4 Produces: DepCheck4 Inherits: Produces: DepCheck2, Consumes DepChec + """ + + from leapp.libraries.stdlib import api +-from leapp.workflows.api import WorkflowAPI + from leapp.models import DepCheck1, DepCheck2, DepCheck3, DepCheck4 ++from leapp.workflows.api import WorkflowAPI + + + class DepCheckAPI1(WorkflowAPI): +diff --git a/tests/data/workflow-api-tests/apis/v1/testapi.py b/tests/data/workflow-api-tests/apis/v1/testapi.py +index af6ea40..404e059 100644 +--- a/tests/data/workflow-api-tests/apis/v1/testapi.py ++++ b/tests/data/workflow-api-tests/apis/v1/testapi.py +@@ -1,5 +1,5 @@ + from leapp.workflows.api import WorkflowAPI +-from leapp.workflows.api import v2 ++from leapp.workflows.api.v2 import testapi as v2 + + + class TestAPI(WorkflowAPI): +diff --git a/tests/data/workflow-api-tests/apis/v2/__init__.py b/tests/data/workflow-api-tests/apis/v2/__init__.py +index c3c0946..a087be9 100644 +--- a/tests/data/workflow-api-tests/apis/v2/__init__.py ++++ b/tests/data/workflow-api-tests/apis/v2/__init__.py +@@ -1,3 +1,13 @@ +-from leapp.workflows.api.v2.testapi import TestAPI + from leapp.workflows.api.v1.depcheck import DepCheckAPI1, DepCheckAPI2, DepCheckAPI3, DepCheckAPI4 +-from leapp.workflows.api.v2.newapi import NewAPI +\ No newline at end of file ++from leapp.workflows.api.v2.newapi import NewAPI ++from leapp.workflows.api.v2.testapi import TestAPI ++ ++ ++__all__ = ( ++ DepCheckAPI1, ++ DepCheckAPI2, ++ DepCheckAPI3, ++ DepCheckAPI4, ++ TestAPI, ++ NewAPI ++) +diff --git a/tests/data/workflow-api-tests/apis/v2/newapi.py b/tests/data/workflow-api-tests/apis/v2/newapi.py +index 339aac7..b8180f0 100644 +--- a/tests/data/workflow-api-tests/apis/v2/newapi.py ++++ b/tests/data/workflow-api-tests/apis/v2/newapi.py +@@ -1,5 +1,6 @@ + from leapp.workflows.api import WorkflowAPI + ++ + class NewAPI(WorkflowAPI): + def fun(self): + return 'NewAPI.fun' +diff --git a/tests/data/workflow-api-tests/apis/v2/testapi.py b/tests/data/workflow-api-tests/apis/v2/testapi.py +index 93854dd..46e5c23 100644 +--- a/tests/data/workflow-api-tests/apis/v2/testapi.py ++++ b/tests/data/workflow-api-tests/apis/v2/testapi.py +@@ -1,5 +1,5 @@ + from leapp.workflows.api import WorkflowAPI +-from leapp.workflows.api import v3 ++from leapp.workflows.api.v3 import testapi as v3 + + + class TestAPI(WorkflowAPI): +diff --git a/tests/data/workflow-api-tests/apis/v3/__init__.py b/tests/data/workflow-api-tests/apis/v3/__init__.py +index 44c5794..23e5fe4 100644 +--- a/tests/data/workflow-api-tests/apis/v3/__init__.py ++++ b/tests/data/workflow-api-tests/apis/v3/__init__.py +@@ -1,4 +1,12 @@ +-from leapp.workflows.api.v3.testapi import TestAPI +-from leapp.workflows.api.v2.newapi import NewAPI + from leapp.workflows.api.v1.depcheck import DepCheckAPI1, DepCheckAPI2, DepCheckAPI3, DepCheckAPI4 ++from leapp.workflows.api.v2.newapi import NewAPI ++from leapp.workflows.api.v3.testapi import TestAPI + ++__all__ = ( ++ DepCheckAPI1, ++ DepCheckAPI2, ++ DepCheckAPI3, ++ DepCheckAPI4, ++ TestAPI, ++ NewAPI ++) +diff --git a/tests/scripts/test_answerstore.py b/tests/scripts/test_answerstore.py +index 6562613..af5e8de 100644 +--- a/tests/scripts/test_answerstore.py ++++ b/tests/scripts/test_answerstore.py +@@ -18,6 +18,7 @@ class MockComponentKey1(object): + key = 'key1' + label = 'label key1' + description = 'description key1' ++ reason = 'Unbelievable reason' + default = False + value = None + +@@ -27,6 +28,7 @@ class MockComponentKey2(object): + key = 'key2' + label = 'label key2' + description = 'description key2' ++ reason = 'Cannot reason with this reason' + default = 'Default' + value = None + +@@ -36,6 +38,7 @@ class MockComponentKey1Bool(object): + key = 'key1' + label = 'label bool key1' + description = 'description bool key1' ++ reason = 'Unreasonable Reason' + default = True + value = None + +@@ -45,6 +48,7 @@ class MockComponentKey2Bool(object): + key = 'key2' + label = 'label bool key2' + description = 'description bool key2' ++ reason = 'Unbearable\nReason\nxxx' + default = False + value = None + +-- +2.35.3 + diff --git a/SOURCES/0005-Necessary-fixes-to-make-linter-happy-again.patch b/SOURCES/0005-Necessary-fixes-to-make-linter-happy-again.patch new file mode 100644 index 0000000..4a22128 --- /dev/null +++ b/SOURCES/0005-Necessary-fixes-to-make-linter-happy-again.patch @@ -0,0 +1,380 @@ +From 0cde014f5cc42f2dfd2e3f6a8b5bb3ab6311bb42 Mon Sep 17 00:00:00 2001 +From: Inessa Vasilevskaya +Date: Fri, 25 Mar 2022 16:08:17 +0100 +Subject: [PATCH 5/9] Necessary fixes to make linter happy again + +Because unit tests in upstream were not enabled for some +time the following technical debt accumulated. +This patch takes care of make lint command only, not the +unit tests. +It also enables linter checks in container tests. + +Related: OAMG-6723 +--- + .pylintrc | 11 ++++++++++- + Makefile | 15 +++++++++++++-- + leapp/actors/__init__.py | 2 +- + leapp/dialogs/dialog.py | 2 +- + leapp/dialogs/renderer.py | 2 +- + leapp/libraries/stdlib/eventloop.py | 2 +- + leapp/models/__init__.py | 4 +++- + leapp/reporting/__init__.py | 2 +- + leapp/repository/__init__.py | 2 +- + leapp/snactor/commands/new_actor.py | 2 +- + leapp/snactor/fixture.py | 2 +- + leapp/snactor/utils.py | 2 ++ + leapp/utils/__init__.py | 4 +++- + leapp/utils/actorapi.py | 2 +- + leapp/utils/audit/contextclone.py | 2 +- + leapp/utils/report.py | 2 +- + res/container-tests/Containerfile.ubi7 | 3 +-- + res/container-tests/Containerfile.ubi8 | 3 +-- + res/container-tests/Containerfile.ubi9 | 3 +-- + tests/scripts/test_reporting.py | 24 ++++++++++++------------ + tests/scripts/test_rerun.py | 2 +- + 21 files changed, 58 insertions(+), 35 deletions(-) + +diff --git a/.pylintrc b/.pylintrc +index d64c53e..f67aa74 100644 +--- a/.pylintrc ++++ b/.pylintrc +@@ -31,18 +31,27 @@ disable= + too-many-locals, + too-many-public-methods, + too-many-statements, ++ print-statement, + # new for python3 version of pylint + useless-object-inheritance, + super-with-arguments, # required in python 2 + raise-missing-from, # no 'raise from' in python 2 ++ consider-using-f-string, # nope, we still have py2 to support ++ redundant-u-string-prefix, # nope, we still have py2 to support ++ exception-message-attribute, # nope, still have py2 to support ++ no-absolute-import, # XXX FIXME nice to have one day ++ unspecified-encoding, # XXX FIXME May be a good thing to have one day though + + [FORMAT] + # Maximum number of characters on a single line. + max-line-length=120 + + [DESIGN] +-max-args=11 # 2x + 1 from default ++max-args=12 # 2x + 2 from default + max-attributes=21 # 4x + 1 from default + + [TYPECHECK] + disable=bad-option-value # unavoidable as the project requires both py2 and py3 ++ ++[IMPORTS] ++known-third-party=leapp +diff --git a/Makefile b/Makefile +index 611d255..7a8f030 100644 +--- a/Makefile ++++ b/Makefile +@@ -139,8 +139,19 @@ test: lint + + lint: + @ $(ENTER_VENV) \ +- pytest --cache-clear --pylint -m pylint leapp tests/scripts/*.py; \ +- pytest --cache-clear --flake8 -m flake8 leapp tests/scripts/*.py ++ LINTABLES="$$(find . -name '*.py' | grep -E -e '^\./leapp\/' -e '^\./tests/scripts/' | sort -u )"; \ ++ echo '==================================================' && \ ++ echo '==================================================' && \ ++ echo '=============== Running pylint ===============' && \ ++ echo '==================================================' && \ ++ echo '==================================================' && \ ++ [[ "$(_PYTHON_VENV)" == "python2.7" ]] && echo "$$LINTABLES" | xargs pylint --py3k || echo "$$LINTABLES" | xargs pylint && echo '===> pylint PASSED' && \ ++ echo '==================================================' && \ ++ echo '==================================================' && \ ++ echo '=============== Running flake8 ===============' && \ ++ echo '==================================================' && \ ++ echo '==================================================' && \ ++ echo "$$LINTABLES" | xargs flake8 && echo '===> flake8 PASSED'; + + fast_lint: + @ $(ENTER_VENV) \ +diff --git a/leapp/actors/__init__.py b/leapp/actors/__init__.py +index c472b84..7ae18ea 100644 +--- a/leapp/actors/__init__.py ++++ b/leapp/actors/__init__.py +@@ -368,7 +368,7 @@ def _is_tuple_of(value_type): + if not value: + raise WrongAttributeTypeError( + 'Actor {} attribute {} should contain at least one item of the type {}'.format(actor, name, value_type)) +- if not all([isinstance(item, value_type) for item in value]): ++ if not all(isinstance(item, value_type) for item in value): + raise WrongAttributeTypeError( + 'Actor {} attribute {} should contain only values of the type {}'.format(actor, name, value_type)) + return value +diff --git a/leapp/dialogs/dialog.py b/leapp/dialogs/dialog.py +index d382ce9..a1d65c7 100644 +--- a/leapp/dialogs/dialog.py ++++ b/leapp/dialogs/dialog.py +@@ -110,7 +110,7 @@ class Dialog(object): + :return: Dictionary with answers once retrieved + """ + store.translate(self) +- if any([component.value is None for component in self.components]): ++ if any(component.value is None for component in self.components): + self._store = store + renderer.render(self) + self._store = None +diff --git a/leapp/dialogs/renderer.py b/leapp/dialogs/renderer.py +index 991be7c..0dd2793 100644 +--- a/leapp/dialogs/renderer.py ++++ b/leapp/dialogs/renderer.py +@@ -253,7 +253,7 @@ class CommandlineRenderer(DialogRendererBase): + default = '' + if component.default is not None: + if component.multi: +- default = ' [{}]'.format(tuple([component.choices.index(x) for x in component.default])) ++ default = ' [{}]'.format(tuple(component.choices.index(x) for x in component.default)) + else: + default = ' [{}]'.format(component.choices.index(component.default)) + if component.multi: +diff --git a/leapp/libraries/stdlib/eventloop.py b/leapp/libraries/stdlib/eventloop.py +index 44bb199..bad3348 100644 +--- a/leapp/libraries/stdlib/eventloop.py ++++ b/leapp/libraries/stdlib/eventloop.py +@@ -47,7 +47,7 @@ class EventLoopKQUEUE(object): + results[fd] |= POLL_IN + elif e.filter == select.KQ_FILTER_WRITE: + results[fd] |= POLL_OUT +- return results.items() ++ return list(results.items()) + + def register(self, fd, mode): + self._fds[fd] = mode +diff --git a/leapp/models/__init__.py b/leapp/models/__init__.py +index 499f3b2..ff5db4b 100644 +--- a/leapp/models/__init__.py ++++ b/leapp/models/__init__.py +@@ -77,6 +77,8 @@ class Model(with_metaclass(ModelMeta)): + Models are defining the data structure of the payload of messages and the + metadata required, such as a name and topic. + """ ++ # NOTE(ivasilev) Until someone comes up with a good hash implementation for Model, let's disable the warning ++ # pylint: disable=eq-without-hash + def __init__(self, init_method='from_initialization', **kwargs): + super(Model, self).__init__() + defined_fields = type(self).fields or {} +@@ -84,7 +86,7 @@ class Model(with_metaclass(ModelMeta)): + if key not in defined_fields: + raise ModelMisuseError( + 'Trying to initialize model {} with value for undefined field {}'.format(type(self).__name__, key)) +- for field in defined_fields: ++ for field in defined_fields: # noqa; pylint: disable=consider-using-dict-items + getattr(defined_fields[field], init_method)(kwargs, field, self) + + topic = None +diff --git a/leapp/reporting/__init__.py b/leapp/reporting/__init__.py +index 61fac32..4c9df38 100644 +--- a/leapp/reporting/__init__.py ++++ b/leapp/reporting/__init__.py +@@ -179,7 +179,7 @@ class Tags(BasePrimitive): + def __init__(self, value=None): + if not isinstance(value, list): + raise TypeError('Value of "Tags" must be a list') +- if not all([isinstance(v, Tags._Value) for v in value]): ++ if not all(isinstance(v, Tags._Value) for v in value): + raise TypeError('Unsupported tag value passed for Report Tags.') + # after the objects validation we need the actual values in the list + self._value = [v.value for v in value] +diff --git a/leapp/repository/__init__.py b/leapp/repository/__init__.py +index a43d691..b47af3e 100644 +--- a/leapp/repository/__init__.py ++++ b/leapp/repository/__init__.py +@@ -209,7 +209,7 @@ class Repository(object): + """ + :return: Tuple of repository relative paths + """ +- return tuple([os.path.relpath(x, self._repo_dir) for x in paths]) ++ return tuple(os.path.relpath(x, self._repo_dir) for x in paths) + + @property + def actors(self): +diff --git a/leapp/snactor/commands/new_actor.py b/leapp/snactor/commands/new_actor.py +index 5151904..bcc5bf1 100644 +--- a/leapp/snactor/commands/new_actor.py ++++ b/leapp/snactor/commands/new_actor.py +@@ -48,7 +48,7 @@ def cli(args): + tag_imports = '' + model_imports = '' + if args.tag: +- tag_imports = '\nfrom leapp.tags import {}'.format(', '.join(tuple([x.split('.')[0] for x in args.tag]))) ++ tag_imports = '\nfrom leapp.tags import {}'.format(', '.join(tuple(x.split('.')[0] for x in args.tag))) + if args.consumes or args.produces: + models = set((args.produces or []) + (args.consumes or [])) + model_imports = '\nfrom leapp.models import {}'.format(', '.join(models)) +diff --git a/leapp/snactor/fixture.py b/leapp/snactor/fixture.py +index a6ad613..1623a27 100644 +--- a/leapp/snactor/fixture.py ++++ b/leapp/snactor/fixture.py +@@ -323,7 +323,7 @@ if hasattr(pytest, 'hookimpl'): + :py:func:`current_actor_context` fixture. If it doesn't use the :py:func:`current_actor_context` fixture, it + will default to the default `pytest_pyfunc_call` implementation. + """ +- if not any([arg in pyfuncitem.funcargs for arg in ('current_actor_context', 'leapp_forked')]): ++ if not any(arg in pyfuncitem.funcargs for arg in ('current_actor_context', 'leapp_forked')): + return None + q = Queue() + p = Process(target=_execute_test, args=(q, pyfuncitem)) +diff --git a/leapp/snactor/utils.py b/leapp/snactor/utils.py +index 28fe112..7e13bd5 100644 +--- a/leapp/snactor/utils.py ++++ b/leapp/snactor/utils.py +@@ -104,6 +104,8 @@ def safe_discover(pivot): + # class SecondOrderModel(FirstOrderModel): + # pass + # ++ # NOTE(ivasilev) L126, disabling here not to get too long a line that will need another disable check comment ++ # pylint: disable=filter-builtin-not-iterating,map-builtin-not-iterating + collected_types = { + 'models': set(['Model']), + 'actors': set(['Actor']), +diff --git a/leapp/utils/__init__.py b/leapp/utils/__init__.py +index 174ec8a..68a5f38 100644 +--- a/leapp/utils/__init__.py ++++ b/leapp/utils/__init__.py +@@ -2,7 +2,9 @@ import subprocess + + + def reboot_system(): +- subprocess.Popen(['/sbin/shutdown', '-r', 'now']) ++ # NOTE(ivasilev) Maybe we could use run? We still can't rely on any code to be finished after workflow calls this ++ # method. ++ subprocess.Popen(['/sbin/shutdown', '-r', 'now']) # noqa; pylint: disable=consider-using-with + + + def get_api_models(actor, what): +diff --git a/leapp/utils/actorapi.py b/leapp/utils/actorapi.py +index 8e4fa6d..2ce1b0e 100644 +--- a/leapp/utils/actorapi.py ++++ b/leapp/utils/actorapi.py +@@ -6,7 +6,7 @@ import requests.adapters + import requests.exceptions + + try: +- import requests.packages.urllib3 as urllib3 ++ import requests.packages.urllib3 as urllib3 # noqa # pylint: disable=consider-using-from-import + except ImportError: + import urllib3 + +diff --git a/leapp/utils/audit/contextclone.py b/leapp/utils/audit/contextclone.py +index 8719b55..2e28b70 100644 +--- a/leapp/utils/audit/contextclone.py ++++ b/leapp/utils/audit/contextclone.py +@@ -15,7 +15,7 @@ def _fetch_table_for_context(db, table, context): + + + def _row_tuple(row, *fields): +- return tuple([row[name] for name in fields or row.keys()]) ++ return tuple(row[name] for name in fields or row.keys()) + + + def _dup_host(db, newcontext, oldcontext): +diff --git a/leapp/utils/report.py b/leapp/utils/report.py +index 5a8f68c..c3ec7d4 100644 +--- a/leapp/utils/report.py ++++ b/leapp/utils/report.py +@@ -91,7 +91,7 @@ def importance(message): + + def generate_report_file(messages_to_report, context, path, report_schema='1.1.0'): + # NOTE(ivasilev) Int conversion should not break as only specific formats of report_schema versions are allowed +- report_schema_tuple = tuple([int(x) for x in report_schema.split('.')]) ++ report_schema_tuple = tuple(int(x) for x in report_schema.split('.')) + if path.endswith(".txt"): + with open(path, 'w') as f: + for message in sorted(messages_to_report, key=importance): +diff --git a/res/container-tests/Containerfile.ubi7 b/res/container-tests/Containerfile.ubi7 +index bc434b9..9e36280 100644 +--- a/res/container-tests/Containerfile.ubi7 ++++ b/res/container-tests/Containerfile.ubi7 +@@ -19,8 +19,7 @@ ENTRYPOINT virtualenv testenv && \ + echo '=============== Running pylint ===============' && \ + echo '==================================================' && \ + echo '==================================================' && \ +- # echo $LINTABLES | xargs pylint --py3k && echo '===> pylint PASSED' && \ +- echo 'TEMPORARILY DISABLED' && \ ++ echo $LINTABLES | xargs pylint --py3k && echo '===> pylint PASSED' && \ + echo '==================================================' && \ + echo '==================================================' && \ + echo '=============== Running flake8 ===============' && \ +diff --git a/res/container-tests/Containerfile.ubi8 b/res/container-tests/Containerfile.ubi8 +index 2b8db2f..03d499d 100644 +--- a/res/container-tests/Containerfile.ubi8 ++++ b/res/container-tests/Containerfile.ubi8 +@@ -22,8 +22,7 @@ ENTRYPOINT virtualenv testenv -p "/usr/bin/$PYTHON_VENV" && \ + echo '=============== Running pylint ===============' && \ + echo '==================================================' && \ + echo '==================================================' && \ +- # echo $LINTABLES | xargs pylint && echo '===> pylint PASSED' && \ +- echo 'TEMPORARILY DISABLED' && \ ++ echo $LINTABLES | xargs pylint && echo '===> pylint PASSED' && \ + echo '==================================================' && \ + echo '==================================================' && \ + echo '=============== Running flake8 ===============' && \ +diff --git a/res/container-tests/Containerfile.ubi9 b/res/container-tests/Containerfile.ubi9 +index 4f31335..359d46b 100644 +--- a/res/container-tests/Containerfile.ubi9 ++++ b/res/container-tests/Containerfile.ubi9 +@@ -20,8 +20,7 @@ ENTRYPOINT virtualenv testenv -p "/usr/bin/$PYTHON_VENV" && \ + echo '=============== Running pylint ===============' && \ + echo '==================================================' && \ + echo '==================================================' && \ +- # echo $LINTABLES | xargs pylint && echo '===> pylint PASSED' && \ +- echo 'TEMPORARILY DISABLED' && \ ++ echo $LINTABLES | xargs pylint && echo '===> pylint PASSED' && \ + echo '==================================================' && \ + echo '==================================================' && \ + echo '=============== Running flake8 ===============' && \ +diff --git a/tests/scripts/test_reporting.py b/tests/scripts/test_reporting.py +index 3f75af6..e2eabf7 100644 +--- a/tests/scripts/test_reporting.py ++++ b/tests/scripts/test_reporting.py +@@ -238,17 +238,17 @@ def test_report_backwards_compatibility(): + report = [msg1] + # make sure normal mode works + for report_format in ['.json', '.txt']: +- reportfile = tempfile.NamedTemporaryFile(suffix=report_format) +- generate_report_file(report, 'leapp-run-id', reportfile.name, '1.1.0') ++ with tempfile.NamedTemporaryFile(suffix=report_format) as reportfile: ++ generate_report_file(report, 'leapp-run-id', reportfile.name, '1.1.0') + # make sure report output conversion to specific version works as well + for report_format in ['.json', '.txt']: +- reportfile = tempfile.NamedTemporaryFile(suffix=report_format) +- generate_report_file(report, 'leapp-run-id', reportfile.name, '1.0.0') +- with open(reportfile.name) as f: +- data = f.read() +- if report_format == '.json': +- a_report = json.loads(data) +- msg = a_report['entries'][0] +- assert 'key' not in msg +- else: +- assert 'Key' not in data ++ with tempfile.NamedTemporaryFile(suffix=report_format) as reportfile: ++ generate_report_file(report, 'leapp-run-id', reportfile.name, '1.0.0') ++ with open(reportfile.name) as f: ++ data = f.read() ++ if report_format == '.json': ++ a_report = json.loads(data) ++ msg = a_report['entries'][0] ++ assert 'key' not in msg ++ else: ++ assert 'Key' not in data +diff --git a/tests/scripts/test_rerun.py b/tests/scripts/test_rerun.py +index 95d4ee6..addcbbb 100644 +--- a/tests/scripts/test_rerun.py ++++ b/tests/scripts/test_rerun.py +@@ -10,7 +10,7 @@ def _evaluate_results(results, *expected): + if PY3: + results = results.decode('utf-8') + expected = set(expected) +- lines = set([line.split()[-1] for line in results.split('\n') if line.startswith('<<>>: ')]) ++ lines = set(line.split()[-1] for line in results.split('\n') if line.startswith('<<>>: ')) + assert lines == expected + + +-- +2.35.3 + diff --git a/SOURCES/0006-DOC-update-the-release-in-the-deprecation-doc.patch b/SOURCES/0006-DOC-update-the-release-in-the-deprecation-doc.patch new file mode 100644 index 0000000..b57b482 --- /dev/null +++ b/SOURCES/0006-DOC-update-the-release-in-the-deprecation-doc.patch @@ -0,0 +1,27 @@ +From 4143ad14e94f44d28c4521db1d736786265e0fe4 Mon Sep 17 00:00:00 2001 +From: Petr Stodulka +Date: Mon, 28 Mar 2022 20:57:19 +0200 +Subject: [PATCH 6/9] DOC: update the release in the deprecation doc + +--- + docs/source/el7toel8/deprecation.md | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/docs/source/el7toel8/deprecation.md b/docs/source/el7toel8/deprecation.md +index da37884..0578b16 100644 +--- a/docs/source/el7toel8/deprecation.md ++++ b/docs/source/el7toel8/deprecation.md +@@ -12,6 +12,10 @@ framework, see [List of deprecated functionality in leapp](../deprecation.html#l + + ## current upstream development (till the next release + 6months) + ++- nothing yet... ++ ++## v0.16.0 (till September 2022) ++ + - Shared libraries + - **`leapp.libraries.common.utils.apply_yum_workaround`** - The `apply_yum_workaround` function has been deprecated, use `DNFWorkaround` message as used in the successing `RegisterYumAdjustment` actor. + +-- +2.35.3 + diff --git a/SOURCES/0007-Pass-enable-root-auth-post-install-script.patch b/SOURCES/0007-Pass-enable-root-auth-post-install-script.patch new file mode 100644 index 0000000..bed31e8 --- /dev/null +++ b/SOURCES/0007-Pass-enable-root-auth-post-install-script.patch @@ -0,0 +1,50 @@ +From c1ee7801dc64dcdc6906e2feac73cc2a334e743c Mon Sep 17 00:00:00 2001 +From: Inessa Vasilevskaya +Date: Thu, 28 Apr 2022 14:32:45 +0200 +Subject: [PATCH 7/9] Pass enable root auth post-install-script + +This should allow root auth on every guest, even those that +don't have it enabled by default. +This patch also pins tft github action to 1.2.10. + +OAMG-6748 +--- + .github/workflows/tmt-tests.yml | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/.github/workflows/tmt-tests.yml b/.github/workflows/tmt-tests.yml +index 4bfb191..48da704 100644 +--- a/.github/workflows/tmt-tests.yml ++++ b/.github/workflows/tmt-tests.yml +@@ -151,7 +151,7 @@ jobs: + id: run_test_7to8 + env: + ARTIFACTS: ${{ format('{0};{1}', steps.leapp_repository_pr_regex_match.outputs.match != '' && steps.copr_build_leapp_repository.outputs.copr_id || steps.get_latest_lpr_copr_build_id.outputs.copr_id, steps.copr_build.outputs.copr_id) }} +- uses: sclorg/testing-farm-as-github-action@v1.2.9 ++ uses: sclorg/testing-farm-as-github-action@v1.2.10 + with: + # required + api_url: ${{ secrets.TF_ENDPOINT }} +@@ -173,12 +173,13 @@ jobs: + # preparation moved out to a different workflow and the rest split into 2 workflows - 7to8 and 8to9 that are + # triggered on a specific repository dispatch event. + update_pull_request_status: 'false' ++ environment_settings: '{"provisioning": {"post_install_script": "#!/bin/sh\nsudo sed -i s/.*ssh-rsa/ssh-rsa/ /root/.ssh/authorized_keys"}}' + + - name: Schedule regression testing for 8to9 + id: run_test_8to9 + env: + ARTIFACTS: ${{ format('{0};{1}', steps.leapp_repository_pr_regex_match.outputs.match != '' && steps.copr_build_leapp_repository.outputs.copr_id || steps.get_latest_lpr_copr_build_id.outputs.copr_id, steps.copr_build.outputs.copr_id) }} +- uses: sclorg/testing-farm-as-github-action@v1.2.9 ++ uses: sclorg/testing-farm-as-github-action@v1.2.10 + with: + # required + api_url: ${{ secrets.TF_ENDPOINT }} +@@ -201,3 +202,4 @@ jobs: + # preparation moved out to a different workflow and the rest split into 2 workflows - 7to8 and 8to9 that are + # triggered on a specific repository dispatch event. + update_pull_request_status: 'false' ++ environment_settings: '{"provisioning": {"post_install_script": "#!/bin/sh\nsudo sed -i s/.*ssh-rsa/ssh-rsa/ /root/.ssh/authorized_keys"}}' +-- +2.35.3 + diff --git a/SOURCES/0008-Fix-krb5-config-not-found-error.patch b/SOURCES/0008-Fix-krb5-config-not-found-error.patch new file mode 100644 index 0000000..fd5bdbc --- /dev/null +++ b/SOURCES/0008-Fix-krb5-config-not-found-error.patch @@ -0,0 +1,28 @@ +From 835a3d27b52fe44cbca6ed5307e6801981df24d8 Mon Sep 17 00:00:00 2001 +From: Inessa Vasilevskaya +Date: Thu, 28 Apr 2022 14:49:59 +0200 +Subject: [PATCH 8/9] Fix krb5-config not found error + +copr-cli installation started failing on missing this dependency. +--- + .github/workflows/tmt-tests.yml | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/.github/workflows/tmt-tests.yml b/.github/workflows/tmt-tests.yml +index 48da704..caa97cf 100644 +--- a/.github/workflows/tmt-tests.yml ++++ b/.github/workflows/tmt-tests.yml +@@ -15,6 +15,10 @@ jobs: + && contains(fromJson('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association) + runs-on: ubuntu-20.04 + steps: ++ - name: Install necessary deps ++ id: deps_install ++ run: sudo apt-get install -y libkrb5-dev ++ + - name: Get dependent leapp-repository pr number from rerun comment + uses: actions-ecosystem/action-regex-match@v2 + id: leapp_repository_pr_regex_match +-- +2.35.3 + diff --git a/SOURCES/0009-Add-root-privileges-check-at-the-leapp-start.patch b/SOURCES/0009-Add-root-privileges-check-at-the-leapp-start.patch new file mode 100644 index 0000000..6639ff7 --- /dev/null +++ b/SOURCES/0009-Add-root-privileges-check-at-the-leapp-start.patch @@ -0,0 +1,36 @@ +From f64c64e433ec0f823b1d89051421c427280a0036 Mon Sep 17 00:00:00 2001 +From: PeterMocary +Date: Mon, 23 May 2022 11:10:04 +0200 +Subject: [PATCH 9/9] Add root privileges check at the leapp start + +--- + leapp/cli/__init__.py | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/leapp/cli/__init__.py b/leapp/cli/__init__.py +index 8c44cd4..2ffa4c7 100644 +--- a/leapp/cli/__init__.py ++++ b/leapp/cli/__init__.py +@@ -2,6 +2,7 @@ + import os + import pkgutil + import socket ++import sys + + from leapp import VERSION + from leapp.cli import commands +@@ -32,6 +33,11 @@ def main(): + """ + leapp entry point + """ ++ ++ if os.getuid() != 0: ++ sys.stderr.write('Leapp has to be executed with root privileges.\n') ++ sys.exit(1) ++ + os.environ['LEAPP_HOSTNAME'] = socket.getfqdn() + _load_commands(cli.command) + cli.command.execute('leapp version {}'.format(VERSION)) +-- +2.35.3 + diff --git a/SPECS/leapp.spec b/SPECS/leapp.spec index 056c92f..b709af0 100644 --- a/SPECS/leapp.spec +++ b/SPECS/leapp.spec @@ -37,7 +37,7 @@ Name: leapp Version: 0.14.0 -Release: 1%{?dist} +Release: 3%{?dist} Summary: OS & Application modernization framework License: ASL 2.0 @@ -63,8 +63,17 @@ Requires: %{leapp_python_name}-%{name} = %{version}-%{release} Requires: leapp-repository %endif # !fedora -# PATHES HERE +# PATCHES HERE # Patch0001: filename.patch +Patch0001: 0001-Update-welcome-message-767.patch +Patch0002: 0002-Switch-to-the-official-composite-action-for-tft.patch +Patch0003: 0003-Use-v1.2.9-version-of-github-action.patch +Patch0004: 0004-testing-Start-using-GH-Actions-for-unit-tests-719.patch +Patch0005: 0005-Necessary-fixes-to-make-linter-happy-again.patch +Patch0006: 0006-DOC-update-the-release-in-the-deprecation-doc.patch +Patch0007: 0007-Pass-enable-root-auth-post-install-script.patch +Patch0008: 0008-Fix-krb5-config-not-found-error.patch +Patch0009: 0009-Add-root-privileges-check-at-the-leapp-start.patch %description @@ -160,6 +169,15 @@ Requires: findutils # APPLY REGISTERED PATCHES HERE # %%patch0001 -p1 +%patch0001 -p1 +%patch0002 -p1 +%patch0003 -p1 +%patch0004 -p1 +%patch0005 -p1 +%patch0006 -p1 +%patch0007 -p1 +%patch0008 -p1 +%patch0009 -p1 ################################################## @@ -243,6 +261,10 @@ install -m 0644 -p man/leapp.1 %{buildroot}%{_mandir}/man1/ # no files here %changelog +* Fri May 27 2022 Petr Stodulka - 0.14.0-3 +- CTC1 build +- Resolves: rhbz#2090992 + * Mon Mar 14 2022 Petr Stodulka - 0.14.0-1 - Rebase to v0.14.0 - Bump leapp-framework to 2.2