Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rpm: add python3-hirte package #351

Merged
merged 2 commits into from Jun 27, 2023
Merged

rpm: add python3-hirte package #351

merged 2 commits into from Jun 27, 2023

Conversation

dougsland
Copy link
Contributor

No description provided.

@dougsland
Copy link
Contributor Author

dougsland commented Jun 19, 2023

Building the rpm:

# make rpm

SNIP
Wrote: rpmbuild/noarch/python3-hirte-0.4.0-0.202306190529.gite9f6cb0.el9.noarch.rpm
SNIP
# rpm -ql artifacts/rpms/06-19-2023/python3-hirte-0.4.0-0.202306190529.gite9f6cb0.el9.noarch.rpm
/usr/lib/python3.9/site-packages/hirte/__init__.py
/usr/lib/python3.9/site-packages/hirte/__pycache__/__init__.cpython-39.opt-1.pyc
/usr/lib/python3.9/site-packages/hirte/__pycache__/__init__.cpython-39.pyc
/usr/lib/python3.9/site-packages/hirte/__pycache__/config.cpython-39.opt-1.pyc
/usr/lib/python3.9/site-packages/hirte/__pycache__/config.cpython-39.pyc
/usr/lib/python3.9/site-packages/hirte/config.py
/usr/share/licenses/python3-hirte
/usr/share/licenses/python3-hirte/LICENSE

Before installing the module:

>>> from hirte import Hirte
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name 'Hirte' from 'hirte' (unknown location)

Now installing the module via package:

# rpm -ivh artifacts/rpms/06-19-2023/python3-hirte-0.4.0-0.202306190529.gite9f6cb0.el9.noarch.rpm
Verifying...                          ################################# [100%]
Preparing...                          ################################# [100%]
Updating / installing...
   1:python3-hirte-0.4.0-0.20230619052################################# [100%]


# python
Python 3.9.16 (main, Mar  7 2023, 00:00:00)
[GCC 11.3.1 20221121 (Red Hat 11.3.1-4)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from hirte import Hirte
>>>
>>> hirte = Hirte()
>>> hirte.ListAllNodes()
Node: control, State: online
Node: node1, State: online
Node: qm-node1, State: online

Copy link
Member

@engelmi engelmi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understood the PyPi parity correctly, we need to publish to pypi first, right? In that case adding this (or at least creating the package on pypi) should be an immediate follow-up, I think, to avoid trouble.

hirte.spec.in Show resolved Hide resolved
hirte.spec.in Show resolved Hide resolved
hirte.spec.in Outdated Show resolved Hide resolved
Copy link
Member

@mwperina mwperina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if we should include python module into hirte spec file, wouldn't it be better to have it in a separate spec file? If not, then I think we should try to separate it, so we can skip building python subpackage if needed

hirte.spec.in Outdated Show resolved Hide resolved
hirte.spec.in Show resolved Hide resolved
hirte.spec.in Show resolved Hide resolved
@rhatdan
Copy link
Contributor

rhatdan commented Jun 23, 2023

@dougsland I think you have one outstanding fix for this so that it can be merged.

Signed-off-by: Douglas Schilling Landgraf <dougsland@redhat.com>
@dougsland
Copy link
Contributor Author

If I understood the PyPi parity
correctly, we need to publish to pypi first, right? In that case adding this (or at least creating the package on pypi) should
be an immediate follow-up, I think, to avoid trouble.

Which account we create and publish it in PyPi?

Also there is a github actions for publishing new releases:
https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/

@dougsland
Copy link
Contributor Author

Error not related to the patch:

     out: ==================================== ERRORS ====================================
19:58:09                 out: ______________ ERROR collecting test_hirte_agent_resolve_fqdn.py _______________
19:58:09                 out: ImportError while importing test module '/var/tmp/tmt/run-001/plans/tier0/discover/default-0/tests/tests/tier0/hirte-agent-resolve-fqdn/test_hirte_agent_resolve_fqdn.py'.
19:58:09                 out: Hint: make sure your test modules/packages have valid Python names.
19:58:09                 out: Traceback:
19:58:09                 out: /opt/hostedtoolcache/Python/3.10.12/x64/lib/python3.10/site-packages/_pytest/python.py:617: in _importtestmodule
19:58:09                 out:     mod = import_path(self.path, mode=importmode, root=self.config.rootpath)
19:58:09                 out: /opt/hostedtoolcache/Python/3.10.12/x64/lib/python3.10/site-packages/_pytest/pathlib.py:565: in import_path
19:58:09                 out:     importlib.import_module(module_name)
19:58:09                 out: /opt/hostedtoolcache/Python/3.10.12/x64/lib/python3.10/importlib/__init__.py:126: in import_module
19:58:09                 out:     return _bootstrap._gcd_import(name[level:], package, level)
19:58:09                 out: <frozen importlib._bootstrap>:1050: in _gcd_import
19:58:09                 out:     ???
19:58:09                 out: <frozen importlib._bootstrap>:1027: in _find_and_load
19:58:09                 out:     ???
19:58:09                 out: <frozen importlib._bootstrap>:1006: in _find_and_load_unlocked
19:58:09                 out:     ???
19:58:09                 out: <frozen importlib._bootstrap>:688: in _load_unlocked
19:58:09                 out:     ???
19:58:09                 out: /opt/hostedtoolcache/Python/3.10.12/x64/lib/python3.10/site-packages/_pytest/assertion/rewrite.py:178: in exec_module
19:58:09                 out:     exec(co, module.__dict__)
19:58:09                 out: test_hirte_agent_resolve_fqdn.py:6: in <module>
19:58:09                 out:     from hirte_test.fixtures import get_primary_ip
19:58:09                 out: E   ModuleNotFoundError: No module named 'hirte_test'
19:58:09                 out: =========================== short test summary info ============================
19:58:09                 out: ERROR test_hirte_agent_resolve_fqdn.py
19:58:09                 out: !!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!
19:58:09                 out: =============================== 1 error in 0.16s ===============================

@dougsland
Copy link
Contributor Author

@dougsland I think you have one outstanding fix for this so that it can be merged.

okay, replied to all questions and points.

@Yarboa
Copy link
Contributor

Yarboa commented Jun 25, 2023

19:58:09 out: from hirte_test.fixtures import get_primary_ip

Yes it seems that build -eCONTAINER_USED=integration-test-local has an issue

@dougsland I think you have one outstanding fix for this so that it can be merged.

okay, replied to all questions and points.

There is a problem with this container file
integration-test-snapshot
The build is failing here
podman build -f ./containers/integration-test-snapshit -t hirte-image .

It seems that this one was merged broken
https://github.com/containers/hirte/actions/runs/5357145415/jobs/9717634638

There is an issue with createrepo_c $ARTIFACTS_DIR
It is always goes to hirte/artifacts/... and not to downloaded test directory

@engelmi
Copy link
Member

engelmi commented Jun 26, 2023

It seems that this one was merged broken
https://github.com/containers/hirte/actions/runs/5357145415/jobs/9717634638

That is the run after the PR has been merged - we run the pipeline on pushes to main, too - for the PR it was passing.

As far as I can tell, there is no error with the containers (this time). In the pipeline tmt is run with

tmt run -eCONTAINER_USED=integration-test-local

The build looks fine. It fails when running pytest (before any containers are started) and for some reason the hirte_test module can't be found - so all tests fail due to a ModuleNotFoundError of hirte_test, e.g. for this PR action:
https://github.com/containers/hirte/actions/runs/5360021835/jobs/9741652709?pr=351#step:8:1871
No idea why this is suddenly failing, though. I can't reproduce this issue locally. Needs more investigation.

@dougsland As you wrote, this is unrelated to this PR. Please ignore the test failure for now.

@Yarboa
Copy link
Contributor

Yarboa commented Jun 26, 2023

@engelmi
All the tests are failing by tmt since prepare step completed with an error
If you run tmt local you will see that the copy of hirte-rpm is a problem here.

some how the repodata does not exist, although logs show it is downloaded.

@engelmi
Copy link
Member

engelmi commented Jun 26, 2023

@engelmi All the tests are failing by tmt since prepare step completed with an error If you run tmt local you will see that the copy of hirte-rpm is a problem here.

some how the repodata does not exist, although logs show it is downloaded.

On friday pytest released 7.4.0 which changed how the rootdir is set/determined in pytest-dev/pytest#11043. So pytest starts from the "wrong" directory - the individual test directory - and can't find the hirte_test module. For example

# here the resolved rootdir from pytest is one of the test dirs - can't find hirte_test
rootdir: /var/tmp/tmt/run-074/plans/tier0/discover/default-0/tests/tests/tier0/hirte-agent-resolve-fqdn

# when setting confcutdir:
# here the resolved rootdir from pytest is the tests/ as before - works
rootdir: /var/tmp/tmt/run-075/plans/tier0/discover/default-0/tests

@ygalblum found the solution for this and created #370 to fix this.

@dougsland Could you please reabse? Then it should work now again :)

@dougsland
Copy link
Contributor Author

I'm not sure if we should include python module into hirte spec file, wouldn't it be better to have it in a separate spec file? If not, then I think we should try to separate it, so we can skip building python subpackage if needed

Sure, it's possible to skip downstream.

@dougsland
Copy link
Contributor Author

@Yarboa @engelmi thanks for the help, all tests passed.

@rhatdan
Copy link
Contributor

rhatdan commented Jun 26, 2023

LGTM

@Yarboa
Copy link
Contributor

Yarboa commented Jun 27, 2023

LGTM

Copy link
Member

@engelmi engelmi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@engelmi engelmi merged commit 57faf67 into eclipse-bluechi:main Jun 27, 2023
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants