= license-template

This template provides a service to collect, validate and publish generated license information for a project. For more details: https://gitlab.exxcellent.de/gilden/ci/exxcellent-license-tools[Gilde CI/CD: exxcellent-license-tool].

TIP: The license tool needs a _bom.json_ file which is generated in a previous stage. This is generally done as a part of the build stage (p.ex. by adding cyclonedxBom to the gradle build) and then providing the generated bom.json with artifacts. Again, see https://gitlab.exxcellent.de/gilden/ci/exxcellent-license-tools[Gilde CI/CD: exxcellent-license-tool] for more infos

The following use cases are possible:

__Generate Asciidoc for all licenses:__

- Set BOM_FILE (source)
- Set LICENSE_ADOC_FILE (target)

__Validate licenses and generate Asciidoc file:__

- Set BOM_FILE (source)
- Set LICENSE_ADOC_FILE (target)
- Set INVALID_LICENSE_ADOC_FILE (target)
- Set ALLOWED_LICENSES

.Variables
|===
|Name |Description | Default Value
|BOM_FILE | the path to the bom file (provided in artifacts from previous stage)|bom.json
|ALLOWED_LICENSES | path to the text file with line separated list of allowed licenses |valid-licenses.txt
|LICENSE_ADOC_FILE | path to the generated adoc file with all licenses |licenses.adoc
|INVALID_LICENSE_ADOC_FILE | path to the generated adoc file with invalid licenses |invalid-licenses.adoc
|NUMBER_OF_ALLOWED_FAILURES | number of allowed invalid licenses |0
|===

:template: license/license.gitlab-ci.yml
include::../../../template-printer.adoc[]