diff options
| author | Nejc Habjan <nejc.habjan@siemens.com> | 2022-07-05 12:17:04 +0200 |
|---|---|---|
| committer | John Villalovos <john@sodarock.com> | 2022-07-05 09:19:34 -0700 |
| commit | 3f67c4b0fb0b9a39c8b93529a05b1541fcebcabe (patch) | |
| tree | 2d147e85987036e077630512ab68644dc2f9c623 /gitlab | |
| parent | 6e1342fc0b7cf740b25a939942ea02cdd18a9625 (diff) | |
| download | gitlab-3f67c4b0fb0b9a39c8b93529a05b1541fcebcabe.tar.gz | |
feat(cli): add support for global CI lint
Diffstat (limited to 'gitlab')
| -rw-r--r-- | gitlab/client.py | 7 | ||||
| -rw-r--r-- | gitlab/v4/objects/ci_lint.py | 19 | ||||
| -rw-r--r-- | gitlab/v4/objects/projects.py | 6 |
3 files changed, 28 insertions, 4 deletions
diff --git a/gitlab/client.py b/gitlab/client.py index 82eebbc..54409c3 100644 --- a/gitlab/client.py +++ b/gitlab/client.py @@ -126,6 +126,8 @@ class Gitlab: self.broadcastmessages = objects.BroadcastMessageManager(self) """See :class:`~gitlab.v4.objects.BroadcastMessageManager`""" + self.ci_lint = objects.CiLintManager(self) + """See :class:`~gitlab.v4.objects.CiLintManager`""" self.deploykeys = objects.DeployKeyManager(self) """See :class:`~gitlab.v4.objects.DeployKeyManager`""" self.deploytokens = objects.DeployTokenManager(self) @@ -397,6 +399,11 @@ class Gitlab: Returns: (True, []) if the file is valid, (False, errors(list)) otherwise """ + utils.warn( + "`lint()` is deprecated and will be removed in a future version.\n" + "Please use `ci_lint.create()` instead.", + category=DeprecationWarning, + ) post_data = {"content": content} data = self.http_post("/ci/lint", post_data=post_data, **kwargs) if TYPE_CHECKING: diff --git a/gitlab/v4/objects/ci_lint.py b/gitlab/v4/objects/ci_lint.py index 4f781dc..73f9d4d 100644 --- a/gitlab/v4/objects/ci_lint.py +++ b/gitlab/v4/objects/ci_lint.py @@ -9,6 +9,25 @@ from gitlab.base import RESTManager, RESTObject from gitlab.mixins import CreateMixin, GetWithoutIdMixin from gitlab.types import RequiredOptional +__all__ = [ + "CiLint", + "CiLintManager", + "ProjectCiLint", + "ProjectCiLintManager", +] + + +class CiLint(RESTObject): + _id_attr = None + + +class CiLintManager(CreateMixin, RESTManager): + _path = "/ci/lint" + _obj_cls = CiLint + _create_attrs = RequiredOptional( + required=("content",), optional=("include_merged_yaml", "include_jobs") + ) + class ProjectCiLint(RESTObject): pass diff --git a/gitlab/v4/objects/projects.py b/gitlab/v4/objects/projects.py index 9d7262f..ab3fb20 100644 --- a/gitlab/v4/objects/projects.py +++ b/gitlab/v4/objects/projects.py @@ -38,7 +38,7 @@ from .audit_events import ProjectAuditEventManager # noqa: F401 from .badges import ProjectBadgeManager # noqa: F401 from .boards import ProjectBoardManager # noqa: F401 from .branches import ProjectBranchManager, ProjectProtectedBranchManager # noqa: F401 -from .ci_lint import ProjectCiLint, ProjectCiLintManager # noqa: F401 +from .ci_lint import ProjectCiLintManager # noqa: F401 from .clusters import ProjectClusterManager # noqa: F401 from .commits import ProjectCommitManager # noqa: F401 from .container_registry import ProjectRegistryRepositoryManager # noqa: F401 @@ -102,8 +102,6 @@ __all__ = [ "ProjectRemoteMirrorManager", "ProjectStorage", "ProjectStorageManager", - "ProjectCiLint", - "ProjectCiLintManager", ] @@ -165,7 +163,7 @@ class Project(RefreshMixin, SaveMixin, ObjectDeleteMixin, RepositoryMixin, RESTO badges: ProjectBadgeManager boards: ProjectBoardManager branches: ProjectBranchManager - ci_lint: "ProjectCiLintManager" + ci_lint: ProjectCiLintManager clusters: ProjectClusterManager commits: ProjectCommitManager customattributes: ProjectCustomAttributeManager |
