gitlab-compliance 2.0.1__tar.gz → 2.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.
- gitlab_compliance-2.1.0/LICENSE +201 -0
- gitlab_compliance-2.1.0/PKG-INFO +174 -0
- gitlab_compliance-2.1.0/docs/index.md +131 -0
- {gitlab_compliance-2.0.1 → gitlab_compliance-2.1.0}/pyproject.toml +29 -13
- gitlab_compliance-2.1.0/src/compliance/api_enrichment.py +65 -0
- {gitlab_compliance-2.0.1 → gitlab_compliance-2.1.0}/src/compliance/behave_support/environment.py +8 -0
- {gitlab_compliance-2.0.1 → gitlab_compliance-2.1.0}/src/compliance/behave_support/steps/then_steps.py +2 -2
- {gitlab_compliance-2.0.1 → gitlab_compliance-2.1.0}/src/compliance/behave_support/steps/when_steps.py +20 -2
- gitlab_compliance-2.1.0/src/compliance/builtin_policies/__init__.py +9 -0
- gitlab_compliance-2.1.0/src/compliance/builtin_policies/baseline-jobs.feature +17 -0
- gitlab_compliance-2.1.0/src/compliance/builtin_policies/component-inputs.feature +17 -0
- gitlab_compliance-2.1.0/src/compliance/builtin_policies/include-pinning.feature +15 -0
- gitlab_compliance-2.1.0/src/compliance/builtin_policies/variable-allowlist.feature +18 -0
- gitlab_compliance-2.1.0/src/compliance/console.py +324 -0
- {gitlab_compliance-2.0.1 → gitlab_compliance-2.1.0}/src/compliance/image_versions.py +79 -6
- {gitlab_compliance-2.0.1 → gitlab_compliance-2.1.0}/src/compliance/include_versions.py +109 -15
- gitlab_compliance-2.1.0/src/compliance/merge_requests.py +397 -0
- {gitlab_compliance-2.0.1 → gitlab_compliance-2.1.0}/src/compliance/metadata.py +80 -16
- {gitlab_compliance-2.0.1 → gitlab_compliance-2.1.0}/src/compliance/model.py +21 -10
- {gitlab_compliance-2.0.1 → gitlab_compliance-2.1.0}/src/compliance/policy_doc.py +9 -3
- gitlab_compliance-2.1.0/src/compliance/policy_fix.py +341 -0
- {gitlab_compliance-2.0.1 → gitlab_compliance-2.1.0}/src/compliance/release_cache.py +20 -8
- {gitlab_compliance-2.0.1 → gitlab_compliance-2.1.0}/src/compliance/render.py +367 -360
- gitlab_compliance-2.1.0/src/compliance/runner.py +507 -0
- gitlab_compliance-2.1.0/src/compliance/secret_redact.py +90 -0
- {gitlab_compliance-2.0.1 → gitlab_compliance-2.1.0}/src/compliance/stash.py +70 -7
- {gitlab_compliance-2.0.1 → gitlab_compliance-2.1.0}/src/compliance/supply_chain_fix.py +10 -1
- {gitlab_compliance-2.0.1 → gitlab_compliance-2.1.0}/src/gitlab_compliance.py +344 -58
- {gitlab_compliance-2.0.1 → gitlab_compliance-2.1.0}/src/modules/command_reference.py +263 -220
- gitlab_compliance-2.1.0/src/modules/common.py +272 -0
- {gitlab_compliance-2.0.1 → gitlab_compliance-2.1.0}/src/modules/constants.py +11 -1
- {gitlab_compliance-2.0.1 → gitlab_compliance-2.1.0}/src/modules/doc_controller.py +178 -178
- gitlab_compliance-2.1.0/src/modules/gitstrings.py +931 -0
- gitlab_compliance-2.1.0/src/modules/output_filters.py +160 -0
- {gitlab_compliance-2.0.1 → gitlab_compliance-2.1.0}/src/modules/pipeline_data.py +85 -23
- {gitlab_compliance-2.0.1 → gitlab_compliance-2.1.0}/src/modules/swagger_html.py +109 -38
- gitlab_compliance-2.1.0/src/modules/swagger_markdown.py +233 -0
- gitlab_compliance-2.1.0/src/modules/yaml_lines.py +77 -0
- {gitlab_compliance-2.0.1 → gitlab_compliance-2.1.0}/src/properties/extract_job_attribute.py +1 -1
- {gitlab_compliance-2.0.1 → gitlab_compliance-2.1.0}/src/properties/includes.py +16 -0
- gitlab_compliance-2.1.0/src/properties/inputs.py +28 -0
- {gitlab_compliance-2.0.1 → gitlab_compliance-2.1.0}/src/properties/jobs.py +84 -48
- gitlab_compliance-2.1.0/src/properties/table_render.py +495 -0
- gitlab_compliance-2.1.0/src/properties/variables.py +27 -0
- gitlab_compliance-2.1.0/src/properties/yaml_paths.py +164 -0
- gitlab_compliance-2.0.1/LICENSE +0 -21
- gitlab_compliance-2.0.1/PKG-INFO +0 -94
- gitlab_compliance-2.0.1/docs/index.md +0 -59
- gitlab_compliance-2.0.1/src/compliance/api_enrichment.py +0 -52
- gitlab_compliance-2.0.1/src/compliance/console.py +0 -95
- gitlab_compliance-2.0.1/src/compliance/runner.py +0 -310
- gitlab_compliance-2.0.1/src/modules/common.py +0 -144
- gitlab_compliance-2.0.1/src/modules/yaml_lines.py +0 -70
- gitlab_compliance-2.0.1/src/properties/inputs.py +0 -86
- gitlab_compliance-2.0.1/src/properties/variables.py +0 -91
- {gitlab_compliance-2.0.1 → gitlab_compliance-2.1.0}/src/__init__.py +0 -0
- {gitlab_compliance-2.0.1 → gitlab_compliance-2.1.0}/src/compliance/__init__.py +0 -0
- {gitlab_compliance-2.0.1 → gitlab_compliance-2.1.0}/src/compliance/api_config.py +0 -0
- {gitlab_compliance-2.0.1 → gitlab_compliance-2.1.0}/src/compliance/behave_support/steps/__init__.py +0 -0
- {gitlab_compliance-2.0.1 → gitlab_compliance-2.1.0}/src/compliance/behave_support/steps/given_steps.py +0 -0
- {gitlab_compliance-2.0.1 → gitlab_compliance-2.1.0}/src/compliance/container_fix.py +0 -0
- {gitlab_compliance-2.0.1 → gitlab_compliance-2.1.0}/src/compliance/gitlab_api.py +0 -0
- {gitlab_compliance-2.0.1 → gitlab_compliance-2.1.0}/src/compliance/include_fix.py +0 -0
- {gitlab_compliance-2.0.1 → gitlab_compliance-2.1.0}/src/compliance/models.py +0 -0
- {gitlab_compliance-2.0.1 → gitlab_compliance-2.1.0}/src/compliance/oci_registry.py +0 -0
- {gitlab_compliance-2.0.1 → gitlab_compliance-2.1.0}/src/gitlab_docs.py +0 -0
- {gitlab_compliance-2.0.1 → gitlab_compliance-2.1.0}/src/modules/__init__.py +0 -0
- {gitlab_compliance-2.0.1 → gitlab_compliance-2.1.0}/src/modules/logging.py +0 -0
- {gitlab_compliance-2.0.1 → gitlab_compliance-2.1.0}/src/modules/release.py +0 -0
- {gitlab_compliance-2.0.1 → gitlab_compliance-2.1.0}/src/modules/yaml_md_table.py +0 -0
- {gitlab_compliance-2.0.1 → gitlab_compliance-2.1.0}/src/properties/__init__.py +0 -0
- {gitlab_compliance-2.0.1 → gitlab_compliance-2.1.0}/src/properties/workflows.py +0 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 DevOps Contracting Limited trading as Maturity Builder
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: gitlab-compliance
|
|
3
|
+
Version: 2.1.0
|
|
4
|
+
Summary: BDD compliance testing for GitLab CI/CD pipelines and project settings — by MaturityBuilder
|
|
5
|
+
License-Expression: Apache-2.0
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Author: Charlie Smith
|
|
8
|
+
Author-email: me@charlieasmith.co.uk
|
|
9
|
+
Requires-Python: >=3.12
|
|
10
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
11
|
+
Classifier: Environment :: Console
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Intended Audience :: System Administrators
|
|
14
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
20
|
+
Classifier: Topic :: Software Development :: Testing
|
|
21
|
+
Requires-Dist: behave (>=1.2.6,<2.0.0)
|
|
22
|
+
Requires-Dist: click (>=8.1.8,<9.0.0)
|
|
23
|
+
Requires-Dist: idna (==3.18)
|
|
24
|
+
Requires-Dist: jq (==1.12.0)
|
|
25
|
+
Requires-Dist: loguru (==0.7.2)
|
|
26
|
+
Requires-Dist: markdown-analysis (==0.1.5)
|
|
27
|
+
Requires-Dist: oras (==0.2.42)
|
|
28
|
+
Requires-Dist: oyaml
|
|
29
|
+
Requires-Dist: prettytable
|
|
30
|
+
Requires-Dist: pytablewriter (==1.2.1)
|
|
31
|
+
Requires-Dist: python-gitlab (==8.4.0)
|
|
32
|
+
Requires-Dist: pyyaml (==6.0.3)
|
|
33
|
+
Requires-Dist: requests (==2.34.2)
|
|
34
|
+
Requires-Dist: rich (==15.0.0)
|
|
35
|
+
Requires-Dist: semver (==3.0.4)
|
|
36
|
+
Requires-Dist: typer (==0.27.0)
|
|
37
|
+
Requires-Dist: urllib3 (==2.7.0)
|
|
38
|
+
Project-URL: Documentation, https://maturitybuilder.github.io/gitlab-compliance/
|
|
39
|
+
Project-URL: Home Page, https://maturitybuilder.github.io/gitlab-compliance/
|
|
40
|
+
Project-URL: Repository, https://github.com/MaturityBuilder/gitlab-compliance
|
|
41
|
+
Description-Content-Type: text/markdown
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
layout: home
|
|
45
|
+
title: Overview
|
|
46
|
+
permalink: /
|
|
47
|
+
---
|
|
48
|
+
# Gitlab Compliance
|
|
49
|
+
|
|
50
|
+
<img src="https://maturitybuilder.github.io/gitlab-compliance/assets/logo-light.png" align="right" width="350" valign="top" style="max-width:100%; margin-top: 50px; text-align: justify;">
|
|
51
|
+
<div align="left">
|
|
52
|
+
<!-- <a href="https://github.com/gitlab-compliance/cli/actions/workflows/cd.yml">
|
|
53
|
+
<img src="https://github.com/eerkunt/gitlab-compliance/workflows/CD/badge.svg" alt="Build" />
|
|
54
|
+
</a> -->
|
|
55
|
+
<a href="https://hub.docker.com/r/maturitybuilder/gitlab-compliance/">
|
|
56
|
+
<img src="https://img.shields.io/badge/docker-ready-blue.svg?longCache=true&style=flat" alt="docker version is ready" />
|
|
57
|
+
<img alt="Docker Image Version" src="https://img.shields.io/docker/v/maturitybuilder/gitlab-compliance?label=Docker Latest">
|
|
58
|
+
</a>
|
|
59
|
+
<a href="https://pypi.org/project/gitlab-compliance/">
|
|
60
|
+
<!-- <img src="https://maturitybuilder.github.io/gitlab-compliance/assets/logo-light.png" alt="License" /> -->
|
|
61
|
+
</a>
|
|
62
|
+
<a href="https://pypi.org/project/gitlab-compliance/">
|
|
63
|
+
<img src="https://img.shields.io/pypi/v/gitlab-compliance.svg" alt="Package Version" />
|
|
64
|
+
</a>
|
|
65
|
+
</div>
|
|
66
|
+
|
|
67
|
+
<p class="mb-tagline">Gitlab Compliance is a BDD compliance testing and documentation generation toolkit for GitLab CI/CD pipelines and project settings. It runs Gherkin policies against `.gitlab-ci.yml` and optional GitLab API settings. You can also generate markdown documentation for your Gitlab pipelines.</p>
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
Source code - coming soon:
|
|
71
|
+
[MaturityBuilder/gitlab-compliance](https://github.com/MaturityBuilder/gitlab-compliance).
|
|
72
|
+
|
|
73
|
+
## Get started
|
|
74
|
+
[Get started](installation/index.md){ .md-button .md-button-primary }
|
|
75
|
+
[Usage](usage/index.md){ .md-button }
|
|
76
|
+
[BDD grammar](bdd-reference/index.md){ .md-button }
|
|
77
|
+
|
|
78
|
+
`gitlab-compliance` supports two core workflows from the same pipeline YAML:
|
|
79
|
+
|
|
80
|
+
| Workflow | Command | What it does |
|
|
81
|
+
| -------- | ------- | ------------ |
|
|
82
|
+
| **Compliance** | [`check`](usage/reference/check.md) | Run Gherkin policies against `.gitlab-ci.yml` (and optional GitLab API settings) |
|
|
83
|
+
| **Documentation** | [`generate`](usage/reference/generate.md) | Build Markdown, swagger-markdown, or HTML reference docs from `.gitlab-ci.yml` |
|
|
84
|
+
|
|
85
|
+

|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
pip install gitlab-compliance
|
|
89
|
+
|
|
90
|
+
# Validate pipeline configuration against policies
|
|
91
|
+
gitlab-compliance check -f policies/ -p .gitlab-ci.yml
|
|
92
|
+
|
|
93
|
+
# Generate pipeline documentation (filter and group output as needed)
|
|
94
|
+
gitlab-compliance generate -i .gitlab-ci.yml --format swagger-markdown -o pipeline-reference.md
|
|
95
|
+
gitlab-compliance generate -i .gitlab-ci.yml --exclude variables,image --group-by stage
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
See [Usage](usage/index.md) for the full CLI (including demos) and
|
|
99
|
+
[Generate pipeline documentation](usage/reference/generate.md) for output
|
|
100
|
+
formats, `--exclude`, and `--group-by`.
|
|
101
|
+
|
|
102
|
+
- **compliance:** Ensure pipeline YAML and project settings follow your security
|
|
103
|
+
standards and custom policies
|
|
104
|
+
- **behaviour driven development:** Policies are readable Gherkin scenarios that
|
|
105
|
+
developers and security teams share
|
|
106
|
+
- **portable:** Install from `pip`. See [Installation](installation/index.md)
|
|
107
|
+
- **pre-merge:** Validate configuration before changes land on protected
|
|
108
|
+
branches
|
|
109
|
+
- **YAML and API:** Offline checks against pipeline files; optional GitLab API
|
|
110
|
+
checks for project settings and CI variables
|
|
111
|
+
- **easy to integrate:** Run in GitLab CI or local git hooks
|
|
112
|
+
- **segregation of duty:** Keep policy packs in a separate repository or OCI
|
|
113
|
+
registry
|
|
114
|
+
- **documentation:** Generate Markdown or HTML reference docs from
|
|
115
|
+
`.gitlab-ci.yml`
|
|
116
|
+
|
|
117
|
+
## Idea
|
|
118
|
+
|
|
119
|
+
`gitlab-compliance` focuses on [negative
|
|
120
|
+
testing](https://en.wikipedia.org/wiki/Negative_testing) — catching
|
|
121
|
+
misconfigurations and policy violations — rather than proving that a job runs
|
|
122
|
+
successfully end to end.
|
|
123
|
+
|
|
124
|
+
GitLab CI pipelines are defined in YAML that composes jobs, includes, variables,
|
|
125
|
+
and workflow rules. What was missing is a lightweight way to assert that this
|
|
126
|
+
configuration follows organizational standards before merge. GitLab offers
|
|
127
|
+
native compliance features in higher tiers; `gitlab-compliance` provides an
|
|
128
|
+
open, portable alternative inspired by
|
|
129
|
+
[terraform-compliance](https://terraform-compliance.com/) and
|
|
130
|
+
[Conftest](https://www.conftest.dev/).
|
|
131
|
+
|
|
132
|
+
For example, a policy might require that no job uses a floating `latest` image
|
|
133
|
+
tag:
|
|
134
|
+
|
|
135
|
+
```gherkin
|
|
136
|
+
if a job defines an image, it must not use the :latest tag
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
translates into:
|
|
140
|
+
|
|
141
|
+
```gherkin
|
|
142
|
+
Given I have any job defined
|
|
143
|
+
When it has image
|
|
144
|
+
Then its image must not match ":latest$"
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
The `image` value comes from your pipeline YAML:
|
|
148
|
+
|
|
149
|
+
```yaml
|
|
150
|
+
scan:
|
|
151
|
+
image: python:3.12
|
|
152
|
+
build:
|
|
153
|
+
image: docker:latest # violates the policy above
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
In CI, this scenario runs against `.gitlab-ci.yml` (and resolved local includes)
|
|
157
|
+
so merge requests cannot introduce violations.
|
|
158
|
+
|
|
159
|
+
See [Examples](examples/index.md) for more sample use cases.
|
|
160
|
+
|
|
161
|
+
## Supporting / Requirements
|
|
162
|
+
|
|
163
|
+
- **Python:** 3.12 (see [Installing via pip](installation/pip.md))
|
|
164
|
+
- **Pipeline file:** `.gitlab-ci.yml` or another path passed with `-p`
|
|
165
|
+
- **API checks (optional):** GitLab token plus `--project` or `--group` for
|
|
166
|
+
settings and CI variable policies
|
|
167
|
+
|
|
168
|
+
Full CLI options: [Usage](usage/index.md). Step grammar: [BDD
|
|
169
|
+
Reference](bdd-reference/index.md).
|
|
170
|
+
|
|
171
|
+
## How can you support the project?
|
|
172
|
+
|
|
173
|
+
Contributions are welcome — see [Contributing](contributing.md).
|
|
174
|
+
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
---
|
|
2
|
+
layout: home
|
|
3
|
+
title: Overview
|
|
4
|
+
permalink: /
|
|
5
|
+
---
|
|
6
|
+
# Gitlab Compliance
|
|
7
|
+
|
|
8
|
+
<img src="https://maturitybuilder.github.io/gitlab-compliance/assets/logo-light.png" align="right" width="350" valign="top" style="max-width:100%; margin-top: 50px; text-align: justify;">
|
|
9
|
+
<div align="left">
|
|
10
|
+
<!-- <a href="https://github.com/gitlab-compliance/cli/actions/workflows/cd.yml">
|
|
11
|
+
<img src="https://github.com/eerkunt/gitlab-compliance/workflows/CD/badge.svg" alt="Build" />
|
|
12
|
+
</a> -->
|
|
13
|
+
<a href="https://hub.docker.com/r/maturitybuilder/gitlab-compliance/">
|
|
14
|
+
<img src="https://img.shields.io/badge/docker-ready-blue.svg?longCache=true&style=flat" alt="docker version is ready" />
|
|
15
|
+
<img alt="Docker Image Version" src="https://img.shields.io/docker/v/maturitybuilder/gitlab-compliance?label=Docker Latest">
|
|
16
|
+
</a>
|
|
17
|
+
<a href="https://pypi.org/project/gitlab-compliance/">
|
|
18
|
+
<!-- <img src="https://maturitybuilder.github.io/gitlab-compliance/assets/logo-light.png" alt="License" /> -->
|
|
19
|
+
</a>
|
|
20
|
+
<a href="https://pypi.org/project/gitlab-compliance/">
|
|
21
|
+
<img src="https://img.shields.io/pypi/v/gitlab-compliance.svg" alt="Package Version" />
|
|
22
|
+
</a>
|
|
23
|
+
</div>
|
|
24
|
+
|
|
25
|
+
<p class="mb-tagline">Gitlab Compliance is a BDD compliance testing and documentation generation toolkit for GitLab CI/CD pipelines and project settings. It runs Gherkin policies against `.gitlab-ci.yml` and optional GitLab API settings. You can also generate markdown documentation for your Gitlab pipelines.</p>
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
Source code - coming soon:
|
|
29
|
+
[MaturityBuilder/gitlab-compliance](https://github.com/MaturityBuilder/gitlab-compliance).
|
|
30
|
+
|
|
31
|
+
## Get started
|
|
32
|
+
[Get started](installation/index.md){ .md-button .md-button-primary }
|
|
33
|
+
[Usage](usage/index.md){ .md-button }
|
|
34
|
+
[BDD grammar](bdd-reference/index.md){ .md-button }
|
|
35
|
+
|
|
36
|
+
`gitlab-compliance` supports two core workflows from the same pipeline YAML:
|
|
37
|
+
|
|
38
|
+
| Workflow | Command | What it does |
|
|
39
|
+
| -------- | ------- | ------------ |
|
|
40
|
+
| **Compliance** | [`check`](usage/reference/check.md) | Run Gherkin policies against `.gitlab-ci.yml` (and optional GitLab API settings) |
|
|
41
|
+
| **Documentation** | [`generate`](usage/reference/generate.md) | Build Markdown, swagger-markdown, or HTML reference docs from `.gitlab-ci.yml` |
|
|
42
|
+
|
|
43
|
+

|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
pip install gitlab-compliance
|
|
47
|
+
|
|
48
|
+
# Validate pipeline configuration against policies
|
|
49
|
+
gitlab-compliance check -f policies/ -p .gitlab-ci.yml
|
|
50
|
+
|
|
51
|
+
# Generate pipeline documentation (filter and group output as needed)
|
|
52
|
+
gitlab-compliance generate -i .gitlab-ci.yml --format swagger-markdown -o pipeline-reference.md
|
|
53
|
+
gitlab-compliance generate -i .gitlab-ci.yml --exclude variables,image --group-by stage
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
See [Usage](usage/index.md) for the full CLI (including demos) and
|
|
57
|
+
[Generate pipeline documentation](usage/reference/generate.md) for output
|
|
58
|
+
formats, `--exclude`, and `--group-by`.
|
|
59
|
+
|
|
60
|
+
- **compliance:** Ensure pipeline YAML and project settings follow your security
|
|
61
|
+
standards and custom policies
|
|
62
|
+
- **behaviour driven development:** Policies are readable Gherkin scenarios that
|
|
63
|
+
developers and security teams share
|
|
64
|
+
- **portable:** Install from `pip`. See [Installation](installation/index.md)
|
|
65
|
+
- **pre-merge:** Validate configuration before changes land on protected
|
|
66
|
+
branches
|
|
67
|
+
- **YAML and API:** Offline checks against pipeline files; optional GitLab API
|
|
68
|
+
checks for project settings and CI variables
|
|
69
|
+
- **easy to integrate:** Run in GitLab CI or local git hooks
|
|
70
|
+
- **segregation of duty:** Keep policy packs in a separate repository or OCI
|
|
71
|
+
registry
|
|
72
|
+
- **documentation:** Generate Markdown or HTML reference docs from
|
|
73
|
+
`.gitlab-ci.yml`
|
|
74
|
+
|
|
75
|
+
## Idea
|
|
76
|
+
|
|
77
|
+
`gitlab-compliance` focuses on [negative
|
|
78
|
+
testing](https://en.wikipedia.org/wiki/Negative_testing) — catching
|
|
79
|
+
misconfigurations and policy violations — rather than proving that a job runs
|
|
80
|
+
successfully end to end.
|
|
81
|
+
|
|
82
|
+
GitLab CI pipelines are defined in YAML that composes jobs, includes, variables,
|
|
83
|
+
and workflow rules. What was missing is a lightweight way to assert that this
|
|
84
|
+
configuration follows organizational standards before merge. GitLab offers
|
|
85
|
+
native compliance features in higher tiers; `gitlab-compliance` provides an
|
|
86
|
+
open, portable alternative inspired by
|
|
87
|
+
[terraform-compliance](https://terraform-compliance.com/) and
|
|
88
|
+
[Conftest](https://www.conftest.dev/).
|
|
89
|
+
|
|
90
|
+
For example, a policy might require that no job uses a floating `latest` image
|
|
91
|
+
tag:
|
|
92
|
+
|
|
93
|
+
```gherkin
|
|
94
|
+
if a job defines an image, it must not use the :latest tag
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
translates into:
|
|
98
|
+
|
|
99
|
+
```gherkin
|
|
100
|
+
Given I have any job defined
|
|
101
|
+
When it has image
|
|
102
|
+
Then its image must not match ":latest$"
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
The `image` value comes from your pipeline YAML:
|
|
106
|
+
|
|
107
|
+
```yaml
|
|
108
|
+
scan:
|
|
109
|
+
image: python:3.12
|
|
110
|
+
build:
|
|
111
|
+
image: docker:latest # violates the policy above
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
In CI, this scenario runs against `.gitlab-ci.yml` (and resolved local includes)
|
|
115
|
+
so merge requests cannot introduce violations.
|
|
116
|
+
|
|
117
|
+
See [Examples](examples/index.md) for more sample use cases.
|
|
118
|
+
|
|
119
|
+
## Supporting / Requirements
|
|
120
|
+
|
|
121
|
+
- **Python:** 3.12 (see [Installing via pip](installation/pip.md))
|
|
122
|
+
- **Pipeline file:** `.gitlab-ci.yml` or another path passed with `-p`
|
|
123
|
+
- **API checks (optional):** GitLab token plus `--project` or `--group` for
|
|
124
|
+
settings and CI variable policies
|
|
125
|
+
|
|
126
|
+
Full CLI options: [Usage](usage/index.md). Step grammar: [BDD
|
|
127
|
+
Reference](bdd-reference/index.md).
|
|
128
|
+
|
|
129
|
+
## How can you support the project?
|
|
130
|
+
|
|
131
|
+
Contributions are welcome — see [Contributing](contributing.md).
|
|
@@ -1,7 +1,22 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "gitlab-compliance"
|
|
3
|
-
version = "2.0
|
|
3
|
+
version = "2.1.0"
|
|
4
4
|
dynamic = [ "readme" ]
|
|
5
|
+
license = "Apache-2.0"
|
|
6
|
+
requires-python = ">=3.12"
|
|
7
|
+
classifiers = [
|
|
8
|
+
"Development Status :: 5 - Production/Stable",
|
|
9
|
+
"Environment :: Console",
|
|
10
|
+
"Intended Audience :: Developers",
|
|
11
|
+
"Intended Audience :: System Administrators",
|
|
12
|
+
"License :: OSI Approved :: Apache Software License",
|
|
13
|
+
"Operating System :: OS Independent",
|
|
14
|
+
"Programming Language :: Python :: 3",
|
|
15
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
16
|
+
"Programming Language :: Python :: 3.12",
|
|
17
|
+
"Topic :: Software Development :: Quality Assurance",
|
|
18
|
+
"Topic :: Software Development :: Testing",
|
|
19
|
+
]
|
|
5
20
|
[project.urls]
|
|
6
21
|
"Home Page" = "https://maturitybuilder.github.io/gitlab-compliance/"
|
|
7
22
|
DOCUMENTATION = "https://maturitybuilder.github.io/gitlab-compliance/"
|
|
@@ -11,8 +26,9 @@ Repository = "https://github.com/MaturityBuilder/gitlab-compliance"
|
|
|
11
26
|
|
|
12
27
|
[tool.poetry]
|
|
13
28
|
name = "gitlab-compliance"
|
|
14
|
-
description = "
|
|
29
|
+
description = "BDD compliance testing for GitLab CI/CD pipelines and project settings — by MaturityBuilder"
|
|
15
30
|
authors = ["Charlie Smith <me@charlieasmith.co.uk>"]
|
|
31
|
+
license = "Apache-2.0"
|
|
16
32
|
readme = ["docs/index.md"]
|
|
17
33
|
|
|
18
34
|
packages = [{ include = "src" }]
|
|
@@ -22,20 +38,20 @@ packages = [{ include = "src" }]
|
|
|
22
38
|
[tool.poetry.dependencies]
|
|
23
39
|
python = ">=3.12"
|
|
24
40
|
prettytable = "*"
|
|
25
|
-
pytablewriter = "1.2.
|
|
41
|
+
pytablewriter = "1.2.1"
|
|
26
42
|
oyaml = "*"
|
|
27
|
-
typer = "0.
|
|
43
|
+
typer = "0.27.0"
|
|
28
44
|
markdown-analysis = "0.1.5"
|
|
29
45
|
urllib3 = "2.7.0"
|
|
30
|
-
jq = "1.
|
|
46
|
+
jq = "1.12.0"
|
|
31
47
|
click = "^8.1.8"
|
|
32
|
-
semver = "3.0.
|
|
33
|
-
pyyaml = "6.0.
|
|
34
|
-
loguru = "0.7.
|
|
35
|
-
python-gitlab = "
|
|
36
|
-
rich = "
|
|
48
|
+
semver = "3.0.4"
|
|
49
|
+
pyyaml = "6.0.3"
|
|
50
|
+
loguru = "0.7.2"
|
|
51
|
+
python-gitlab = "8.4.0"
|
|
52
|
+
rich = "15.0.0"
|
|
37
53
|
oras = "0.2.42"
|
|
38
|
-
idna = "3.
|
|
54
|
+
idna = "3.18"
|
|
39
55
|
requests = "2.34.2"
|
|
40
56
|
behave = "^1.2.6"
|
|
41
57
|
|
|
@@ -47,7 +63,7 @@ gitlab-compliance = 'src.gitlab_compliance:gitlab_compliance'
|
|
|
47
63
|
setuptools = "83.0.0"
|
|
48
64
|
pytest = "^9.0.3"
|
|
49
65
|
pre-commit = "^4.2.0"
|
|
50
|
-
pyyaml = "^6.0.
|
|
66
|
+
pyyaml = "^6.0.3"
|
|
51
67
|
coverage = "^7.9.2"
|
|
52
68
|
|
|
53
69
|
[tool.black]
|
|
@@ -61,7 +77,7 @@ max-line-length = 88
|
|
|
61
77
|
extend-ignore = ["E203", "W503"]
|
|
62
78
|
|
|
63
79
|
[tool.poetry.group.docs.dependencies]
|
|
64
|
-
zensical = "^0.0.
|
|
80
|
+
zensical = "^0.0.51"
|
|
65
81
|
[build-system]
|
|
66
82
|
requires = ["poetry-core","setuptools","poetry-bumpversion","id"]
|
|
67
83
|
build-backend = "poetry.core.masonry.api"
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"""Detect which API-backed enrichment steps a policy pack requires."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import os
|
|
6
|
+
from dataclasses import dataclass
|
|
7
|
+
|
|
8
|
+
from src.compliance.metadata import iter_feature_files
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@dataclass
|
|
12
|
+
class ApiEnrichmentRequirements:
|
|
13
|
+
enrich_includes: bool = False
|
|
14
|
+
enrich_images: bool = False
|
|
15
|
+
load_api_entities: bool = False
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
INCLUDE_MARKERS = (
|
|
19
|
+
"include with release metadata",
|
|
20
|
+
"newer release",
|
|
21
|
+
"within the latest",
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
IMAGE_MARKERS = (
|
|
25
|
+
"container image with release metadata",
|
|
26
|
+
"registry latest",
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
API_ENTITY_MARKERS = (
|
|
30
|
+
"project setting",
|
|
31
|
+
"project ci variable",
|
|
32
|
+
"group setting",
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def update_requirements_from_text(
|
|
37
|
+
text: str, reqs: ApiEnrichmentRequirements
|
|
38
|
+
) -> ApiEnrichmentRequirements:
|
|
39
|
+
"""Update enrichment requirements from one feature file's text."""
|
|
40
|
+
lowered = text.lower()
|
|
41
|
+
if not reqs.enrich_includes:
|
|
42
|
+
reqs.enrich_includes = any(marker in lowered for marker in INCLUDE_MARKERS)
|
|
43
|
+
if not reqs.enrich_images:
|
|
44
|
+
reqs.enrich_images = any(marker in lowered for marker in IMAGE_MARKERS)
|
|
45
|
+
if not reqs.load_api_entities:
|
|
46
|
+
reqs.load_api_entities = any(marker in lowered for marker in API_ENTITY_MARKERS)
|
|
47
|
+
return reqs
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def policies_require_api_enrichment(
|
|
51
|
+
features_dirs: str | list[str],
|
|
52
|
+
) -> ApiEnrichmentRequirements:
|
|
53
|
+
reqs = ApiEnrichmentRequirements()
|
|
54
|
+
directories = [features_dirs] if isinstance(features_dirs, str) else features_dirs
|
|
55
|
+
|
|
56
|
+
for features_dir in directories:
|
|
57
|
+
if not os.path.isdir(features_dir):
|
|
58
|
+
continue
|
|
59
|
+
for feature_path in iter_feature_files(features_dir):
|
|
60
|
+
with open(feature_path, encoding="utf-8") as handle:
|
|
61
|
+
update_requirements_from_text(handle.read(), reqs)
|
|
62
|
+
if reqs.enrich_includes and reqs.enrich_images and reqs.load_api_entities:
|
|
63
|
+
return reqs
|
|
64
|
+
|
|
65
|
+
return reqs
|