+
Skip to content

Validation of meta.yaml in cross-org repos #3680

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

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from

Conversation

muffato
Copy link
Member

@muffato muffato commented Jul 15, 2025

We're making our way towards setting up our cross-organisation repository for modules and sub-workflows.

Linting is now failing and here is what I propose to change:

  1. In order to do cross-org repositories, we need to modify the JSON schema to allow the git_remote key under component names: https://nf-co.re/docs/tutorials/external_usage/cross_organisational_subworkflows
    The problem is that nf-core lint uses ~/.config/nfcore/nf-core/modules/subworkflows/yaml-schema.json which is not aware of the possibility of that extra key. I therefore propose to use the JSON that is shipped in the user repository itself subworkflow.base_dir. For consistency, I make modules linting use module.base_dir.
    This change in fact gives modules repo owners the liberty of defining their own yaml validation rules.
  2. Since meta_yaml["components"] can now contain dictionaries, it needs a bit of parsing to get the component names

Best,
Matthieu

PR checklist

  • This comment contains a description of changes (with reason)
  • CHANGELOG.md is updated
  • If you've fixed a bug or added code that should be tested, add tests!
  • Documentation in docs is updated

muffato added 2 commits July 15, 2025 22:45
Repos, in particular cross-org ones, may have their own JSON rules
@muffato muffato self-assigned this Jul 15, 2025
@muffato
Copy link
Member Author

muffato commented Jul 15, 2025

I can see some CI failures when the YAML schema can't be found. Would I check whether Path(subworkflow.base_dir, "subworkflows/yaml-schema.json") exists and fallback to Path(subworkflow_lint_object.modules_repo.local_repo_dir, "subworkflows/yaml-schema.json") ?

Copy link
Member

@mirpedrol mirpedrol left a comment

Choose a reason for hiding this comment

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

Could we add a test where we try to lint a module from the nf-core-test repository https://github.com/nf-core-test/modules.git? Thanks!

@@ -72,7 +72,7 @@ def meta_yml(module_lint_object: ComponentLint, module: NFCoreComponent, allow_m
# Confirm that the meta.yml file is valid according to the JSON schema
valid_meta_yml = False
try:
with open(Path(module_lint_object.modules_repo.local_repo_dir, "modules/meta-schema.json")) as fh:
with open(Path(module.base_dir, "modules/meta-schema.json")) as fh:
Copy link
Member

Choose a reason for hiding this comment

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

I am not sure we should change this. module_lint_object.modules_repo.local_repo_dir is checking the cloned modules repository, which should be the one that is being used.
I think what should be changed is the repo that we are cloning to the cache. I was trying to make some test with the test modules repo but there seems to be an error, my suggestion would be to fix that repo until it is useable and then we can figure out the best way to adapt it.

@mirpedrol
Copy link
Member

Hi again, I could do some tests, the issue is that you have to provide the git remote in the linting command, like nf-core subworkflows --git-remote https://github.com/<custom_org>/modules.git lint, that way module_lint_object.modules_repo.local_repo_dir will point to the right path

@@ -115,7 +115,7 @@ def meta_yml(subworkflow_lint_object, subworkflow, allow_missing: bool = False):
# join included modules and included subworkflows in a single list
included_components_names = [component["name"] for component in included_components]
if "components" in meta_yaml:
meta_components = [x for x in meta_yaml["components"]]
meta_components = [x if isinstance(x, str) else list(x)[0] for x in meta_yaml["components"]]
Copy link
Member

Choose a reason for hiding this comment

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

this change looks good 🙂

@muffato
Copy link
Member Author

muffato commented Jul 16, 2025

Hi again, I could do some tests, the issue is that you have to provide the git remote in the linting command, like nf-core subworkflows --git-remote https://github.com/<custom_org>/modules.git lint, that way module_lint_object.modules_repo.local_repo_dir will point to the right path

I can confirm it works for subworkflows (I still need to check modules). But I'm still wondering: why is nf-core making a git clone of the remote of the current repository instead of simply using the existing checkout that the user is trying to lint ?

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.

3 participants
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载