Skip to content

Commit

Permalink
Add hint about config validation for invalid config error
Browse files Browse the repository at this point in the history
  • Loading branch information
lbarcziova committed Jan 18, 2024
1 parent 6562f01 commit 5be5dd9
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
8 changes: 6 additions & 2 deletions packit_service/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
from pathlib import Path
from typing import List, NamedTuple, Optional, Set, Union

from ogr.abstract import GitProject, Issue
from yaml import safe_load

from ogr.abstract import GitProject, Issue
from packit.config import (
Config,
PackageConfig,
Expand All @@ -30,6 +30,8 @@
SANDCASTLE_PVC,
SANDCASTLE_WORK_DIR,
TESTING_FARM_API_URL,
DOCS_VALIDATE_CONFIG,
DOCS_VALIDATE_HOOKS,
)

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -349,7 +351,9 @@ def get_package_config_from_repo(
"For more info, please check out "
f"[the documentation]({DOCS_HOW_TO_CONFIGURE_URL}) "
"or [contact the Packit team]"
f"({CONTACTS_URL})."
f"({CONTACTS_URL}). You can also use "
f"our CLI command [`validate-config`]({DOCS_VALIDATE_CONFIG}) or our "
f"[pre-commit hooks]({DOCS_VALIDATE_HOOKS}) for validation of the configuration."
)

if pr_id:
Expand Down
2 changes: 2 additions & 0 deletions packit_service/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
DOCS_APPROVAL_URL = f"{DOCS_URL}/guide/#2-approval"
DOCS_VM_IMAGE_BUILD = f"{DOCS_URL}/cli/build/in-image-builder/"
DOCS_TESTING_FARM = f"{DOCS_URL}/configuration/upstream/tests"
DOCS_VALIDATE_CONFIG = f"{DOCS_URL}/cli/validate-config"
DOCS_VALIDATE_HOOKS = "https://packit.dev/posts/pre-commit-hooks#validate-config"

KOJI_PRODUCTION_BUILDS_ISSUE = "https://pagure.io/releng/issue/9801"

Expand Down
6 changes: 5 additions & 1 deletion tests/integration/test_pr_comment.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
TASK_ACCEPTED,
DEFAULT_RETRY_LIMIT,
CHANGED_LOADING_BEHAVIOUR_IN_DISTGIT_MESSAGE,
DOCS_VALIDATE_HOOKS,
DOCS_VALIDATE_CONFIG,
)
from packit_service.models import (
CoprBuildTargetModel,
Expand Down Expand Up @@ -1714,7 +1716,9 @@ def test_trigger_packit_command_without_config(
"For more info, please check out "
f"[the documentation]({DOCS_HOW_TO_CONFIGURE_URL}) "
"or [contact the Packit team]"
f"({CONTACTS_URL})."
f"({CONTACTS_URL}). You can also use "
f"our CLI command [`validate-config`]({DOCS_VALIDATE_CONFIG}) or our "
f"[pre-commit hooks]({DOCS_VALIDATE_HOOKS}) for validation of the configuration."
)
flexmock(pr).should_receive("comment").with_args(err_msg)

Expand Down

0 comments on commit 5be5dd9

Please sign in to comment.