saltext.jumpcloud 0.1.0__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.
Files changed (107) hide show
  1. saltext_jumpcloud-0.1.0/.codecov.yml +25 -0
  2. saltext_jumpcloud-0.1.0/.copier-answers.yml +33 -0
  3. saltext_jumpcloud-0.1.0/.coveragerc +44 -0
  4. saltext_jumpcloud-0.1.0/.envrc.example +7 -0
  5. saltext_jumpcloud-0.1.0/.gitignore +139 -0
  6. saltext_jumpcloud-0.1.0/.gitlab/issue_templates/Bug.md +10 -0
  7. saltext_jumpcloud-0.1.0/.gitlab/issue_templates/Feature.md +4 -0
  8. saltext_jumpcloud-0.1.0/.gitlab/merge_request_templates/Default.md +7 -0
  9. saltext_jumpcloud-0.1.0/.gitlab-ci.yml +180 -0
  10. saltext_jumpcloud-0.1.0/.pre-commit-config.yaml +147 -0
  11. saltext_jumpcloud-0.1.0/.pre-commit-hooks/check-cli-examples.py +64 -0
  12. saltext_jumpcloud-0.1.0/.pre-commit-hooks/check-gitlab-ci.py +50 -0
  13. saltext_jumpcloud-0.1.0/.pre-commit-hooks/make-autodocs.py +123 -0
  14. saltext_jumpcloud-0.1.0/.pylintrc +679 -0
  15. saltext_jumpcloud-0.1.0/CHANGELOG.md +20 -0
  16. saltext_jumpcloud-0.1.0/CODE-OF-CONDUCT.md +127 -0
  17. saltext_jumpcloud-0.1.0/CONTRIBUTING.md +14 -0
  18. saltext_jumpcloud-0.1.0/LICENSE +373 -0
  19. saltext_jumpcloud-0.1.0/Makefile +58 -0
  20. saltext_jumpcloud-0.1.0/PKG-INFO +192 -0
  21. saltext_jumpcloud-0.1.0/README.md +135 -0
  22. saltext_jumpcloud-0.1.0/changelog/.template.jinja +15 -0
  23. saltext_jumpcloud-0.1.0/docs/Makefile +20 -0
  24. saltext_jumpcloud-0.1.0/docs/_ext/saltdomain.py +18 -0
  25. saltext_jumpcloud-0.1.0/docs/_static/.gitkeep +0 -0
  26. saltext_jumpcloud-0.1.0/docs/changelog.md +12 -0
  27. saltext_jumpcloud-0.1.0/docs/conf.py +194 -0
  28. saltext_jumpcloud-0.1.0/docs/index.rst +40 -0
  29. saltext_jumpcloud-0.1.0/docs/make.bat +35 -0
  30. saltext_jumpcloud-0.1.0/docs/ref/.gitkeep +0 -0
  31. saltext_jumpcloud-0.1.0/docs/ref/modules/index.rst +12 -0
  32. saltext_jumpcloud-0.1.0/docs/ref/modules/saltext.jumpcloud.modules.jumpcloud_mod.rst +5 -0
  33. saltext_jumpcloud-0.1.0/docs/ref/runners/index.rst +12 -0
  34. saltext_jumpcloud-0.1.0/docs/ref/runners/saltext.jumpcloud.runners.jumpcloud_mod.rst +5 -0
  35. saltext_jumpcloud-0.1.0/docs/ref/states/index.rst +12 -0
  36. saltext_jumpcloud-0.1.0/docs/ref/states/saltext.jumpcloud.states.jumpcloud_mod.rst +5 -0
  37. saltext_jumpcloud-0.1.0/docs/ref/utils/index.rst +13 -0
  38. saltext_jumpcloud-0.1.0/docs/ref/utils/saltext.jumpcloud.utils.jumpcloud_mod.rst +5 -0
  39. saltext_jumpcloud-0.1.0/docs/ref/utils/saltext.jumpcloud.utils.resources.rst +5 -0
  40. saltext_jumpcloud-0.1.0/docs/sitevars.rst +0 -0
  41. saltext_jumpcloud-0.1.0/docs/topics/configuration.md +178 -0
  42. saltext_jumpcloud-0.1.0/docs/topics/installation.md +28 -0
  43. saltext_jumpcloud-0.1.0/docs/topics/testing.md +167 -0
  44. saltext_jumpcloud-0.1.0/docs/topics/troubleshooting.md +200 -0
  45. saltext_jumpcloud-0.1.0/docs/topics/usage.md +255 -0
  46. saltext_jumpcloud-0.1.0/noxfile.py +553 -0
  47. saltext_jumpcloud-0.1.0/pyproject.toml +198 -0
  48. saltext_jumpcloud-0.1.0/setup.cfg +4 -0
  49. saltext_jumpcloud-0.1.0/setup.py +5 -0
  50. saltext_jumpcloud-0.1.0/src/saltext/jumpcloud/__init__.py +28 -0
  51. saltext_jumpcloud-0.1.0/src/saltext/jumpcloud/modules/__init__.py +0 -0
  52. saltext_jumpcloud-0.1.0/src/saltext/jumpcloud/modules/jumpcloud_mod.py +1062 -0
  53. saltext_jumpcloud-0.1.0/src/saltext/jumpcloud/runners/__init__.py +0 -0
  54. saltext_jumpcloud-0.1.0/src/saltext/jumpcloud/runners/jumpcloud_mod.py +422 -0
  55. saltext_jumpcloud-0.1.0/src/saltext/jumpcloud/states/__init__.py +0 -0
  56. saltext_jumpcloud-0.1.0/src/saltext/jumpcloud/states/jumpcloud_mod.py +1038 -0
  57. saltext_jumpcloud-0.1.0/src/saltext/jumpcloud/utils/__init__.py +0 -0
  58. saltext_jumpcloud-0.1.0/src/saltext/jumpcloud/utils/jumpcloud_mod.py +1059 -0
  59. saltext_jumpcloud-0.1.0/src/saltext/jumpcloud/utils/resources.py +421 -0
  60. saltext_jumpcloud-0.1.0/src/saltext/jumpcloud/version.py +1 -0
  61. saltext_jumpcloud-0.1.0/src/saltext.jumpcloud.egg-info/PKG-INFO +192 -0
  62. saltext_jumpcloud-0.1.0/src/saltext.jumpcloud.egg-info/SOURCES.txt +105 -0
  63. saltext_jumpcloud-0.1.0/src/saltext.jumpcloud.egg-info/dependency_links.txt +1 -0
  64. saltext_jumpcloud-0.1.0/src/saltext.jumpcloud.egg-info/entry_points.txt +2 -0
  65. saltext_jumpcloud-0.1.0/src/saltext.jumpcloud.egg-info/not-zip-safe +1 -0
  66. saltext_jumpcloud-0.1.0/src/saltext.jumpcloud.egg-info/requires.txt +35 -0
  67. saltext_jumpcloud-0.1.0/src/saltext.jumpcloud.egg-info/scm_file_list.json +99 -0
  68. saltext_jumpcloud-0.1.0/src/saltext.jumpcloud.egg-info/scm_version.json +8 -0
  69. saltext_jumpcloud-0.1.0/src/saltext.jumpcloud.egg-info/top_level.txt +1 -0
  70. saltext_jumpcloud-0.1.0/tests/__init__.py +0 -0
  71. saltext_jumpcloud-0.1.0/tests/conftest.py +55 -0
  72. saltext_jumpcloud-0.1.0/tests/functional/__init__.py +0 -0
  73. saltext_jumpcloud-0.1.0/tests/functional/conftest.py +174 -0
  74. saltext_jumpcloud-0.1.0/tests/functional/modules/__init__.py +0 -0
  75. saltext_jumpcloud-0.1.0/tests/functional/modules/test_jumpcloud.py +159 -0
  76. saltext_jumpcloud-0.1.0/tests/functional/runners/__init__.py +0 -0
  77. saltext_jumpcloud-0.1.0/tests/functional/states/__init__.py +0 -0
  78. saltext_jumpcloud-0.1.0/tests/functional/states/test_jumpcloud.py +200 -0
  79. saltext_jumpcloud-0.1.0/tests/integration/__init__.py +0 -0
  80. saltext_jumpcloud-0.1.0/tests/integration/conftest.py +195 -0
  81. saltext_jumpcloud-0.1.0/tests/integration/modules/__init__.py +0 -0
  82. saltext_jumpcloud-0.1.0/tests/integration/modules/test_jumpcloud.py +261 -0
  83. saltext_jumpcloud-0.1.0/tests/integration/runners/__init__.py +0 -0
  84. saltext_jumpcloud-0.1.0/tests/integration/states/__init__.py +0 -0
  85. saltext_jumpcloud-0.1.0/tests/mock/server.py +553 -0
  86. saltext_jumpcloud-0.1.0/tests/unit/__init__.py +0 -0
  87. saltext_jumpcloud-0.1.0/tests/unit/conftest.py +62 -0
  88. saltext_jumpcloud-0.1.0/tests/unit/modules/__init__.py +0 -0
  89. saltext_jumpcloud-0.1.0/tests/unit/modules/test_jumpcloud.py +305 -0
  90. saltext_jumpcloud-0.1.0/tests/unit/runners/__init__.py +0 -0
  91. saltext_jumpcloud-0.1.0/tests/unit/runners/test_jumpcloud.py +135 -0
  92. saltext_jumpcloud-0.1.0/tests/unit/states/__init__.py +0 -0
  93. saltext_jumpcloud-0.1.0/tests/unit/states/test_jumpcloud.py +453 -0
  94. saltext_jumpcloud-0.1.0/tests/unit/test_resources.py +113 -0
  95. saltext_jumpcloud-0.1.0/tests/unit/utils/__init__.py +0 -0
  96. saltext_jumpcloud-0.1.0/tests/unit/utils/test_jumpcloud_mod.py +815 -0
  97. saltext_jumpcloud-0.1.0/tools/fetch_spec.py +78 -0
  98. saltext_jumpcloud-0.1.0/tools/helpers/__init__.py +0 -0
  99. saltext_jumpcloud-0.1.0/tools/helpers/cmd.py +297 -0
  100. saltext_jumpcloud-0.1.0/tools/helpers/copier.py +114 -0
  101. saltext_jumpcloud-0.1.0/tools/helpers/git.py +30 -0
  102. saltext_jumpcloud-0.1.0/tools/helpers/pre_commit.py +115 -0
  103. saltext_jumpcloud-0.1.0/tools/helpers/prompt.py +54 -0
  104. saltext_jumpcloud-0.1.0/tools/helpers/venv.py +128 -0
  105. saltext_jumpcloud-0.1.0/tools/initialize.py +26 -0
  106. saltext_jumpcloud-0.1.0/tools/verify_schemas.py +275 -0
  107. saltext_jumpcloud-0.1.0/tools/version.py +92 -0
@@ -0,0 +1,25 @@
1
+ ---
2
+ coverage:
3
+ status:
4
+ project:
5
+ default: false
6
+ app:
7
+ informational: true
8
+ paths:
9
+ - src/
10
+ tests:
11
+ informational: true
12
+ paths:
13
+ - tests/
14
+ patch:
15
+ default: false
16
+ app:
17
+ informational: true
18
+ paths:
19
+ - src/
20
+ tests:
21
+ informational: true
22
+ paths:
23
+ - tests/
24
+ github_checks:
25
+ annotations: false
@@ -0,0 +1,33 @@
1
+ # Autogenerated. Do not edit this by hand, use `copier update`.
2
+ ---
3
+ _commit: 0.10.0
4
+ _src_path: https://github.com/salt-extensions/salt-extension-copier
5
+ author: Gary T. Giesen
6
+ author_email: ggiesen@giesen.me
7
+ coc_contact: ggiesen@giesen.me
8
+ copyright_begin: 2026
9
+ docs_url: https://ggiesen.gitlab.io/saltext-jumpcloud/
10
+ integration_name: JumpCloud
11
+ license: other
12
+ license_classifier: 'License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)'
13
+ loaders:
14
+ - module
15
+ - runner
16
+ - state
17
+ max_salt_version: '3008'
18
+ no_saltext_namespace: false
19
+ os_support:
20
+ - Linux
21
+ - macOS
22
+ - Windows
23
+ package_name: jumpcloud
24
+ project_name: jumpcloud
25
+ python_requires: '3.10'
26
+ relax_pylint: false
27
+ salt_version: '3006'
28
+ source_url: https://gitlab.com/ggiesen/saltext-jumpcloud
29
+ ssh_fixtures: false
30
+ summary: Salt Extension for interacting with JumpCloud
31
+ test_containers: false
32
+ tracker_url: https://gitlab.com/ggiesen/saltext-jumpcloud/-/issues
33
+ url: https://gitlab.com/ggiesen/saltext-jumpcloud
@@ -0,0 +1,44 @@
1
+ [run]
2
+ branch = True
3
+ cover_pylib = False
4
+ relative_files = True
5
+ parallel = True
6
+ concurrency = multiprocessing
7
+
8
+ omit =
9
+ .nox/*
10
+ setup.py
11
+
12
+ [report]
13
+ # Regexes for lines to exclude from consideration
14
+ exclude_also =
15
+ # Don't complain about missing debug-only code:
16
+ def __repr__
17
+
18
+ # Don't complain if tests don't hit defensive assertion code:
19
+ raise AssertionError
20
+ raise NotImplementedError
21
+
22
+ # Don't complain if non-runnable code isn't run:
23
+ if 0:
24
+ if False:
25
+ if __name__ == .__main__.:
26
+ if TYPE_CHECKING:
27
+ @(abc\.)?abstractmethod
28
+
29
+ # Add markers which exclude statements in between.
30
+ # Requires coverage>=7.6.0.
31
+ no cover: start(?s:.)*?no cover: stop
32
+
33
+ omit =
34
+ .nox/*
35
+ setup.py
36
+
37
+ ignore_errors = True
38
+
39
+ [paths]
40
+ source =
41
+ saltext/jumpcloud
42
+ src/saltext/jumpcloud
43
+ testsuite =
44
+ tests/
@@ -0,0 +1,7 @@
1
+ layout_saltext() {
2
+ VIRTUAL_ENV="$(python3 tools/initialize.py --print-venv)"
3
+ PATH_add "$VIRTUAL_ENV/bin"
4
+ export VIRTUAL_ENV
5
+ }
6
+
7
+ layout_saltext
@@ -0,0 +1,139 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ pip-wheel-metadata/
24
+ share/python-wheels/
25
+ *.egg-info/
26
+ .installed.cfg
27
+ *.egg
28
+ MANIFEST
29
+
30
+ # PyInstaller
31
+ # Usually these files are written by a python script from a template
32
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
33
+ *.manifest
34
+ *.spec
35
+
36
+ # Installer logs
37
+ pip-log.txt
38
+ pip-delete-this-directory.txt
39
+
40
+ # Unit test / coverage reports
41
+ htmlcov/
42
+ .tox/
43
+ .nox/
44
+ .coverage
45
+ .coverage.*
46
+ .cache
47
+ nosetests.xml
48
+ coverage.xml
49
+ *.cover
50
+ *.py,cover
51
+ .hypothesis/
52
+ .pytest_cache/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ target/
76
+
77
+ # Jupyter Notebook
78
+ .ipynb_checkpoints
79
+
80
+ # IPython
81
+ profile_default/
82
+ ipython_config.py
83
+
84
+ # pyenv
85
+ .python-version
86
+
87
+ # pipenv
88
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
89
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
90
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
91
+ # install all needed dependencies.
92
+ #Pipfile.lock
93
+
94
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow
95
+ __pypackages__/
96
+
97
+ # Celery stuff
98
+ celerybeat-schedule
99
+ celerybeat.pid
100
+
101
+ # SageMath parsed files
102
+ *.sage.py
103
+
104
+ # Environments
105
+ !.envrc.example
106
+ .env
107
+ .venv
108
+ env/
109
+ venv/
110
+ ENV/
111
+ env.bak/
112
+ venv.bak/
113
+
114
+ # Spyder project settings
115
+ .spyderproject
116
+ .spyproject
117
+
118
+ # Rope project settings
119
+ .ropeproject
120
+
121
+ # mkdocs documentation
122
+ /site
123
+
124
+ # mypy
125
+ .mypy_cache/
126
+ .dmypy.json
127
+ dmypy.json
128
+
129
+ # Pyre type checker
130
+ .pyre/
131
+
132
+ # Ignore the setuptools_scm auto-generated version module
133
+ src/saltext/jumpcloud/version.py
134
+
135
+ # Ignore CI generated artifacts
136
+ artifacts/
137
+
138
+ # Fetched OpenAPI documents (tools/fetch_spec.py)
139
+ spec/
@@ -0,0 +1,10 @@
1
+ ## Description
2
+
3
+
4
+ ## Setup
5
+ (Salt version, extension version, master vs minion, JumpCloud region: us/eu/in)
6
+
7
+ ## Steps to reproduce
8
+
9
+
10
+ ## Expected vs actual
@@ -0,0 +1,4 @@
1
+ ## What
2
+
3
+
4
+ ## Why
@@ -0,0 +1,7 @@
1
+ ## What does this MR do?
2
+
3
+
4
+ ## Related issues
5
+
6
+
7
+ ## Tests
@@ -0,0 +1,180 @@
1
+ # GitLab CI for saltext-jumpcloud.
2
+ #
3
+ # The salt-extension-copier template ships CI as GitHub Actions, which do not
4
+ # run on GitLab. This pipeline reproduces that matrix natively on GitLab:
5
+ # pre-commit lint, a nox test matrix across Salt/Python, a docs build, and
6
+ # GitLab Pages. Salt version is selected through the noxfile's SALT_REQUIREMENT
7
+ # environment variable (see noxfile.py).
8
+ #
9
+ # The matrix covers the two Salt majors upstream currently marks as supported
10
+ # LTS releases (3006 and 3008). 3007 is deliberately omitted: the copier
11
+ # template's own support data marks it `supported: false`. Python bounds per
12
+ # Salt major come from that same data -- 3006 tops out at 3.11, 3008 goes
13
+ # further, so the matrix is not a full cross product.
14
+
15
+ stages:
16
+ - lint
17
+ - test
18
+ - docs
19
+ - publish
20
+
21
+ variables:
22
+ PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
23
+
24
+ cache:
25
+ key: "${CI_JOB_NAME}"
26
+ paths:
27
+ - .cache/pip
28
+ - .nox
29
+
30
+ .py-base:
31
+ before_script:
32
+ - python -m pip install --upgrade pip nox
33
+
34
+ pre-commit:
35
+ stage: lint
36
+ image: python:3.10
37
+ before_script:
38
+ - python -m pip install --upgrade pip pre-commit
39
+ script:
40
+ - pre-commit run --all-files --show-diff-on-failure --color always
41
+
42
+ .tests:
43
+ stage: test
44
+ extends: .py-base
45
+ # Explicitly unit and functional only. The integration tests activate as soon
46
+ # as JUMPCLOUD_TEST_API_KEY is set, and that would be a project-wide variable
47
+ # visible to every job. They get their own job, integration-mock, which runs
48
+ # against the built-in mock and needs no credentials at all.
49
+ script:
50
+ - nox --force-color -e tests-3 -- tests/unit tests/functional -vv --showlocals
51
+ coverage: '/(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/'
52
+ artifacts:
53
+ when: always
54
+ reports:
55
+ junit: artifacts/junit-report.xml
56
+ paths:
57
+ - artifacts/
58
+ expire_in: 2 weeks
59
+
60
+ tests-salt3006-py3.10:
61
+ extends: .tests
62
+ image: python:3.10
63
+ variables:
64
+ SALT_REQUIREMENT: "salt>=3006,<3007"
65
+ tests-salt3006-py3.11:
66
+ extends: .tests
67
+ image: python:3.11
68
+ variables:
69
+ SALT_REQUIREMENT: "salt>=3006,<3007"
70
+ tests-salt3008-py3.10:
71
+ extends: .tests
72
+ image: python:3.10
73
+ variables:
74
+ SALT_REQUIREMENT: "salt>=3008"
75
+ tests-salt3008-py3.12:
76
+ extends: .tests
77
+ image: python:3.12
78
+ variables:
79
+ SALT_REQUIREMENT: "salt>=3008"
80
+
81
+ # Integration tests against the built-in mock (tests/mock/server.py), which
82
+ # needs no JumpCloud organization and no API key.
83
+ #
84
+ # The mock is stateful rather than replaying canned responses, so it genuinely
85
+ # exercises the read-modify-write cycle the states depend on. What it cannot
86
+ # catch is the real API disagreeing with its own documentation; that is what
87
+ # verify-schemas covers from one side and a real-organization run covers from
88
+ # the other. See tests/mock/server.py.
89
+ integration-mock:
90
+ stage: test
91
+ extends: .py-base
92
+ image: python:3.10
93
+ variables:
94
+ JUMPCLOUD_TEST_MOCK: "1"
95
+ script:
96
+ - nox --force-color -e tests-3 -- tests/integration --run-destructive -vv
97
+
98
+ # Check the resource table against the OpenAPI documents JumpCloud is serving
99
+ # right now, not a copy vendored into this repository.
100
+ #
101
+ # Both Console specs are published as plain files with no authentication, so
102
+ # this is authoritative and therefore blocks: a mismatch means the extension
103
+ # and the API genuinely disagree about what exists, what a collection supports,
104
+ # or what a given object may be associated with.
105
+ #
106
+ # This is the check no mock can perform, since a mock only ever agrees with
107
+ # whatever was written into it.
108
+ verify-schemas:
109
+ stage: test
110
+ extends: .py-base
111
+ image: python:3.10
112
+ script:
113
+ - nox --force-color -e verify-schemas
114
+ artifacts:
115
+ when: always
116
+ paths:
117
+ - spec/
118
+ expire_in: 2 weeks
119
+
120
+ .docs-base:
121
+ image: python:3.10
122
+ # sphinxcontrib-spelling wraps the enchant C library, which is not in the
123
+ # python images. Without it Sphinx aborts loading the extension.
124
+ before_script:
125
+ - apt-get update -qq
126
+ - apt-get install -y -qq libenchant-2-2 hunspell-en-us
127
+ - python -m pip install --upgrade pip nox
128
+
129
+ docs:
130
+ stage: docs
131
+ extends: .docs-base
132
+ script:
133
+ - nox --force-color -e docs
134
+ artifacts:
135
+ paths:
136
+ - docs/_build/html
137
+ expire_in: 2 weeks
138
+
139
+ pages:
140
+ stage: docs
141
+ extends: .docs-base
142
+ script:
143
+ - nox --force-color -e docs
144
+ - mv docs/_build/html public
145
+ artifacts:
146
+ paths:
147
+ - public
148
+ rules:
149
+ - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
150
+
151
+ # Publish to PyPI via Trusted Publishing (OIDC, no stored token).
152
+ #
153
+ # This is deliberately a MANUAL, tag-only job: nothing is published without an
154
+ # operator clicking "run", so tagging a release does not auto-fire an upload.
155
+ # It relies on a PyPI trusted publisher configured for this project with:
156
+ # namespace ggiesen / repo saltext-jumpcloud / pipeline .gitlab-ci.yml /
157
+ # environment "release"
158
+ # The ``environment: release`` below MUST match that PyPI configuration, and the
159
+ # ``aud: pypi`` id_token is what twine exchanges for a short-lived PyPI token.
160
+ publish:
161
+ stage: publish
162
+ image: python:3.12
163
+ variables:
164
+ # setuptools_scm needs the full history and the tag object to derive a clean
165
+ # release version; the default shallow clone can yield a "+local" version.
166
+ GIT_DEPTH: "0"
167
+ id_tokens:
168
+ PYPI_ID_TOKEN:
169
+ aud: pypi
170
+ environment: release
171
+ before_script:
172
+ - python -m pip install --upgrade build twine
173
+ script:
174
+ - python -m build
175
+ - twine check dist/*
176
+ # No credentials passed: twine uses the PYPI_ID_TOKEN trusted-publishing flow.
177
+ - twine upload dist/*
178
+ rules:
179
+ - if: '$CI_COMMIT_TAG =~ /^v\d+\.\d+/'
180
+ when: manual
@@ -0,0 +1,147 @@
1
+ ---
2
+ minimum_pre_commit_version: 2.4.0
3
+ repos:
4
+ - repo: https://github.com/pre-commit/pre-commit-hooks
5
+ rev: 3e8a8703264a2f4a69428a0aa4dcb512790b2c8c # v6.0.0
6
+ hooks:
7
+ - id: check-merge-conflict # Check for files that contain merge conflict strings.
8
+ args: [--assume-in-merge]
9
+ - id: trailing-whitespace # Trim trailing whitespace.
10
+ args: [--markdown-linebreak-ext=md]
11
+ - id: mixed-line-ending # Ensure files use UNIX-style newlines only.
12
+ args: [--fix=lf]
13
+ - id: end-of-file-fixer # Ensure files end with a newline.
14
+ - id: check-ast # Check whether files parse as valid Python.
15
+
16
+ # ----- Formatting ---------------------------------------------------------------------------->
17
+ - repo: https://github.com/saltstack/pre-commit-remove-import-headers
18
+ rev: e79f595c0df31b8cb152c53993ce7c3c64f07cd4 # 1.1.0
19
+ hooks:
20
+ - id: remove-import-headers
21
+
22
+ - repo: local
23
+ hooks:
24
+ - id: check-cli-examples
25
+ name: Check CLI examples on execution modules
26
+ entry: python .pre-commit-hooks/check-cli-examples.py
27
+ language: python
28
+ files: ^src/saltext/jumpcloud/modules/.*\.py$
29
+
30
+ - repo: local
31
+ hooks:
32
+ - id: check-gitlab-ci
33
+ name: Check .gitlab-ci.yml references resolve
34
+ entry: python .pre-commit-hooks/check-gitlab-ci.py
35
+ language: python
36
+ additional_dependencies: [PyYAML]
37
+ files: ^\.gitlab-ci\.yml$
38
+ pass_filenames: false
39
+
40
+ - id: check-docs
41
+ name: Check rST doc files exist for modules/states
42
+ entry: python .pre-commit-hooks/make-autodocs.py
43
+ language: python
44
+ pass_filenames: false
45
+
46
+ - repo: https://github.com/saltstack/salt-rewrite
47
+ # Automatically rewrite code with known rules
48
+ rev: 2401c0faef69b6b846c719d611bcfe358234d5d1 # 2.5.2
49
+ hooks:
50
+ - id: salt-rewrite
51
+ alias: rewrite-docstrings
52
+ name: Salt extensions docstrings auto-fixes
53
+ files: ^src/saltext/jumpcloud/.*\.py$
54
+ args: [--silent]
55
+
56
+ - repo: https://github.com/saltstack/salt-rewrite
57
+ # Automatically rewrite code with known rules
58
+ rev: 2401c0faef69b6b846c719d611bcfe358234d5d1 # 2.5.2
59
+ hooks:
60
+ - id: salt-rewrite
61
+ alias: rewrite-tests
62
+ name: Rewrite the test suite
63
+ files: ^tests/.*\.py$
64
+ args: [--silent, -E, fix_docstrings]
65
+
66
+ - repo: https://github.com/asottile/pyupgrade
67
+ rev: 75992aaa40730136014f34227e0135f63fc951b4 # v3.21.2
68
+ hooks:
69
+ - id: pyupgrade
70
+ name: Rewrite Code to be Py3.10+
71
+ args: [
72
+ --py310-plus,
73
+ ]
74
+ exclude: src/saltext/jumpcloud/version.py
75
+
76
+ - repo: https://github.com/PyCQA/isort
77
+ rev: a333737ed43df02b18e6c95477ea1b285b3de15a # 8.0.1
78
+ hooks:
79
+ - id: isort
80
+ args: [
81
+ --py 310,
82
+ ]
83
+ exclude: src/saltext/jumpcloud/(__init__|version).py
84
+
85
+ - repo: https://github.com/psf/black
86
+ rev: 87928e6d6761a4a6d22250e1fee5601b3998086e # 26.5.1
87
+ hooks:
88
+ - id: black
89
+ args: [-l 100]
90
+ exclude: src/saltext/jumpcloud/version.py
91
+
92
+ - repo: https://github.com/adamchainz/blacken-docs
93
+ rev: fda77690955e9b63c6687d8806bafd56a526e45f # 1.20.0
94
+ hooks:
95
+ - id: blacken-docs
96
+ args: [--skip-errors]
97
+ files: ^(docs/.*\.rst|src/saltext/jumpcloud/.*\.py)$
98
+ additional_dependencies:
99
+ - black==26.5.1
100
+ # <---- Formatting -----------------------------------------------------------------------------
101
+
102
+ # ----- Security ------------------------------------------------------------------------------>
103
+ - repo: https://github.com/PyCQA/bandit
104
+ rev: 92ae8b82fb422a639f0ed8d99e96cea769594e08 # 1.9.4
105
+ hooks:
106
+ - id: bandit
107
+ alias: bandit-salt
108
+ name: Run bandit against the code base
109
+ args: [--silent, -lll, --skip, B701]
110
+ exclude: src/saltext/jumpcloud/version.py
111
+
112
+ - repo: https://github.com/PyCQA/bandit
113
+ rev: 92ae8b82fb422a639f0ed8d99e96cea769594e08 # 1.9.4
114
+ hooks:
115
+ - id: bandit
116
+ alias: bandit-tests
117
+ name: Run bandit against the test suite
118
+ args: [--silent, -lll, --skip, B701]
119
+ files: ^tests/.*
120
+ # <---- Security -------------------------------------------------------------------------------
121
+
122
+ # ----- Code Analysis ------------------------------------------------------------------------->
123
+
124
+ - repo: local
125
+ hooks:
126
+ - id: nox
127
+ alias: lint-src
128
+ name: Lint Source Code
129
+ language: python
130
+ entry: nox -e lint-code-pre-commit --
131
+ files: ^((setup|noxfile)|src/.*)\.py$
132
+ require_serial: true
133
+ additional_dependencies:
134
+ - nox==2026.4.10
135
+ - uv==0.11.26 # Makes this hook much faster
136
+
137
+ - id: nox
138
+ alias: lint-tests
139
+ name: Lint Tests
140
+ language: python
141
+ entry: nox -e lint-tests-pre-commit --
142
+ files: ^tests/.*\.py$
143
+ require_serial: true
144
+ additional_dependencies:
145
+ - nox==2026.4.10
146
+ - uv==0.11.26 # Makes this hook much faster
147
+ # <---- Code Analysis --------------------------------------------------------------------------
@@ -0,0 +1,64 @@
1
+ import ast
2
+ import pathlib
3
+ import re
4
+ import sys
5
+
6
+ CODE_ROOT = pathlib.Path(__file__).resolve().parent.parent
7
+ EXECUTION_MODULES_PATH = CODE_ROOT / "src" / "saltext" / "jumpcloud" / "modules"
8
+
9
+
10
+ def check_cli_examples(files):
11
+ """
12
+ Check that every function on every execution module provides a CLI example
13
+ """
14
+ errors = 0
15
+ for file in files:
16
+ path = pathlib.Path(file).resolve()
17
+ try:
18
+ relpath = path.relative_to(EXECUTION_MODULES_PATH)
19
+ if str(relpath.parent) != ".":
20
+ # We don't want to check nested packages
21
+ continue
22
+ except ValueError:
23
+ # We're only interested in execution modules
24
+ continue
25
+ module = ast.parse(path.read_text(), filename=str(path))
26
+ for funcdef in [node for node in module.body if isinstance(node, ast.FunctionDef)]:
27
+ if funcdef.name.startswith("_"):
28
+ # We're not interested in internal functions
29
+ continue
30
+
31
+ docstring = ast.get_docstring(funcdef, clean=False)
32
+ if not docstring:
33
+ errors += 1
34
+ print(
35
+ "The function {!r} on '{}' does not have a docstring".format(
36
+ funcdef.name,
37
+ path.relative_to(CODE_ROOT),
38
+ ),
39
+ file=sys.stderr,
40
+ )
41
+ continue
42
+
43
+ if _check_cli_example_present(docstring) is False:
44
+ errors += 1
45
+ print(
46
+ "The function {!r} on '{}' does not have a 'CLI Example:' in it's docstring".format(
47
+ funcdef.name,
48
+ path.relative_to(CODE_ROOT),
49
+ ),
50
+ file=sys.stderr,
51
+ )
52
+ continue
53
+ sys.exit(errors)
54
+
55
+
56
+ CLI_EXAMPLE_PRESENT_RE = re.compile(r"CLI Example(?:s)?:")
57
+
58
+
59
+ def _check_cli_example_present(docstring):
60
+ return CLI_EXAMPLE_PRESENT_RE.search(docstring) is not None
61
+
62
+
63
+ if __name__ == "__main__":
64
+ check_cli_examples(sys.argv[1:])