summaryrefslogtreecommitdiff
path: root/docs/gl_objects
diff options
context:
space:
mode:
authorNejc Habjan <nejc.habjan@siemens.com>2022-07-05 14:14:40 +0200
committerJohn Villalovos <john@sodarock.com>2022-07-05 09:19:34 -0700
commitd5de4b1fe38bedc07862bd9446dfd48b92cb078d (patch)
tree0a9cfb7e608246f25c057ef69e1dd9812f840ed8 /docs/gl_objects
parent3f67c4b0fb0b9a39c8b93529a05b1541fcebcabe (diff)
downloadgitlab-d5de4b1fe38bedc07862bd9446dfd48b92cb078d.tar.gz
docs: document CI Lint usage
Diffstat (limited to 'docs/gl_objects')
-rw-r--r--docs/gl_objects/ci_lint.rst53
-rw-r--r--docs/gl_objects/projects.rst43
2 files changed, 53 insertions, 43 deletions
diff --git a/docs/gl_objects/ci_lint.rst b/docs/gl_objects/ci_lint.rst
new file mode 100644
index 0000000..6533db3
--- /dev/null
+++ b/docs/gl_objects/ci_lint.rst
@@ -0,0 +1,53 @@
+#######
+CI Lint
+#######
+
+Reference
+---------
+
+* v4 API:
+
+ + :class:`gitlab.v4.objects.CiLint`
+ + :class:`gitlab.v4.objects.CiLintManager`
+ + :attr:`gitlab.Gitlab.ci_lint`
+ + :class:`gitlab.v4.objects.ProjectCiLint`
+ + :class:`gitlab.v4.objects.ProjectCiLintManager`
+ + :attr:`gitlab.v4.objects.Project.ci_lint`
+
+* GitLab API: https://docs.gitlab.com/ee/api/lint.html
+
+Examples
+---------
+
+Validate a CI YAML configuration::
+
+ gitlab_ci_yml = """.api_test:
+ rules:
+ - if: $CI_PIPELINE_SOURCE=="merge_request_event"
+ changes:
+ - src/api/*
+ deploy:
+ extends:
+ - .api_test
+ rules:
+ - when: manual
+ allow_failure: true
+ script:
+ - echo "hello world"
+ """
+ lint_result = gl.ci_lint.create({"content": gitlab_ci_yml})
+
+ print(lint_result.status) # Print the status of the CI YAML
+ print(lint_result.merged_yaml) # Print the merged YAML file
+
+Validate a project's CI configuration::
+
+ lint_result = project.ci_lint.get()
+ assert lint_result.valid is True # Test that the .gitlab-ci.yml is valid
+ print(lint_result.merged_yaml) # Print the merged YAML file
+
+Validate a CI YAML configuration with a namespace::
+
+ lint_result = project.ci_lint.create({"content": gitlab_ci_yml})
+ assert lint_result.valid is True # Test that the .gitlab-ci.yml is valid
+ print(lint_result.merged_yaml) # Print the merged YAML file
diff --git a/docs/gl_objects/projects.rst b/docs/gl_objects/projects.rst
index a6ed0e6..82ec77f 100644
--- a/docs/gl_objects/projects.rst
+++ b/docs/gl_objects/projects.rst
@@ -819,49 +819,6 @@ Get total fetches in last 30 days of a project::
total_fetches = project.additionalstatistics.get().fetches['total']
-Project CI Lint
-=============================
-
-Reference
----------
-
-* v4 API:
-
- + :class:`gitlab.v4.objects.ProjectCiLint`
- + :class:`gitlab.v4.objects.ProjectCiLintManager`
- + :attr:`gitlab.v4.objects.Project.ci_lint`
-
-* GitLab API: https://docs.gitlab.com/ee/api/lint.html
-
-Examples
----------
-
-Validate a project's CI configuration::
-
- lint_result = project.ci_lint.get()
- assert lint_result.valid is True # Test that the .gitlab-ci.yml is valid
- print(lint_result.merged_yaml) # Print the merged YAML file
-
-Validate a CI YAML configuration with a namespace::
-
- gitlab_ci_yml = """.api_test:
- rules:
- - if: $CI_PIPELINE_SOURCE=="merge_request_event"
- changes:
- - src/api/*
- deploy:
- extends:
- - .api_test
- rules:
- - when: manual
- allow_failure: true
- script:
- - echo "hello world"
- """
- lint_result = project.ci_lint.create({"content": gitlab_ci_yml})
- assert lint_result.valid is True # Test that the .gitlab-ci.yml is valid
- print(lint_result.merged_yaml) # Print the merged YAML file
-
Project storage
=============================