clear-skies-gitlab 2.0.1__tar.gz → 2.0.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {clear_skies_gitlab-2.0.1 → clear_skies_gitlab-2.0.3}/.copier-answers.yml +1 -1
- {clear_skies_gitlab-2.0.1 → clear_skies_gitlab-2.0.3}/.github/workflows/create-version.yaml +1 -1
- {clear_skies_gitlab-2.0.1 → clear_skies_gitlab-2.0.3}/CHANGELOG.md +19 -0
- clear_skies_gitlab-2.0.3/LATEST_CHANGELOG.md +8 -0
- {clear_skies_gitlab-2.0.1 → clear_skies_gitlab-2.0.3}/LICENSE +1 -1
- {clear_skies_gitlab-2.0.1 → clear_skies_gitlab-2.0.3}/PKG-INFO +2 -2
- clear_skies_gitlab-2.0.3/local.py +70 -0
- {clear_skies_gitlab-2.0.1 → clear_skies_gitlab-2.0.3}/pyproject.toml +2 -3
- clear_skies_gitlab-2.0.3/src/clearskies_gitlab/__init__.py +3 -0
- clear_skies_gitlab-2.0.3/src/clearskies_gitlab/defaults/__init__.py +9 -0
- {clear_skies_gitlab-2.0.1 → clear_skies_gitlab-2.0.3}/src/clearskies_gitlab/defaults/gitlab_default_auth.py +3 -0
- clear_skies_gitlab-2.0.3/src/clearskies_gitlab/defaults/gitlab_default_host.py +10 -0
- clear_skies_gitlab-2.0.3/src/clearskies_gitlab/defaults/gitlab_graphql_client.py +18 -0
- {clear_skies_gitlab-2.0.1 → clear_skies_gitlab-2.0.3}/src/clearskies_gitlab/exceptions/gitlab_error.py +1 -0
- clear_skies_gitlab-2.0.3/src/clearskies_gitlab/graphql/__init__.py +3 -0
- clear_skies_gitlab-2.0.3/src/clearskies_gitlab/graphql/backends/__init__.py +7 -0
- clear_skies_gitlab-2.0.3/src/clearskies_gitlab/graphql/backends/gitlab_graphql_backend.py +38 -0
- clear_skies_gitlab-2.0.3/src/clearskies_gitlab/graphql/models/__init__.py +13 -0
- clear_skies_gitlab-2.0.3/src/clearskies_gitlab/graphql/models/gitlab_container_repository.py +34 -0
- clear_skies_gitlab-2.0.3/src/clearskies_gitlab/graphql/models/gitlab_container_repository_reference.py +8 -0
- clear_skies_gitlab-2.0.3/src/clearskies_gitlab/graphql/models/gitlab_container_repository_tag.py +32 -0
- clear_skies_gitlab-2.0.3/src/clearskies_gitlab/graphql/models/gitlab_container_repository_tag_reference.py +8 -0
- clear_skies_gitlab-2.0.3/src/clearskies_gitlab/graphql/models/gitlab_group.py +24 -0
- clear_skies_gitlab-2.0.3/src/clearskies_gitlab/graphql/models/gitlab_group_reference.py +8 -0
- clear_skies_gitlab-2.0.3/src/clearskies_gitlab/graphql/models/gitlab_project.py +25 -0
- clear_skies_gitlab-2.0.3/src/clearskies_gitlab/graphql/models/gitlab_project_reference.py +8 -0
- clear_skies_gitlab-2.0.3/src/clearskies_gitlab/rest/__init__.py +12 -0
- clear_skies_gitlab-2.0.3/src/clearskies_gitlab/rest/backends/__init__.py +3 -0
- {clear_skies_gitlab-2.0.1/src/clearskies_gitlab → clear_skies_gitlab-2.0.3/src/clearskies_gitlab/rest}/backends/gitlab_rest_backend.py +17 -12
- clear_skies_gitlab-2.0.3/src/clearskies_gitlab/rest/gitlab_branch_rule.py +21 -0
- {clear_skies_gitlab-2.0.1/src/clearskies_gitlab/models → clear_skies_gitlab-2.0.3/src/clearskies_gitlab/rest}/gitlab_cicd_variable.py +0 -3
- {clear_skies_gitlab-2.0.1/src/clearskies_gitlab/models → clear_skies_gitlab-2.0.3/src/clearskies_gitlab/rest}/gitlab_member.py +0 -3
- clear_skies_gitlab-2.0.3/src/clearskies_gitlab/rest/models/__init__.py +49 -0
- {clear_skies_gitlab-2.0.1/src/clearskies_gitlab/models/rest → clear_skies_gitlab-2.0.3/src/clearskies_gitlab/rest/models}/gitlab_rest_advanced_search.py +7 -7
- {clear_skies_gitlab-2.0.1/src/clearskies_gitlab/models/rest → clear_skies_gitlab-2.0.3/src/clearskies_gitlab/rest/models}/gitlab_rest_advanced_search_blob.py +1 -4
- {clear_skies_gitlab-2.0.1/src/clearskies_gitlab/models/rest → clear_skies_gitlab-2.0.3/src/clearskies_gitlab/rest/models}/gitlab_rest_current_user.py +7 -4
- clear_skies_gitlab-2.0.3/src/clearskies_gitlab/rest/models/gitlab_rest_group.py +48 -0
- {clear_skies_gitlab-2.0.1/src/clearskies_gitlab/models/rest → clear_skies_gitlab-2.0.3/src/clearskies_gitlab/rest/models}/gitlab_rest_group_access_token.py +8 -6
- clear_skies_gitlab-2.0.3/src/clearskies_gitlab/rest/models/gitlab_rest_group_access_token_reference.py +8 -0
- clear_skies_gitlab-2.0.1/src/clearskies_gitlab/models/gitlab_group.py → clear_skies_gitlab-2.0.3/src/clearskies_gitlab/rest/models/gitlab_rest_group_base.py +40 -5
- {clear_skies_gitlab-2.0.1/src/clearskies_gitlab/models/rest → clear_skies_gitlab-2.0.3/src/clearskies_gitlab/rest/models}/gitlab_rest_group_member.py +7 -6
- clear_skies_gitlab-2.0.3/src/clearskies_gitlab/rest/models/gitlab_rest_group_member_reference.py +8 -0
- clear_skies_gitlab-2.0.3/src/clearskies_gitlab/rest/models/gitlab_rest_group_project.py +16 -0
- clear_skies_gitlab-2.0.3/src/clearskies_gitlab/rest/models/gitlab_rest_group_project_reference.py +8 -0
- clear_skies_gitlab-2.0.3/src/clearskies_gitlab/rest/models/gitlab_rest_group_reference.py +9 -0
- {clear_skies_gitlab-2.0.1/src/clearskies_gitlab/models/rest → clear_skies_gitlab-2.0.3/src/clearskies_gitlab/rest/models}/gitlab_rest_group_search.py +2 -3
- {clear_skies_gitlab-2.0.1/src/clearskies_gitlab/models/rest → clear_skies_gitlab-2.0.3/src/clearskies_gitlab/rest/models}/gitlab_rest_group_search_blob.py +1 -1
- clear_skies_gitlab-2.0.3/src/clearskies_gitlab/rest/models/gitlab_rest_group_subgroup.py +63 -0
- clear_skies_gitlab-2.0.3/src/clearskies_gitlab/rest/models/gitlab_rest_group_subgroup_reference.py +8 -0
- {clear_skies_gitlab-2.0.1/src/clearskies_gitlab/models/rest → clear_skies_gitlab-2.0.3/src/clearskies_gitlab/rest/models}/gitlab_rest_group_variable.py +7 -5
- clear_skies_gitlab-2.0.3/src/clearskies_gitlab/rest/models/gitlab_rest_group_variable_reference.py +8 -0
- {clear_skies_gitlab-2.0.1/src/clearskies_gitlab/models/rest → clear_skies_gitlab-2.0.3/src/clearskies_gitlab/rest/models}/gitlab_rest_namespace.py +28 -9
- clear_skies_gitlab-2.0.1/src/clearskies_gitlab/models/gitlab_project.py → clear_skies_gitlab-2.0.3/src/clearskies_gitlab/rest/models/gitlab_rest_project.py +129 -36
- clear_skies_gitlab-2.0.3/src/clearskies_gitlab/rest/models/gitlab_rest_project_approval_config.py +34 -0
- clear_skies_gitlab-2.0.3/src/clearskies_gitlab/rest/models/gitlab_rest_project_approval_config_reference.py +8 -0
- clear_skies_gitlab-2.0.3/src/clearskies_gitlab/rest/models/gitlab_rest_project_approval_rule.py +42 -0
- clear_skies_gitlab-2.0.3/src/clearskies_gitlab/rest/models/gitlab_rest_project_approval_rule_reference.py +8 -0
- clear_skies_gitlab-2.0.3/src/clearskies_gitlab/rest/models/gitlab_rest_project_member.py +29 -0
- clear_skies_gitlab-2.0.3/src/clearskies_gitlab/rest/models/gitlab_rest_project_member_reference.py +8 -0
- clear_skies_gitlab-2.0.3/src/clearskies_gitlab/rest/models/gitlab_rest_project_protected_branch.py +35 -0
- clear_skies_gitlab-2.0.3/src/clearskies_gitlab/rest/models/gitlab_rest_project_protected_branch_reference.py +8 -0
- clear_skies_gitlab-2.0.3/src/clearskies_gitlab/rest/models/gitlab_rest_project_reference.py +9 -0
- {clear_skies_gitlab-2.0.1/src/clearskies_gitlab/models/rest → clear_skies_gitlab-2.0.3/src/clearskies_gitlab/rest/models}/gitlab_rest_project_repository_commit.py +15 -5
- {clear_skies_gitlab-2.0.1/src/clearskies_gitlab/models/rest → clear_skies_gitlab-2.0.3/src/clearskies_gitlab/rest/models}/gitlab_rest_project_repository_commit_diff.py +6 -4
- clear_skies_gitlab-2.0.3/src/clearskies_gitlab/rest/models/gitlab_rest_project_repository_contributor.py +34 -0
- clear_skies_gitlab-2.0.3/src/clearskies_gitlab/rest/models/gitlab_rest_project_repository_contributor_reference.py +8 -0
- clear_skies_gitlab-2.0.3/src/clearskies_gitlab/rest/models/gitlab_rest_project_repository_file.py +39 -0
- clear_skies_gitlab-2.0.3/src/clearskies_gitlab/rest/models/gitlab_rest_project_repository_file_raw.py +31 -0
- clear_skies_gitlab-2.0.3/src/clearskies_gitlab/rest/models/gitlab_rest_project_repository_file_reference.py +8 -0
- {clear_skies_gitlab-2.0.1/src/clearskies_gitlab/models/rest → clear_skies_gitlab-2.0.3/src/clearskies_gitlab/rest/models}/gitlab_rest_project_variable.py +7 -5
- clear_skies_gitlab-2.0.3/src/clearskies_gitlab/rest/models/gitlab_rest_project_variable_reference.py +8 -0
- clear_skies_gitlab-2.0.3/uv.lock +1664 -0
- clear_skies_gitlab-2.0.1/LATEST_CHANGELOG.md +0 -15
- clear_skies_gitlab-2.0.1/src/clearskies_gitlab/__init__.py +0 -3
- clear_skies_gitlab-2.0.1/src/clearskies_gitlab/backends/__init__.py +0 -9
- clear_skies_gitlab-2.0.1/src/clearskies_gitlab/defaults/__init__.py +0 -7
- clear_skies_gitlab-2.0.1/src/clearskies_gitlab/defaults/gitlab_default_url.py +0 -7
- clear_skies_gitlab-2.0.1/src/clearskies_gitlab/models/__init__.py +0 -19
- clear_skies_gitlab-2.0.1/src/clearskies_gitlab/models/gitlab_gql_model.py +0 -9
- clear_skies_gitlab-2.0.1/src/clearskies_gitlab/models/gitlab_namespace.py +0 -32
- clear_skies_gitlab-2.0.1/src/clearskies_gitlab/models/gitlab_rest_model.py +0 -11
- clear_skies_gitlab-2.0.1/src/clearskies_gitlab/models/rest/__init__.py +0 -35
- clear_skies_gitlab-2.0.1/src/clearskies_gitlab/models/rest/gitlab_rest_group.py +0 -75
- clear_skies_gitlab-2.0.1/src/clearskies_gitlab/models/rest/gitlab_rest_group_member_reference.py +0 -6
- clear_skies_gitlab-2.0.1/src/clearskies_gitlab/models/rest/gitlab_rest_group_project.py +0 -37
- clear_skies_gitlab-2.0.1/src/clearskies_gitlab/models/rest/gitlab_rest_group_reference.py +0 -6
- clear_skies_gitlab-2.0.1/src/clearskies_gitlab/models/rest/gitlab_rest_group_subgroup.py +0 -65
- clear_skies_gitlab-2.0.1/src/clearskies_gitlab/models/rest/gitlab_rest_group_subgroup_reference.py +0 -6
- clear_skies_gitlab-2.0.1/src/clearskies_gitlab/models/rest/gitlab_rest_project.py +0 -81
- clear_skies_gitlab-2.0.1/src/clearskies_gitlab/models/rest/gitlab_rest_project_reference.py +0 -6
- clear_skies_gitlab-2.0.1/src/clearskies_gitlab/models/rest/gitlab_rest_project_variable_refence.py +0 -6
- clear_skies_gitlab-2.0.1/uv.lock +0 -1277
- {clear_skies_gitlab-2.0.1 → clear_skies_gitlab-2.0.3}/.editorconfig +0 -0
- {clear_skies_gitlab-2.0.1 → clear_skies_gitlab-2.0.3}/.github/workflows/docs.yaml +0 -0
- {clear_skies_gitlab-2.0.1 → clear_skies_gitlab-2.0.3}/.github/workflows/run-tests.yml +0 -0
- {clear_skies_gitlab-2.0.1 → clear_skies_gitlab-2.0.3}/.github/workflows/tests-matrix.yaml +0 -0
- {clear_skies_gitlab-2.0.1 → clear_skies_gitlab-2.0.3}/.github/workflows/tests.yaml +0 -0
- {clear_skies_gitlab-2.0.1 → clear_skies_gitlab-2.0.3}/.gitignore +0 -0
- {clear_skies_gitlab-2.0.1 → clear_skies_gitlab-2.0.3}/.pre-commit-config.yaml +0 -0
- {clear_skies_gitlab-2.0.1 → clear_skies_gitlab-2.0.3}/.python-version +0 -0
- {clear_skies_gitlab-2.0.1 → clear_skies_gitlab-2.0.3}/README.md +0 -0
- {clear_skies_gitlab-2.0.1 → clear_skies_gitlab-2.0.3}/cliff.toml +0 -0
- {clear_skies_gitlab-2.0.1 → clear_skies_gitlab-2.0.3}/ruff.toml +0 -0
- {clear_skies_gitlab-2.0.1 → clear_skies_gitlab-2.0.3}/src/clearskies_gitlab/exceptions/__init__.py +0 -0
|
@@ -79,7 +79,7 @@ jobs:
|
|
|
79
79
|
# STEP 2: Commit all file changes together
|
|
80
80
|
- name: Commit All Changes
|
|
81
81
|
run: |
|
|
82
|
-
git add pyproject.toml CHANGELOG.md
|
|
82
|
+
git add pyproject.toml CHANGELOG.md uv.lock
|
|
83
83
|
git commit -m "chore(release): bump version to ${{ steps.bump.outputs.tag }}"
|
|
84
84
|
|
|
85
85
|
# STEP 3: Create the tag for the final commit
|
|
@@ -5,6 +5,21 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [2.0.3] - 2026-01-14
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
- Update to v0.0.36
|
|
12
|
+
|
|
13
|
+
### Fixed
|
|
14
|
+
- Gitlab rest groups
|
|
15
|
+
|
|
16
|
+
## [2.0.2] - 2026-01-07
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
- Bump version to v2.0.2 by @github-actions[bot]
|
|
20
|
+
- Rewrite modules
|
|
21
|
+
- More models
|
|
22
|
+
|
|
8
23
|
## [2.0.1] - 2025-10-20
|
|
9
24
|
|
|
10
25
|
### Added
|
|
@@ -12,6 +27,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
12
27
|
- Add first models and backends
|
|
13
28
|
|
|
14
29
|
### Changed
|
|
30
|
+
- Bump version to v2.0.1 by @github-actions[bot]
|
|
15
31
|
- Initial project setup
|
|
16
32
|
|
|
17
33
|
### Fixed
|
|
@@ -19,6 +35,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
19
35
|
- Circular import
|
|
20
36
|
|
|
21
37
|
## New Contributors
|
|
38
|
+
* @github-actions[bot] made their first contribution
|
|
22
39
|
* @ made their first contribution
|
|
40
|
+
[2.0.3]: https://github.com/clearskies-py/gitlab/compare/v2.0.2..v2.0.3
|
|
41
|
+
[2.0.2]: https://github.com/clearskies-py/gitlab/compare/v2.0.1..v2.0.2
|
|
23
42
|
|
|
24
43
|
<!-- generated by git-cliff -->
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: clear-skies-gitlab
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.3
|
|
4
4
|
Summary: Gitlab module for Clearskies
|
|
5
5
|
Project-URL: Docs, https://https://clearskies.info/modules/clear-skies-gitlab
|
|
6
6
|
Project-URL: Repository, https://github.com/clearskies-py/gitlab
|
|
@@ -15,7 +15,7 @@ Classifier: License :: OSI Approved :: MIT License
|
|
|
15
15
|
Classifier: Programming Language :: Python :: 3
|
|
16
16
|
Requires-Python: <4.0,>=3.11
|
|
17
17
|
Requires-Dist: clear-skies>=2.0.0
|
|
18
|
-
Requires-Dist: gql>=4.0.0
|
|
18
|
+
Requires-Dist: gql[all]>=4.0.0
|
|
19
19
|
Requires-Dist: requests>=2.32.5
|
|
20
20
|
Provides-Extra: dev
|
|
21
21
|
Requires-Dist: types-requests>=2.32.4; extra == 'dev'
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
#!/usr/bin/python3
|
|
2
|
+
import logging
|
|
3
|
+
from typing import Any
|
|
4
|
+
|
|
5
|
+
import akeyless
|
|
6
|
+
import clearskies
|
|
7
|
+
|
|
8
|
+
import clearskies_gitlab
|
|
9
|
+
from clearskies_gitlab.graphql import models as graphql
|
|
10
|
+
from clearskies_gitlab.rest import models as rest
|
|
11
|
+
|
|
12
|
+
logging.basicConfig(level=logging.WARN)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def get_project(
|
|
16
|
+
gitlab_rest_projects: rest.GitlabRestProject, gitlab_gql_projects: graphql.GitlabProject
|
|
17
|
+
) -> dict[str, Any]:
|
|
18
|
+
"""Local test for projects."""
|
|
19
|
+
project = gitlab_rest_projects.find("id=Cimpress-Technology/cimsec/cimsec-pypi")
|
|
20
|
+
# print(f"Parent group: {project.group.name}")
|
|
21
|
+
# print(f"Count: {len(search_projects)}")
|
|
22
|
+
for variable in project.variables.paginate_all():
|
|
23
|
+
print(f"Variable: {variable.key} = {variable.value}")
|
|
24
|
+
|
|
25
|
+
gql_project = gitlab_gql_projects.find("id=278964")
|
|
26
|
+
print(f"GQL Parent group ID: {gql_project.id}")
|
|
27
|
+
print(f"GGL data: {gql_project.get_columns_data()}")
|
|
28
|
+
return project.group.id
|
|
29
|
+
# for project in search_projects.paginate_all():
|
|
30
|
+
# print(project.name)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def get_group(gitlab_rest_group: rest.GitlabRestGroup) -> dict[str, Any]:
|
|
34
|
+
"""Local test for groups."""
|
|
35
|
+
group = gitlab_rest_group.find("id=Cimpress-Technology/cimsec")
|
|
36
|
+
# print(f"Group name: {group.name}")
|
|
37
|
+
# print(f"Count: {len(search_groups)}")
|
|
38
|
+
for variable in group.variables.paginate_all():
|
|
39
|
+
print(f"Variable: {variable.key} = {variable.value}")
|
|
40
|
+
for project in group.projects.limit(5):
|
|
41
|
+
print(f"Project: {project.name}")
|
|
42
|
+
for member in group.members.limit(5):
|
|
43
|
+
print(f"Member: {member.name}")
|
|
44
|
+
return group.id
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
cli = clearskies.contexts.Cli(
|
|
48
|
+
clearskies.EndpointGroup(
|
|
49
|
+
[
|
|
50
|
+
clearskies.endpoints.Callable(
|
|
51
|
+
get_project,
|
|
52
|
+
url="/project",
|
|
53
|
+
return_standard_response=False,
|
|
54
|
+
),
|
|
55
|
+
clearskies.endpoints.Callable(
|
|
56
|
+
get_group,
|
|
57
|
+
url="/group",
|
|
58
|
+
return_standard_response=False,
|
|
59
|
+
),
|
|
60
|
+
]
|
|
61
|
+
),
|
|
62
|
+
modules=[clearskies_gitlab],
|
|
63
|
+
bindings={
|
|
64
|
+
"akeyless_sdk": akeyless,
|
|
65
|
+
"secrets": clearskies.secrets.Akeyless(access_id="p-je7a0rik2ptf", access_type="saml", profile="default"),
|
|
66
|
+
},
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
if __name__ == "__main__":
|
|
70
|
+
cli()
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "clear-skies-gitlab"
|
|
3
3
|
description = "Gitlab module for Clearskies"
|
|
4
|
-
version = "2.0.
|
|
4
|
+
version = "2.0.3"
|
|
5
5
|
license = "MIT"
|
|
6
6
|
readme = "./README.md"
|
|
7
7
|
authors = [{name = "Tom Nijboer", email = "tom.nijboer@cimpress.com"}]
|
|
8
8
|
requires-python = ">=3.11,<4.0"
|
|
9
9
|
dependencies = [
|
|
10
10
|
"clear-skies>=2.0.0",
|
|
11
|
-
"gql>=4.0.0",
|
|
11
|
+
"gql[all]>=4.0.0",
|
|
12
12
|
"requests>=2.32.5",
|
|
13
13
|
]
|
|
14
14
|
classifiers = [
|
|
@@ -69,7 +69,6 @@ pythonpath = [
|
|
|
69
69
|
"src"
|
|
70
70
|
]
|
|
71
71
|
|
|
72
|
-
|
|
73
72
|
# This is the dedicated section for uv"s configuration
|
|
74
73
|
[dependency-groups]
|
|
75
74
|
dev = [
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
from clearskies_gitlab.defaults.gitlab_default_auth import GitlabDefaultAuth
|
|
2
|
+
from clearskies_gitlab.defaults.gitlab_default_host import GitlabDefaultHost
|
|
3
|
+
from clearskies_gitlab.defaults.gitlab_graphql_client import GitlabDefaultGraphqlClient
|
|
4
|
+
|
|
5
|
+
__all__ = [
|
|
6
|
+
"GitlabDefaultAuth",
|
|
7
|
+
"GitlabDefaultHost",
|
|
8
|
+
"GitlabDefaultGraphqlClient",
|
|
9
|
+
]
|
|
@@ -2,6 +2,9 @@ import clearskies
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
class GitlabDefaultAuth(clearskies.di.AdditionalConfigAutoImport):
|
|
5
|
+
"""Provide default Gitlab authentication from environment."""
|
|
6
|
+
|
|
5
7
|
def provide_gitlab_auth(self, environment: clearskies.Environment):
|
|
8
|
+
"""Provide the Gitlab authentication from environment."""
|
|
6
9
|
secret_key = environment.get("GITLAB_AUTH_KEY", True)
|
|
7
10
|
return clearskies.authentication.SecretBearer(secret_key=secret_key, header_prefix="Bearer ")
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import clearskies
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class GitlabDefaultHost(clearskies.di.AdditionalConfigAutoImport):
|
|
5
|
+
"""Provide default GitLab Host from environment."""
|
|
6
|
+
|
|
7
|
+
def provide_gitlab_host(self, environment: clearskies.Environment):
|
|
8
|
+
"""Provide the GitLab host from environment or default."""
|
|
9
|
+
gitlab_host = environment.get("GITLAB_HOST", True)
|
|
10
|
+
return gitlab_host if gitlab_host else "https://gitlab.com/"
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import clearskies
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class GitlabDefaultGraphqlClient(clearskies.di.AdditionalConfigAutoImport):
|
|
5
|
+
"""Provide default Gitlab authentication from environment."""
|
|
6
|
+
|
|
7
|
+
def provide_gitlab_graphql_client(
|
|
8
|
+
self,
|
|
9
|
+
gitlab_auth: clearskies.authentication.Authentication,
|
|
10
|
+
gitlab_host: str,
|
|
11
|
+
environment: clearskies.Environment,
|
|
12
|
+
):
|
|
13
|
+
"""Provide the Gitlab authentication from environment."""
|
|
14
|
+
return clearskies.clients.GraphqlClient(
|
|
15
|
+
endpoint=f"{gitlab_host.rstrip('/')}/api/graphql",
|
|
16
|
+
authentication=gitlab_auth,
|
|
17
|
+
timeout=30,
|
|
18
|
+
)
|
|
@@ -47,4 +47,5 @@ class GitlabParamMissingError(ValueError):
|
|
|
47
47
|
"""Error if param is missing."""
|
|
48
48
|
|
|
49
49
|
def __init__(self, param_name: str, table_name: str) -> None:
|
|
50
|
+
"""Create error with param and table name."""
|
|
50
51
|
super().__init__(f"Must provide the {param_name} to add the member to when updating a {table_name}")
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from clearskies import configs, decorators
|
|
4
|
+
from clearskies.backends import GraphqlBackend
|
|
5
|
+
from clearskies.clients.graphql_client import GraphqlClient
|
|
6
|
+
from clearskies.di import inject
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class GitlabGraphqlBackend(GraphqlBackend):
|
|
10
|
+
"""Backend to gitlab using graphql."""
|
|
11
|
+
|
|
12
|
+
graphql_client_name = configs.String(default="gitlab_graphql_client")
|
|
13
|
+
|
|
14
|
+
api_to_model_map = configs.AnyDict(default={})
|
|
15
|
+
pagination_parameter_name = configs.String(default="page")
|
|
16
|
+
api_casing = configs.String(default="camelCase")
|
|
17
|
+
model_casing = configs.String(default="snake_case")
|
|
18
|
+
|
|
19
|
+
di = inject.Di()
|
|
20
|
+
|
|
21
|
+
@decorators.parameters_to_properties
|
|
22
|
+
def __init__(
|
|
23
|
+
self,
|
|
24
|
+
graphql_client: GraphqlClient | None = None,
|
|
25
|
+
graphql_client_name: str = "gitlab_graphql_client",
|
|
26
|
+
root_field: str = "",
|
|
27
|
+
pagination_style: str = "cursor",
|
|
28
|
+
api_case: str = "camelCase",
|
|
29
|
+
model_case: str = "snake_case",
|
|
30
|
+
is_collection: bool | None = None,
|
|
31
|
+
max_relationship_depth: int = 2,
|
|
32
|
+
relationship_limit: int = 10,
|
|
33
|
+
use_connection_for_relationships: bool = True,
|
|
34
|
+
id_argument_name: str | None = None,
|
|
35
|
+
id_argument_is_array: bool = False,
|
|
36
|
+
id_format_pattern: str = "",
|
|
37
|
+
):
|
|
38
|
+
self.finalize_and_validate_configuration()
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from clearskies_gitlab.graphql.models.gitlab_container_repository import GitlabContainerRepository
|
|
4
|
+
from clearskies_gitlab.graphql.models.gitlab_container_repository_tag import GitlabContainerRepositoryTag
|
|
5
|
+
from clearskies_gitlab.graphql.models.gitlab_group import GitlabGroup
|
|
6
|
+
from clearskies_gitlab.graphql.models.gitlab_project import GitlabProject
|
|
7
|
+
|
|
8
|
+
__all__ = [
|
|
9
|
+
"GitlabContainerRepository",
|
|
10
|
+
"GitlabContainerRepositoryTag",
|
|
11
|
+
"GitlabProject",
|
|
12
|
+
"GitlabGroup",
|
|
13
|
+
]
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
from clearskies import Model
|
|
2
|
+
from clearskies.columns import BelongsToId, BelongsToModel, Datetime, HasMany, String
|
|
3
|
+
|
|
4
|
+
from clearskies_gitlab.graphql.backends import GitlabGraphqlBackend
|
|
5
|
+
from clearskies_gitlab.graphql.models import gitlab_container_repository_tag_reference, gitlab_project_reference
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class GitlabContainerRepository(Model):
|
|
9
|
+
"""Model for gitlab container repositories via GQL."""
|
|
10
|
+
|
|
11
|
+
id_column_name: str = "id"
|
|
12
|
+
|
|
13
|
+
backend = GitlabGraphqlBackend(
|
|
14
|
+
root_field="containerRepositories",
|
|
15
|
+
id_argument_is_array=True,
|
|
16
|
+
id_format_pattern="gid://gitlab/ContainerRepository/{id}",
|
|
17
|
+
id_argument_name="ids",
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
@classmethod
|
|
21
|
+
def destination_name(cls) -> str:
|
|
22
|
+
"""Return the slug of the api endpoint for this model."""
|
|
23
|
+
return "containerRepository"
|
|
24
|
+
|
|
25
|
+
name = String()
|
|
26
|
+
location = String()
|
|
27
|
+
path = String()
|
|
28
|
+
created_at = Datetime()
|
|
29
|
+
project_id = BelongsToId(gitlab_project_reference.GitlabProjectReference)
|
|
30
|
+
project = BelongsToModel("project_id")
|
|
31
|
+
tags = HasMany(
|
|
32
|
+
gitlab_container_repository_tag_reference.GitlabContainerRepositoryTagReference,
|
|
33
|
+
foreign_column_name="containerRepositoryId",
|
|
34
|
+
)
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
class GitlabContainerRepositoryReference:
|
|
2
|
+
"""Reference to GitlabContainerRepository model."""
|
|
3
|
+
|
|
4
|
+
def get_model_class(self) -> type:
|
|
5
|
+
"""Return the model class this reference points to."""
|
|
6
|
+
from clearskies_gitlab.graphql.models import gitlab_container_repository
|
|
7
|
+
|
|
8
|
+
return gitlab_container_repository.GitlabContainerRepository
|
clear_skies_gitlab-2.0.3/src/clearskies_gitlab/graphql/models/gitlab_container_repository_tag.py
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
from clearskies import Model
|
|
2
|
+
from clearskies.columns import BelongsToId, BelongsToModel, Datetime, String
|
|
3
|
+
|
|
4
|
+
from clearskies_gitlab.graphql.backends import GitlabGraphqlBackend
|
|
5
|
+
from clearskies_gitlab.graphql.models import gitlab_container_repository_reference
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class GitlabContainerRepositoryTag(Model):
|
|
9
|
+
"""Model for gitlab container repositories via GQL."""
|
|
10
|
+
|
|
11
|
+
id_column_name: str = "name"
|
|
12
|
+
|
|
13
|
+
backend = GitlabGraphqlBackend(
|
|
14
|
+
root_field="containerRepositories",
|
|
15
|
+
id_argument_is_array=True,
|
|
16
|
+
id_format_pattern="gid://gitlab/ContainerRepository/{id}",
|
|
17
|
+
id_argument_name="ids",
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
@classmethod
|
|
21
|
+
def destination_name(cls) -> str:
|
|
22
|
+
"""Return the slug of the api endpoint for this model."""
|
|
23
|
+
return "tag"
|
|
24
|
+
|
|
25
|
+
name = String()
|
|
26
|
+
digest = String()
|
|
27
|
+
location = String()
|
|
28
|
+
path = String()
|
|
29
|
+
created_at = Datetime()
|
|
30
|
+
published_at = Datetime()
|
|
31
|
+
container_repository_id = BelongsToId(gitlab_container_repository_reference.GitlabContainerRepositoryReference)
|
|
32
|
+
container_repository = BelongsToModel("container_repository_id")
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
class GitlabContainerRepositoryTagReference:
|
|
2
|
+
"""Reference to GitlabContainerRepositoryTag model."""
|
|
3
|
+
|
|
4
|
+
def get_model_class(self) -> type:
|
|
5
|
+
"""Return the model class this reference points to."""
|
|
6
|
+
from clearskies_gitlab.graphql.models import gitlab_container_repository_tag
|
|
7
|
+
|
|
8
|
+
return gitlab_container_repository_tag.GitlabContainerRepositoryTag
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from clearskies import Model
|
|
4
|
+
|
|
5
|
+
from clearskies_gitlab.graphql.backends import GitlabGraphqlBackend
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class GitlabGroup(Model):
|
|
9
|
+
"""Model for gitlab projects via GQL."""
|
|
10
|
+
|
|
11
|
+
gitlab_id_pattern: str = "gid://gitlab/Group/[ID]"
|
|
12
|
+
|
|
13
|
+
id_column_name: str = "id"
|
|
14
|
+
backend = GitlabGraphqlBackend(
|
|
15
|
+
root_field="groups",
|
|
16
|
+
id_argument_is_array=True,
|
|
17
|
+
id_format_pattern="gid://gitlab/Project/{id}",
|
|
18
|
+
id_argument_name="ids",
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
@classmethod
|
|
22
|
+
def destination_name(cls) -> str:
|
|
23
|
+
"""Return the slug of the api endpoint for this model."""
|
|
24
|
+
return "group"
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from clearskies import Model
|
|
4
|
+
from clearskies.columns import String
|
|
5
|
+
|
|
6
|
+
from clearskies_gitlab.graphql.backends import GitlabGraphqlBackend
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class GitlabProject(Model):
|
|
10
|
+
"""Model for gitlab projects via GQL."""
|
|
11
|
+
|
|
12
|
+
id_column_name: str = "id"
|
|
13
|
+
backend = GitlabGraphqlBackend(
|
|
14
|
+
root_field="projects",
|
|
15
|
+
id_argument_is_array=True,
|
|
16
|
+
id_format_pattern="gid://gitlab/Project/{id}",
|
|
17
|
+
id_argument_name="ids",
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
@classmethod
|
|
21
|
+
def destination_name(cls) -> str:
|
|
22
|
+
"""Return the slug of the api endpoint for this model."""
|
|
23
|
+
return "projects"
|
|
24
|
+
|
|
25
|
+
id = String()
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
class GitlabProjectReference:
|
|
2
|
+
"""Reference to GitlabProject model."""
|
|
3
|
+
|
|
4
|
+
def get_model_class(self) -> type:
|
|
5
|
+
"""Return the model class this reference points to."""
|
|
6
|
+
from clearskies_gitlab.graphql.models import gitlab_project
|
|
7
|
+
|
|
8
|
+
return gitlab_project.GitlabProject
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from clearskies_gitlab.rest import backends, models
|
|
4
|
+
from clearskies_gitlab.rest.gitlab_cicd_variable import GitlabCICDVariable
|
|
5
|
+
from clearskies_gitlab.rest.gitlab_member import GitlabMember
|
|
6
|
+
|
|
7
|
+
__all__ = [
|
|
8
|
+
"backends",
|
|
9
|
+
"models",
|
|
10
|
+
"GitlabMember",
|
|
11
|
+
"GitlabCICDVariable",
|
|
12
|
+
]
|
|
@@ -1,23 +1,16 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
-
import logging
|
|
4
3
|
import urllib
|
|
5
|
-
from
|
|
6
|
-
from typing import TYPE_CHECKING, Any, cast
|
|
4
|
+
from typing import TYPE_CHECKING, Any
|
|
7
5
|
|
|
8
|
-
import
|
|
9
|
-
from clearskies import Column, Model, configs
|
|
6
|
+
from clearskies import configs
|
|
10
7
|
from clearskies.backends import ApiBackend
|
|
11
8
|
from clearskies.decorators import parameters_to_properties
|
|
12
9
|
from clearskies.di import inject
|
|
13
|
-
from clearskies.functional import string
|
|
14
10
|
from clearskies.query import Query
|
|
15
11
|
from requests.structures import CaseInsensitiveDict
|
|
16
12
|
|
|
17
|
-
from clearskies_gitlab.exceptions import gitlab_error
|
|
18
|
-
|
|
19
13
|
if TYPE_CHECKING:
|
|
20
|
-
from clearskies import model
|
|
21
14
|
from clearskies.authentication import Authentication
|
|
22
15
|
from clearskies.query import Query
|
|
23
16
|
|
|
@@ -25,8 +18,8 @@ if TYPE_CHECKING:
|
|
|
25
18
|
class GitlabRestBackend(ApiBackend):
|
|
26
19
|
"""Backend for Gitlab.com."""
|
|
27
20
|
|
|
28
|
-
|
|
29
|
-
authentication = inject.ByName("gitlab_auth", cache=False)
|
|
21
|
+
gitlab_host = inject.ByName("gitlab_host", cache=True) # type: ignore[assignment]
|
|
22
|
+
authentication = inject.ByName("gitlab_auth", cache=False) # type: ignore[assignment]
|
|
30
23
|
requests = inject.Requests()
|
|
31
24
|
_auth_headers: dict[str, str] = {}
|
|
32
25
|
|
|
@@ -47,6 +40,17 @@ class GitlabRestBackend(ApiBackend):
|
|
|
47
40
|
):
|
|
48
41
|
self.finalize_and_validate_configuration()
|
|
49
42
|
|
|
43
|
+
@property
|
|
44
|
+
def base_url(self) -> str:
|
|
45
|
+
"""
|
|
46
|
+
Docstring for base_url.
|
|
47
|
+
|
|
48
|
+
:param self: Description
|
|
49
|
+
:return: Description
|
|
50
|
+
:rtype: str
|
|
51
|
+
"""
|
|
52
|
+
return f"{self.gitlab_host.rstrip('/')}/api/v4"
|
|
53
|
+
|
|
50
54
|
def count_method(self, query: Query) -> str:
|
|
51
55
|
"""Return the request method to use when making a request for a record count."""
|
|
52
56
|
return "HEAD"
|
|
@@ -90,6 +94,7 @@ class GitlabRestBackend(ApiBackend):
|
|
|
90
94
|
def conditions_to_request_parameters(
|
|
91
95
|
self, query: Query, used_routing_parameters: list[str]
|
|
92
96
|
) -> tuple[str, dict[str, str], dict[str, Any]]:
|
|
97
|
+
"""Convert query conditions to request parameters."""
|
|
93
98
|
route_id = ""
|
|
94
99
|
|
|
95
100
|
url_parameters = {}
|
|
@@ -111,7 +116,7 @@ class GitlabRestBackend(ApiBackend):
|
|
|
111
116
|
# self,
|
|
112
117
|
# next_page_data: dict[str, Any],
|
|
113
118
|
# query: Query,
|
|
114
|
-
# response: requests.Response,
|
|
119
|
+
# response: requests.Response,
|
|
115
120
|
# ) -> None:
|
|
116
121
|
# """
|
|
117
122
|
# Update the next_page_data dictionary with the appropriate data needed to fetch the next page of records.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from clearskies import Model
|
|
4
|
+
from clearskies.columns import Boolean, Datetime, Integer, Json, String
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class GitlabBranchRule(Model):
|
|
8
|
+
"""Model for GitLab branch rules."""
|
|
9
|
+
|
|
10
|
+
id = Integer()
|
|
11
|
+
name = String()
|
|
12
|
+
protected = Boolean()
|
|
13
|
+
developers_can_push = Boolean()
|
|
14
|
+
developers_can_merge = Boolean()
|
|
15
|
+
can_push = Boolean()
|
|
16
|
+
default = Boolean()
|
|
17
|
+
created_at = Datetime()
|
|
18
|
+
updated_at = Datetime()
|
|
19
|
+
code_owner_approval_required = Boolean()
|
|
20
|
+
unprotect_access_levels = Json()
|
|
21
|
+
push_access_levels = Json()
|