pulp / oci_env

9 stars 33 forks source link

Install test requirements on startup #115

Closed lubosmj closed 1 year ago

lubosmj commented 1 year ago

closes #56

lubosmj commented 1 year ago

It works for me locally. I am not sure why the checks are red.

lubosmj commented 1 year ago

I can also make this feature optional. Would it be more favourable to do so?

lubosmj commented 1 year ago

@decko, @newswangerd, are we going to merge this PR? It installs all test requirements on boot-up, which could slow the instantiation a bit (not a dealbreaker for me). I find it still useful because we can just run oci-env generate-client -i and then run tests as needed without more calls. If not, feel free to close this PR and its corresponding issue.

lubosmj commented 1 year ago

Now, the installation is optional. A user can decide whether she wants to install the test requirements or not via the compose file where other settings like "DEV_SOURCE_PATH" are defined.

lubosmj commented 1 year ago

I really cannot make this PR to pass through the CI checks. This is the error I am experiencing:

2023-08-15 16:29:40,395 - INFO - utils.py:450 - Running [non-interactive] command in container: docker exec oci_env_pulp_1 bash /opt/oci_env/base/container_scripts/install_client.sh pulpcore
Obtaining file:///src/pulp-openapi-generator/pulpcore-client
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'error'
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [27 lines of output]
      Traceback (most recent call last):
        File "/usr/local/lib/python3.8/site-packages/setuptools/_normalization.py", line 59, in safe_version
          return str(packaging.version.Version(v))
        File "/usr/local/lib/python3.8/site-packages/setuptools/_vendor/packaging/version.py", line 198, in __init__
          raise InvalidVersion(f"Invalid version: '{version}'")
      setuptools.extern.packaging.version.InvalidVersion: Invalid version: ''

      During handling of the above exception, another exception occurred:

      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/src/pulp-openapi-generator/pulpcore-client/setup.py", line 26, in <module>
          setup(
        File "/usr/local/lib/python3.8/site-packages/setuptools/__init__.py", line 107, in setup
          return distutils.core.setup(**attrs)
        File "/usr/local/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 147, in setup
          _setup_distribution = dist = klass(attrs)
        File "/usr/local/lib/python3.8/site-packages/setuptools/dist.py", line 481, in __init__
          self.patch_missing_pkg_info(attrs)
        File "/usr/local/lib/python3.8/site-packages/setuptools/dist.py", line 470, in patch_missing_pkg_info
          dist._version = _normalization.safe_version(str(attrs['version']))
        File "/usr/local/lib/python3.8/site-packages/setuptools/_normalization.py", line 62, in safe_version
          return str(packaging.version.Version(attempt))
        File "/usr/local/lib/python3.8/site-packages/setuptools/_vendor/packaging/version.py", line 198, in __init__
          raise InvalidVersion(f"Invalid version: '{version}'")
      setuptools.extern.packaging.version.InvalidVersion: Invalid version: ''
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
Running local command: bash /home/runner/work/oci_env/oci_env/oci_env/base/local_scripts/generate_client.sh pulpcore python

This error is raised when I place the "install_test_deps" inside the init_container function in base/utils.sh. Initially, the python script for installing test requirements was placed inside base/init.sh. However, the tests could not be successfully installed because of the missing DEV_SOURCE_PATH environment variable.

If there is no way to resolve this issue, I would rather eliminate the requirement for testing the automatic installation in the CI. Everything works locally for me.

lubosmj commented 1 year ago

Closing because of the unresolved failures that root in lack of knowledge around the CI.