eduNEXT / tutor-contrib-edunext-distro

A tool to facilitate the customization of an Openedx instance, adding commands and settings to have an easy-to-use and a ready-to-deploy in local or in development openedx distribution.
2 stars 1 forks source link

Lfc/add repo validator command ds 535 #48

Closed luisfelipec95 closed 1 year ago

luisfelipec95 commented 1 year ago

Description

This PR adds the command that checks that the git repositories in config.yml are valid: tutor distro repository-validator

How to test

OPENEDX_EXTRA_PIP_REQUIREMENTS:
- eox-core[sentry,tpa]==v7.2.3
- openedx-scorm-xblock==14.0.0
- flow-control-xblock==1.0.1
- ubcpi-xblock==1.0.0
- git+https://github.com/eduNEXT/edx_xblock_scorm@v2.0.0#egg=scormxblock-xblock==2.0.0
- git+https://github.com/openedx/schoolyourself-xblock.git
- git+https://github.com/openedx/xblock-free-text-response.git
- git+https://github.com/openedx/xblock-image-explorer.git
- git+https://github.com/openedx/xblock-image-modal.git
- git+https://github.com/openedx/xblock-in-video-quiz.git
- git+https://github.com/Annoto/xblock-in-video-collaboration@v0.3.3#egg=annoto-xblock
- git+https://github.com/open-craft/xblock-activetable@v0.3#egg=activetable-xblock
- git+https://github.com/TinMarkovic/ChartsXBlock.git
- git+https://github.com/open-craft/problem-builder@v5.1.0#egg=xblock-problem-builder
- git+https://github.com/open-craft/xblock-vectordraw@v0.4#egg=vectordraw-xblock
- git+https://github.com/eduNEXT/webhook-xblock.git
- git+https://github.com/Pearson-Advance/openedx-surveymonkey-xblock@v2.0.2#egg=surveymonkey-xblock
- git+https://github.com/appsembler/pdfXBlock@f6219ce8200f55728d1b315fb8a6ea7ade06ad04#egg=pdf-xblock
- git+https://github.com/openedx/xblock-submit-and-compare
- git+https://github.com/openedx/DoneXBlock@2.0.1#egg=done-xblock
DISTRO_EOX_HOOKS_DPKG:
  index: git
  name: eox-hooks
  repo: eox-hooks
  domain: github.com
  path: eduNEXT
  protocol: https
  private: false
  variables:
    development: {}
    production: {}
  version: master

Run command: tutor distro repository-validator

MaferMazu commented 1 year ago

Thanks for this, @luisfelipec95. Remember to add end lines in files. You can see in what files here https://github.com/eduNEXT/tutor-contrib-edunext-distro/pull/48/files (with the red symbol)

By the way, you need to add tests for this; you can guide with https://github.com/eduNEXT/tutor-contrib-edunext-distro/tree/master/tests/distro/themes, but for merging this, I think is important to merge the ci for tests first #47, if not have the steps to run the test locally.

On the other hand, as @JuanDavidBuitrago said, we need to update the documentation and add this feature in the readme.

By the way, if you have questions, don't hesitate to ask.

luisfelipec95 commented 1 year ago

Thanks @MaferMazu. Changes made

JuanDavidBuitrago commented 1 year ago

Hi @luisfelipec95

Please make a rebase over jdb/add_pipelines branch and solve the issues. This allows you to run the quality tests.

MaferMazu commented 1 year ago

Hello @luisfelipec95, you still need to add the end line in tests/distro/repository_validator/infrastructure/in_memory_package_repository.py and tutordistro/commands/repository_validator.py I have a question, why are we changing the "package" directory for a "share" one?

luisfelipec95 commented 1 year ago

Hello @luisfelipec95, you still need to add the end line in tests/distro/repository_validator/infrastructure/in_memory_package_repository.py and tutordistro/commands/repository_validator.py I have a question, why are we changing the "package" directory for a "share" one?

Because some package functionalities are also used by repository_validator

JuanDavidBuitrago commented 1 year ago

Hi @luisfelipec95, can you rebase against master branch? Please

luisfelipec95 commented 1 year ago

Hi @luisfelipec95, can you rebase against master branch? Please

Done

luisfelipec95 commented 1 year ago

Hi @luisfelipec95, can you rebase against master branch? Please

Done

I had a problem when I try to test it. To reproduce:

1. Make a Tutor environment with v15.3.3

2. Run `git clone https://github.com/eduNEXT/tutor-contrib-edunext-distro.git`

3. Run `git checkout lfc/add-repo-validator-command-DS-535`

4. Install distro plugin `pip install tutor-contrib-edunext-distro`

5. Run `tutor plugins enable distro`

6. Find the error
[v15.3.3@distro-felipe-test] juan@juan-X712JA ~/Environment/distro-felipe-test $ tutor plugins enable distro 
Error applying action 'plugins:loaded:distro': func=<function discover_package.<locals>.load at 0x7ff2ad485510> contexts=['plugins']'
⚠️  Failed to enable plugin 'distro': No module named 'tutordistro.utils'
Error applying action 'plugins:loaded:distro': func=<function discover_package.<locals>.load at 0x7ff2ad485510> contexts=['plugins']'
Traceback (most recent call last):
  File "/home/juan/.local/bin/tutor", line 33, in <module>
    sys.exit(load_entry_point('tutor', 'console_scripts', 'tutor')())
  File "/home/juan/.tvm/v15.3.3@distro-felipe-test/overhangio-tutor-679fe5f/tutor/commands/cli.py", line 26, in main
    cli()  # pylint: disable=no-value-for-parameter
  File "/home/juan/.local/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/home/juan/.local/lib/python3.10/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/home/juan/.local/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/juan/.local/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/juan/.local/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/juan/.local/lib/python3.10/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/home/juan/.local/lib/python3.10/site-packages/click/decorators.py", line 38, in new_func
    return f(get_current_context().obj, *args, **kwargs)
  File "/home/juan/.tvm/v15.3.3@distro-felipe-test/overhangio-tutor-679fe5f/tutor/commands/plugins.py", line 140, in enable
    plugins.load(plugin)
  File "/home/juan/.tvm/v15.3.3@distro-felipe-test/overhangio-tutor-679fe5f/tutor/plugins/__init__.py", line 93, in load
    hooks.Actions.PLUGIN_LOADED(name).do()
  File "/home/juan/.tvm/v15.3.3@distro-felipe-test/overhangio-tutor-679fe5f/tutor/core/hooks/actions.py", line 122, in do
    self.do_from_context(None, *args, **kwargs)
  File "/home/juan/.tvm/v15.3.3@distro-felipe-test/overhangio-tutor-679fe5f/tutor/core/hooks/actions.py", line 141, in do_from_context
    callback.do(
  File "/home/juan/.tvm/v15.3.3@distro-felipe-test/overhangio-tutor-679fe5f/tutor/core/hooks/actions.py", line 35, in do
    self.func(*args, **kwargs)
  File "/home/juan/.tvm/v15.3.3@distro-felipe-test/overhangio-tutor-679fe5f/tutor/plugins/v1.py", line 77, in load
    entrypoint.load()
  File "/home/juan/.local/lib/python3.10/site-packages/pkg_resources/__init__.py", line 2517, in load
    return self.resolve()
  File "/home/juan/.local/lib/python3.10/site-packages/pkg_resources/__init__.py", line 2523, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/home/juan/.local/lib/python3.10/site-packages/tutordistro/plugin.py", line 11, in <module>
    from tutordistro.commands.cli import distro
  File "/home/juan/.local/lib/python3.10/site-packages/tutordistro/commands/cli.py", line 7, in <module>
    from tutordistro.commands.enable_private_packages import enable_private_packages
  File "/home/juan/.local/lib/python3.10/site-packages/tutordistro/commands/enable_private_packages.py", line 13, in <module>
    from tutordistro.utils.packages import get_private_distro_packages
ModuleNotFoundError: No module named 'tutordistro.utils'

@luisfelipec95, can you reproduce this in a new environment and let me know if you find the same problem?

problem solved, thanks