This release is a pre-release and may not be stable for production use.
Motivation
Let's assume the design when we want to trigger a pipeline from web UI or by an API call. The pipeline consumes variables as input. It would be very helpful to know the type of a variable or its valid options. This kind of information is usually part of the documentation. This package provides functionality to automate the creation of this documentation.
Overview
The output of this script is simple description (documentation) of workflow section. It parses workflow section and inserts it to readme file. Currently, output documentation is only as html table.
Properties of variables are defined in comment using the format described in following section.
Variable definition
As mentioned before, we write all parameters of a variable to a comment. Format of a comment is very simple.
- first part describes if variable is required on input. By default a variable is considered as optional. To "set" is as required, put required to the comment - # required
- second part descibes variable's type or valid options.
- type - starts with colon. Typename can be whatever made up. :type
- choices - dev|test
These parts are separated by space. Type and choices must not by combined.
Example
ENV: dev # required dev|test|prod
ACCOUNT_ALIAS: null # required :str
IMAGE_TAG: 0.1.0 # :version
Pipeline name
Using of the pipeline name improves readability of pipeline runs and also describes the task executed by the pipeline.
Variable PIPELINE_NAME is showed in the separated column of the table.
Usage
The tool can be used from command line or imported as module in a code. Output is written to the readme file.
Insert to the Readme
By default, the script inserts generated table in the beggining of the file. However, it is possible to mark position in the file where the table will be inserted. The mark token is
<!--PIPELINE_DOCS-->
If token is present, the table is insreted below it.
Command line
The package gitlabcidocs consumes following arguments:
- --ci-file [optional]
- Path to the file containing workflow section.
- Default value is .gitlab-ci.yml
- --doc-file [optional]
- Path to the output file.
- Default value is README.md
- --include-all-rules, -a [optional]
- If set to *true*, all rules in the workflow section are included. Otherwise only rules which includes $CI_PIPELINE_SOURCE==web|api|pipeline in the if statement are documented.
- Default is true
- --include-global-vars, -g [optional]
- If set, global variables section is included.
- Default value is false
python -m gitlabcidocs --ci-file my_workflow.yml --doc-file myREADME.md
Import in code
The module gitlab-ci-docs contains create_docs function. The functions consumes the same arguments as cli tool, but there are no default values set.
import gitlabcidocs
def run_create_docs():
docs = gitlabcidocs.create_docs(
ci_file_path='my_workflow.yml',
docs_file_path='README.md'
)
Metadata
Release files for gitlab-ci-docs 0.1.0b3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| gitlab_ci_docs-0.1.0b3.tar.gz | 7.4 kB | Without provenance | Details for gitlab_ci_docs-0.1.0b3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| gitlab_ci_docs-0.1.0b3-py3-none-any.whl | Python 3 | none | any | Details for gitlab_ci_docs-0.1.0b3-py3-none-any.whl |
Total release size: 17.0 kB
Release files / gitlab_ci_docs-0.1.0b3.tar.gz
| Download URL | gitlab_ci_docs-0.1.0b3.tar.gz |
|---|---|
| Size | 7.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
16589a15a4d939675cfbce87b32231a451bc642c54dafcf4273158c005dd7c46
|
|
BLAKE2b-256 checksum How to use checksums |
cb4efa6ee71b818ae3fa857a8e088caed19acd175655afebfa58f7897805e612
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.5
|
Release files / gitlab_ci_docs-0.1.0b3-py3-none-any.whl
| Download URL | gitlab_ci_docs-0.1.0b3-py3-none-any.whl |
|---|---|
| Size | 9.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
15f7a4f9ace8d44c262a0de710301846ffd1ebdcd899e581cbcf653098f5b865
|
|
BLAKE2b-256 checksum How to use checksums |
82ad449b51a36e32910c8b639c4b6a3f1baf8e204923df5c9fbd23b762aeacad
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.5
|
Security for gitlab-ci-docs 0.1.0b3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.