# ggingggang/jenkins-shared-library architecture

> Architecture diagram of the GitHub repository ggingggang/jenkins-shared-library, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ggingggang/jenkins-shared-library
- Repository: https://github.com/ggingggang/jenkins-shared-library

## Overview

This Jenkins Global Pipeline Library lets an application Jenkinsfile call `ci(service: ...)` to run a centrally governed pipeline: test, build and push, scan, optionally sign, then bump the GitOps manifest. `services.yaml` owns service and policy configuration; the shared steps implement the work. The README also documents failure alerts and Trivy HTML reporting. Source excerpts were unavailable, so relationships below rely on README statements only.

Main entry points: [`vars/ci.groovy`](https://github.com/ggingggang/jenkins-shared-library/blob/main/vars/ci.groovy) (CI pipeline), [`vars/kanikoBuild.groovy`](https://github.com/ggingggang/jenkins-shared-library/blob/main/vars/kanikoBuild.groovy) (Kaniko build), [`vars/trivyImageScan.groovy`](https://github.com/ggingggang/jenkins-shared-library/blob/main/vars/trivyImageScan.groovy) (Trivy scan), [`vars/cosignSign.groovy`](https://github.com/ggingggang/jenkins-shared-library/blob/main/vars/cosignSign.groovy) (Cosign signing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Pipeline entry"]
  node_ci["CI pipeline<br/>[ci.groovy]"]
end

subgraph group_stages["Pipeline stages"]
  node_test["Test gate<br/>[ci.groovy]"]
  node_build["Kaniko build<br/>[kanikoBuild.groovy]"]
  node_scan["Trivy scan"]
  node_sign["Cosign signing<br/>[cosignSign.groovy]"]
  node_bump["GitOps bump<br/>[deployBump.groovy]"]
end

subgraph group_config["Policy and reports"]
  node_settings["Service settings<br/>[services.yaml]"]
  node_template["HTML template<br/>[html.tpl]"]
  node_digest["Image digest"]
end

subgraph group_integrations["External systems"]
  node_ghcr[("GHCR")]
  node_gitops[("GitOps repository")]
  node_alertmanager["Alertmanager"]
end

node_app(("App Jenkinsfile"))
node_apprepo(("Application repository"))

node_app -->|"invokes"| node_ci
node_ci -->|"reads policy"| node_settings
node_ci -->|"runs first"| node_test
node_ci -->|"runs next"| node_build
node_ci -->|"runs next"| node_scan
node_ci -->|"runs conditionally"| node_sign
node_ci -->|"runs last"| node_bump
node_apprepo -->|"provides code"| node_test
node_build -->|"pushes image"| node_ghcr
node_build -->|"writes digest"| node_digest
node_sign -->|"reads digest"| node_digest
node_sign -->|"stores signature"| node_ghcr
node_scan -->|"renders report"| node_template
node_scan -->|"scans image"| node_ghcr
node_bump -->|"pushes tag"| node_gitops
node_ci -->|"sends failure alert"| node_alertmanager

click node_ci "https://github.com/ggingggang/jenkins-shared-library/blob/main/vars/ci.groovy"
click node_test "https://github.com/ggingggang/jenkins-shared-library/blob/main/vars/ci.groovy"
click node_build "https://github.com/ggingggang/jenkins-shared-library/blob/main/vars/kanikoBuild.groovy"
click node_scan "https://github.com/ggingggang/jenkins-shared-library/blob/main/vars/trivyImageScan.groovy"
click node_sign "https://github.com/ggingggang/jenkins-shared-library/blob/main/vars/cosignSign.groovy"
click node_bump "https://github.com/ggingggang/jenkins-shared-library/blob/main/vars/deployBump.groovy"
click node_settings "https://github.com/ggingggang/jenkins-shared-library/blob/main/resources/ci/services.yaml"
click node_template "https://github.com/ggingggang/jenkins-shared-library/blob/main/resources/trivy/html.tpl"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_ci toneBlue
class node_test,node_build,node_scan,node_sign,node_bump toneAmber
class node_settings,node_template,node_digest toneMint
class node_ghcr,node_gitops,node_alertmanager toneRose
class node_app,node_apprepo toneIndigo
```

## Components

### Pipeline entry

- [CI pipeline](https://github.com/ggingggang/jenkins-shared-library/blob/main/vars/ci.groovy): `vars/ci.groovy`

### Pipeline stages

- [Test gate](https://github.com/ggingggang/jenkins-shared-library/blob/main/vars/ci.groovy): `vars/ci.groovy`
- [Kaniko build](https://github.com/ggingggang/jenkins-shared-library/blob/main/vars/kanikoBuild.groovy): `vars/kanikoBuild.groovy`
- [Trivy scan](https://github.com/ggingggang/jenkins-shared-library/blob/main/vars/trivyImageScan.groovy): `vars/trivyImageScan.groovy`
- [Cosign signing](https://github.com/ggingggang/jenkins-shared-library/blob/main/vars/cosignSign.groovy): `vars/cosignSign.groovy`
- [GitOps bump](https://github.com/ggingggang/jenkins-shared-library/blob/main/vars/deployBump.groovy): `vars/deployBump.groovy`

### Policy and reports

- [Service settings](https://github.com/ggingggang/jenkins-shared-library/blob/main/resources/ci/services.yaml): `resources/ci/services.yaml`
- [HTML template](https://github.com/ggingggang/jenkins-shared-library/blob/main/resources/trivy/html.tpl): `resources/trivy/html.tpl`
- **Image digest**

### External systems

- **GHCR**
- **GitOps repository**
- **Alertmanager**

### Other components

- **App Jenkinsfile**
- **Application repository**

## Connections

- App Jenkinsfile → CI pipeline: invokes (evidence: `README.md`)
- CI pipeline → Service settings: reads policy (evidence: `README.md`)
- CI pipeline → Test gate: runs first (evidence: `README.md`)
- CI pipeline → Kaniko build: runs next (evidence: `README.md`)
- CI pipeline → Trivy scan: runs next (evidence: `README.md`)
- CI pipeline → Cosign signing: runs conditionally (evidence: `README.md`)
- CI pipeline → GitOps bump: runs last (evidence: `README.md`)
- Application repository → Test gate: provides code (evidence: `README.md`)
- Kaniko build → GHCR: pushes image (evidence: `README.md`)
- Kaniko build → Image digest: writes digest (evidence: `README.md`)
- Cosign signing → Image digest: reads digest (evidence: `README.md`)
- Cosign signing → GHCR: stores signature (evidence: `README.md`)
- Trivy scan → HTML template: renders report (evidence: `README.md`)
- Trivy scan → GHCR: scans image (evidence: `README.md`)
- GitOps bump → GitOps repository: pushes tag (evidence: `README.md`)
- CI pipeline → Alertmanager: sends failure alert (evidence: `README.md`)
