Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions docs/gl_objects/ci_lint.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,18 @@ Lint a project's CI configuration::
assert lint_result.valid is True # Test that the .gitlab-ci.yml is valid
print(lint_result.merged_yaml) # Print the merged YAML file

Lint a project's CI configuration from a specific branch or tag::

lint_result = project.ci_lint.get(content_ref="main")
assert lint_result.valid is True # Test that the .gitlab-ci.yml is valid
print(lint_result.merged_yaml) # Print the merged YAML file

Lint a project's CI configuration with dry run simulation::

lint_result = project.ci_lint.get(dry_run=True, dry_run_ref="develop")
assert lint_result.valid is True # Test that the .gitlab-ci.yml is valid
print(lint_result.merged_yaml) # Print the merged YAML file

Lint a CI YAML configuration with a namespace::

lint_result = project.ci_lint.create({"content": gitlab_ci_yml})
Expand Down
9 changes: 8 additions & 1 deletion gitlab/v4/objects/ci_lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,14 @@ class ProjectCiLintManager(
_path = "/projects/{project_id}/ci/lint"
_obj_cls = ProjectCiLint
_from_parent_attrs = {"project_id": "id"}
_optional_get_attrs = ("dry_run", "include_jobs", "ref")
_optional_get_attrs = (
"content_ref",
"dry_run",
"dry_run_ref",
"include_jobs",
"ref",
)

_create_attrs = RequiredOptional(
required=("content",), optional=("dry_run", "include_jobs", "ref")
)
Expand Down