Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite8d2538

Browse files
JohnVillalovosnejch
authored andcommitted
feat(api): add content_ref and dry_run_ref parameters to ProjectCiLintManager
Add support for the new GitLab API parameters for validating existingCI/CD configurations:- content_ref: specify the branch, tag, or SHA to validate- dry_run_ref: set branch/tag context for dry run simulationsThe deprecated 'ref' parameter is kept for backward compatibility.Also update documentation with examples showing how to validateCI configuration from specific branches and with dry run simulation.Fixes#3260
1 parent2982f20 commite8d2538

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

‎docs/gl_objects/ci_lint.rst‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,18 @@ Lint a project's CI configuration::
4646
assert lint_result.valid is True # Test that the .gitlab-ci.yml is valid
4747
print(lint_result.merged_yaml) # Print the merged YAML file
4848

49+
Lint a project's CI configuration from a specific branch or tag::
50+
51+
lint_result = project.ci_lint.get(content_ref="main")
52+
assert lint_result.valid is True # Test that the .gitlab-ci.yml is valid
53+
print(lint_result.merged_yaml) # Print the merged YAML file
54+
55+
Lint a project's CI configuration with dry run simulation::
56+
57+
lint_result = project.ci_lint.get(dry_run=True, dry_run_ref="develop")
58+
assert lint_result.valid is True # Test that the .gitlab-ci.yml is valid
59+
print(lint_result.merged_yaml) # Print the merged YAML file
60+
4961
Lint a CI YAML configuration with a namespace::
5062

5163
lint_result = project.ci_lint.create({"content": gitlab_ci_yml})

‎gitlab/v4/objects/ci_lint.py‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,14 @@ class ProjectCiLintManager(
5151
_path="/projects/{project_id}/ci/lint"
5252
_obj_cls=ProjectCiLint
5353
_from_parent_attrs= {"project_id":"id"}
54-
_optional_get_attrs= ("dry_run","include_jobs","ref")
54+
_optional_get_attrs= (
55+
"content_ref",
56+
"dry_run",
57+
"dry_run_ref",
58+
"include_jobs",
59+
"ref",
60+
)
61+
5562
_create_attrs=RequiredOptional(
5663
required=("content",),optional=("dry_run","include_jobs","ref")
5764
)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp