= Gitlab - Ci - Templates
// #########################################################################
// Die folgende Zeile NICHT ändern. Keine Leerzeilen einfügen!
// Hier fügt das eXXcellent-documentation-tool Metadaten zur Build-Zeit ein
// #########################################################################
###exxcellent_base_template_placeholder###
// ##########################################################################
// Hinter :imagesdir: den relavtiven Pfad zu dem Ordner angeben, an dem alle Images der *.adoc files liegen.
// Am besten den vorgegebenen Ordner 'images' einfach so lassen und verwenden.
// ##########################################################################
ifndef::imagesdir[]
:imagesdir: images
endif::[]
// ##########################################################################
// Bei Bedarf anpassen
// Dokumentenklassifizierung = Öffentlich, Intern, Vertraulich, Streng vertraulich
// ##########################################################################
:revnumber: 1.0
:classification: Intern
:author: Marcel Feix <marcel.feix@exxcellent.de>

This Repository contains all CI Templates maintained by the CI-Gilde.
It also provides templates for simpler integration of CI-Gilde Tools.

// ###########################################################################
// Das Inhaltsverzeichnis ist nur im generierten HTML/PDF sichtbar (immer an erster Stelle, technisch bedingt)
// ###########################################################################
toc::[]

// ###########################################################################
// Attribut leveloffset addiert die gegebene Zahl zu den Überschriften im Dokument
// Alle Überschriften erscheinen also eine Ebene tiefer
// ###########################################################################
== General Information

include::generalInformation.adoc[leveloffset=1]
include::chapters/templates/common/common-ci-variablen.adoc[leveloffset=1]
include::chapters/templates/common/common-ci-workflow.adoc[leveloffset=1]

== Contribution

include::contribution.adoc[leveloffset=1]

== Deployment - IaC

Our collection of Infrastructure as Code (IaC) Templates.
For Terraform Template please use the https://docs.gitlab.com/ee/user/infrastructure/iac/[official Templates] provided by Gitlab.

include::chapters/templates/IaC/ansible.adoc[leveloffset=2]
include::chapters/templates/IaC/docker-compose.adoc[leveloffset=2]
include::chapters/templates/IaC/ssh-transfer-data.adoc[leveloffset=2]

== Container Templates

We have optimised building container within our templates a lot.
We found divide building and releasing containers into different jobs to be the fastest way to build container artifacts.
Because you can build your container while executing other verify stages.
Publishing containers is a very cheap operation.

The following graph charts shows through which stages containers will go and which artifacts will be passed between stages.
[mermaid]

....
flowchart LR

    subgraph Build Stage
    build_src(Source Code Build) -- Needs Source artifacts --> build_c
    build_c(Container-Build)
    end

    subgraph Verify Stage
    build_c -- image.tar --> cve(Scan CVEs)
    end

    subgraph Release Stage
    cve -- image.tar / Scanned --> Publish
    end
    Publish -- image --> Registry
....

include::chapters/templates/container/container-build.adoc[leveloffset=2]
include::chapters/templates/container/container-publish.adoc[leveloffset=2]
include::chapters/templates/container/container-scan.adoc[leveloffset=2]
include::chapters/templates/container/docker-in-docker.adoc[leveloffset=2]

== Releasing Templates

The following templates provide a simpler integration into the https://gitlab.exxcellent.de/gilden/ci/exxcellent-increase-version-tool[Increase-Version-Tool] of the CI-Gilde.
We also provide finished pipelines in our <<_pipelines>> section.
We highly recommend using those pipelines since this is our reference implementation.

include::chapters/templates/releasing/push-tag-and-version-template.adoc[leveloffset=3]
include::chapters/templates/releasing/set-version-template.adoc[leveloffset=3]
include::chapters/templates/releasing/release-template.adoc[leveloffset=3]
include::chapters/templates/releasing/release-gitlab-template.adoc[leveloffset=3]
include::chapters/templates/releasing/mail-template.adoc[leveloffset=3]

== NPM Templates

Our collection of NPM Templates.

include::chapters/templates/npm/npm-dependencies-template.adoc[leveloffset=2]
include::chapters/templates/npm/npm-build-template.adoc[leveloffset=2]
include::chapters/templates/npm/npm-lint-template.adoc[leveloffset=2]
include::chapters/templates/npm/npm-test-template.adoc[leveloffset=2]

== Maven Templates

Our collection of Maven Templates.

include::chapters/templates/java/maven/maven-dependencies-template.adoc[leveloffset=2]
include::chapters/templates/java/maven/maven-build-template.adoc[leveloffset=2]
include::chapters/templates/java/maven/maven-verify-template.adoc[leveloffset=2]
include::chapters/templates/java/maven/maven-db-diff-template.adoc[leveloffset=2]

== Gradle Templates

Our collection of Gradle Templates.
Currently, we start our templates from the gradle wrapper within your project.
If you do not have a wrapper you can create on with the command `gradle wrapper`.
Please keep in mind updating the wrapper from time to time.
We recommend using https://www.exxcellent.de/confluence/x/S4WCC[Renovate] for this task.

include::chapters/templates/java/gradle/gradle-build-template.adoc[leveloffset=2]
include::chapters/templates/java/gradle/gradle-test-template.adoc[leveloffset=2]
include::chapters/templates/java/gradle/gradle-db-diff-template.adoc[leveloffset=2]

== Static Analysis

With the following collection we provide static code and artifact analysis tools.

include::chapters/templates/static-analysis/repo-cve-scan.adoc[leveloffset=2]
include::chapters/templates/static-analysis/sonar-7.adoc[leveloffset=2]
include::chapters/templates/static-analysis/sonar-8.adoc[leveloffset=2]

== Documentation

This collection provides templates to simplify your documentation process.

include::chapters/templates/documentation/documentation.adoc[leveloffset=2]

== Licensing

This collection provides templates to simplify your licencing process.

include::chapters/templates/license/license.gitlab-ci.adoc[leveloffset=2]
include::chapters/templates/java/gradle/gradle-license.gitlab-ci.adoc[leveloffset=2]
include::chapters/templates/java/maven/maven-license.gitlab-ci.adoc[leveloffset=2]

[#_pipelines]
== Pipelines

include::chapters/pipelines/eXXcellent-release.adoc[leveloffset=3]
