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

modules: find module with TT_CLI_MODULES_PATH #1036

Merged
merged 1 commit into from
Dec 12, 2024

Conversation

dmyger
Copy link
Collaborator

@dmyger dmyger commented Nov 26, 2024

Closes #1013

@TarantoolBot document
Title: Use environment variable to find modules.

The TT_CLI_MODULES_PATH environment variable specifies a list of
module's paths separated by a colon “:”.
It can be set externally from tt and must contain a list of
folders where modules are located.
The logic of working with this variable is similar to the PATH
system variable.

Lists of modules are combined into one common list:

  • The modules declared in the configuration file tt.yaml come first
  • then the modules defined via the environment variable are added.
    Any duplicates must be removed, while maintaining the original
    order of module declarations.

Usage example
Set variable:

export TT_CLI_MODULES_PATH=/ext/path/modules:${TT_CLI_MODULES_PATH}

@dmyger dmyger requested a review from oleg-jukovec November 26, 2024 16:58
@dmyger dmyger changed the title Dmyger/gh-1013-tt_cli_modules_path-env modules: find module with TT_CLI_MODULES_PATH Nov 26, 2024
@dmyger dmyger force-pushed the dmyger/gh-1012-tt.yaml-list-modules-directories branch from 7c49c4d to f083b8d Compare November 26, 2024 17:04
@dmyger dmyger force-pushed the dmyger/gh-1013-tt_cli_modules_path-env branch 3 times, most recently from 75a1aec to f1140af Compare November 27, 2024 13:30
@dmyger dmyger force-pushed the dmyger/gh-1012-tt.yaml-list-modules-directories branch from f083b8d to 0e6bfb6 Compare November 27, 2024 13:32
@dmyger dmyger force-pushed the dmyger/gh-1013-tt_cli_modules_path-env branch 2 times, most recently from b36ea67 to ca819e3 Compare November 27, 2024 14:47
@dmyger dmyger force-pushed the dmyger/gh-1012-tt.yaml-list-modules-directories branch from 0e6bfb6 to 1b8ed5e Compare November 28, 2024 11:43
@dmyger dmyger force-pushed the dmyger/gh-1013-tt_cli_modules_path-env branch from ca819e3 to 7db5343 Compare November 28, 2024 11:44
@dmyger dmyger requested a review from oleg-jukovec November 28, 2024 11:48
Copy link
Contributor

@oleg-jukovec oleg-jukovec left a comment

Choose a reason for hiding this comment

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

Please, add a description to the commit messages, see:

#1030
tarantool/doc#4661

It will help to notify a doc team about changes.

@dmyger dmyger force-pushed the dmyger/gh-1012-tt.yaml-list-modules-directories branch from 1b8ed5e to ff7da90 Compare November 28, 2024 13:45
@dmyger dmyger force-pushed the dmyger/gh-1013-tt_cli_modules_path-env branch from 7db5343 to 32f96aa Compare November 28, 2024 13:51
@dmyger dmyger requested a review from oleg-jukovec November 28, 2024 13:53
@dmyger dmyger requested a review from oleg-jukovec November 28, 2024 13:58
@dmyger dmyger force-pushed the dmyger/gh-1013-tt_cli_modules_path-env branch from 32f96aa to b8a7313 Compare November 28, 2024 13:58
@dmyger dmyger force-pushed the dmyger/gh-1012-tt.yaml-list-modules-directories branch from ff7da90 to 465cc24 Compare November 28, 2024 14:03
Copy link
Contributor

@oleg-jukovec oleg-jukovec left a comment

Choose a reason for hiding this comment

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

We can't break backward compatibility. So old tests should work.

Base automatically changed from dmyger/gh-1012-tt.yaml-list-modules-directories to master November 28, 2024 14:27
@dmyger dmyger requested a review from oleg-jukovec November 28, 2024 14:29
@dmyger dmyger force-pushed the dmyger/gh-1013-tt_cli_modules_path-env branch 2 times, most recently from 2378be6 to 7d17211 Compare December 2, 2024 15:53
@dmyger dmyger force-pushed the dmyger/gh-1013-tt_cli_modules_path-env branch from 7d17211 to 288d595 Compare December 6, 2024 06:33
@dmyger dmyger changed the base branch from master to dmyger/gh-1012-tt.yaml-list-modules-directories December 6, 2024 06:35
@dmyger dmyger force-pushed the dmyger/gh-1013-tt_cli_modules_path-env branch from 288d595 to 95a94bb Compare December 6, 2024 07:32
@dmyger dmyger force-pushed the dmyger/gh-1012-tt.yaml-list-modules-directories branch 2 times, most recently from 71fc957 to 8d60a6a Compare December 6, 2024 11:25
@dmyger dmyger force-pushed the dmyger/gh-1013-tt_cli_modules_path-env branch from 95a94bb to db292f8 Compare December 6, 2024 11:28
Base automatically changed from dmyger/gh-1012-tt.yaml-list-modules-directories to master December 9, 2024 09:38
Closes #1013

@TarantoolBot document
Title: Use environment variable to find modules.

The TT_CLI_MODULES_PATH environment variable specifies a list of
module's paths separated by a colon “:”.
It can be set externally from tt and must contain a list of
folders where modules are located.
The logic of working with this variable is similar to the PATH
system variable.

Lists of modules are combined into one common list:

- The modules declared in the configuration file tt.yaml come first
- then the modules defined via the environment variable are added.
Any duplicates must be removed, while maintaining the original
order of module declarations.

**Usage example**
Set variable:
```sh
export TT_CLI_MODULES_PATH=/ext/path/modules:${TT_CLI_MODULES_PATH}
```
@dmyger dmyger force-pushed the dmyger/gh-1013-tt_cli_modules_path-env branch from db292f8 to 934c56e Compare December 9, 2024 09:41
Copy link
Contributor

@oleg-jukovec oleg-jukovec left a comment

Choose a reason for hiding this comment

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

I think we could add an integration test that a module could be found in a path passed with the variable, not just in "modules". Could we?

@dmyger
Copy link
Collaborator Author

dmyger commented Dec 10, 2024

I think we could add an integration test

Yes, integration tests will need to be added. But they won't work at the current stage, as there is nothing to run to test yet. There is a task assigned to the tests #1039.

@dmyger dmyger requested a review from oleg-jukovec December 10, 2024 20:10
@oleg-jukovec
Copy link
Contributor

I think we could add an integration test

Yes, integration tests will need to be added. But they won't work at the current stage, as there is nothing to run to test yet. There is a task assigned to the tests #1039.

Why not? In theory, the directory should add a module path, so we could add a test in which modules (in the current implementation) will be located at the path. Or am I missed something?

@dmyger
Copy link
Collaborator Author

dmyger commented Dec 11, 2024

Or am I missed something?

Creating an integration test requires that there should be a difference in external behaviour in the operation of the utility, and this has not yet been implemented.

Unit testing, in theory, allows for such verification. But we don't test implementation of private methods, while public methods don't have implementation until #1014 will be done.

@oleg-jukovec oleg-jukovec merged commit 877f3af into master Dec 12, 2024
19 checks passed
@oleg-jukovec oleg-jukovec deleted the dmyger/gh-1013-tt_cli_modules_path-env branch December 12, 2024 10:07
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.

modules: add support find module with TT_CLI_MODULES_PATH variable
3 participants