# jenkins-infra/pipeline-library architecture

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

- Interactive diagram: https://gitdiagram.com/jenkins-infra/pipeline-library
- Repository: https://github.com/jenkins-infra/pipeline-library

## Overview

##### Main Components

a. Core Library Components:
- Pipeline Steps Module (represented by /vars directory)
- Infrastructure Configuration (src/io/jenkins/infra)
- Test Framework (test/groovy directory)

b. External Integration Points:
- Jenkins CI/CD Server
- Docker Registry
- Maven Repository
- GitHub
- Azure/AWS/DigitalOcean (for agents)

**┌─────────────────────────────────────────────────────────┐**
- Jenkins CI Server                       │
- ┬─────────────────────────────────────┘

**┌───────────────────▼─────────────────────────────────────┐**
- Pipeline Library Core                        │
- ┬─────────────────┬────────────────────┤
- Build Steps    │  Infrastructure │    Test Framework   │
- (vars/*.groovy)│  Configuration  │  (test/groovy)     │
- ┬───────┴────────┬────────┴────────────────────┘

**┌─────────▼────────┐    ┌─▼──────────────────────────────┐**
- Build Pipeline   │    │     Infrastructure Pipeline     │
- Components       │    │     Components                  │
- ┬────────┘    └───────────┬────────────────────┘

**┌─────────▼─────────────────────────▼────────────────────┐**
- External Services                         │
- ┬───────────────┬────────────────┬────────┤
- Docker      │    Maven      │    GitHub      │  Cloud  │
- Registry    │  Repository   │               │ Providers│
- ┴───────────────┴────────────────┴────────┘

##### Component Relationships

- Data flow between components
- Dependencies
- Integration points
- Build/deployment flows

##### Implementation Details

- Keep components clearly separated
- Annotations for important configurations
- Version control integration points

##### Documentation Integration

References to:
- Configuration files (Jenkinsfile examples)
- Build parameters
- Security contexts (trusted vs. untrusted environments)

Remember to include:
- Version management flows
- Security boundaries
- Platform-specific configurations (Windows/Linux)
- Integration with Jenkins core functionality

This will provide a comprehensive view of how the pipeline library integrates with and supports the Jenkins infrastructure ecosystem.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph JenkinsServer["Jenkins CI Server"]
        JenkinsCore["Jenkins Core"]
    end

    subgraph LibraryCore["Pipeline Library Core"]
        direction TB
        subgraph BuildSteps["Build Steps"]
            direction TB
            BuildPlugin["Build Plugin Steps"]:::steps
            GradleSteps["Gradle Build Steps"]:::steps
            DockerSteps["Docker Build Steps"]:::steps
            InfraSteps["Infrastructure Steps"]:::steps
            TerraformSteps["Terraform Steps"]:::steps
        end

        subgraph InfraConfig["Infrastructure Configuration"]
            direction TB
            MainConfig["Main Config"]:::config
            DockerRes["Docker Resources"]:::config
            DockerMake["Docker Makefile"]:::config
            DockerBake["Docker Bakefile"]:::config
        end

        subgraph TestFW["Test Framework"]
            direction TB
            BaseTest["Base Testing"]:::test
            MockObj["Mock Objects"]:::test
            BuildTests["Build Tests"]:::test
            DockerTests["Docker Tests"]:::test
            InfraTests["Infrastructure Tests"]:::test
        end
    end

    subgraph BuildPipeline["Build Pipeline Components"]
        direction TB
        PluginBuild["Plugin Building"]:::pipeline
        DockerOps["Docker Operations"]:::pipeline
        Benchmark["Benchmarking"]:::pipeline
        DeployRecord["Deployment Recording"]:::pipeline
        ReportPub["Report Publishing"]:::pipeline
    end

    subgraph ExternalServices["External Services"]
        direction TB
        Docker["Docker Registry"]:::external
        Maven["Maven Repository"]:::external
        GitHub["GitHub"]:::external
        Cloud["Cloud Providers"]:::external
    end

    %% Relationships
    JenkinsServer --> LibraryCore
    BuildSteps --> BuildPipeline
    InfraConfig --> BuildPipeline
    BuildPipeline --> ExternalServices
    TestFW --> BuildSteps
    TestFW --> InfraConfig

    %% Click Events
    click BuildPlugin "https://github.com/jenkins-infra/pipeline-library/blob/master//vars/buildPlugin.groovy"
    click GradleSteps "https://github.com/jenkins-infra/pipeline-library/blob/master//vars/buildPluginWithGradle.groovy"
    click DockerSteps "https://github.com/jenkins-infra/pipeline-library/blob/master//vars/buildDockerAndPublishImage.groovy"
    click InfraSteps "https://github.com/jenkins-infra/pipeline-library/blob/master//vars/infra.groovy"
    click TerraformSteps "https://github.com/jenkins-infra/pipeline-library/blob/master//vars/terraform.groovy"
    click MainConfig "https://github.com/jenkins-infra/pipeline-library/blob/master//src/io/jenkins/infra/InfraConfig.groovy"
    click DockerRes "https://github.com/jenkins-infra/pipeline-library/tree/master//resources/io/jenkins/infra/docker/"
    click DockerMake "https://github.com/jenkins-infra/pipeline-library/tree/master//resources/io/jenkins/infra/docker/Makefile"
    click DockerBake "https://github.com/jenkins-infra/pipeline-library/blob/master//resources/io/jenkins/infra/docker/jenkinsinfrabakefile.hcl"
    click BaseTest "https://github.com/jenkins-infra/pipeline-library/blob/master//test/groovy/BaseTest.groovy"
    click MockObj "https://github.com/jenkins-infra/pipeline-library/tree/master//test/groovy/mock/"
    click BuildTests "https://github.com/jenkins-infra/pipeline-library/blob/master//test/groovy/BuildPluginStepTests.groovy"
    click DockerTests "https://github.com/jenkins-infra/pipeline-library/blob/master//test/groovy/BuildDockerAndPublishImageStepTests.groovy"
    click InfraTests "https://github.com/jenkins-infra/pipeline-library/blob/master//test/groovy/InfraStepTests.groovy"
    click PluginBuild "https://github.com/jenkins-infra/pipeline-library/blob/master//vars/buildPlugin.groovy"
    click DockerOps "https://github.com/jenkins-infra/pipeline-library/blob/master//vars/buildDockerAndPublishImage.groovy"
    click Benchmark "https://github.com/jenkins-infra/pipeline-library/blob/master//vars/runBenchmarks.groovy"
    click DeployRecord "https://github.com/jenkins-infra/pipeline-library/blob/master//vars/recordDeployment.groovy"
    click ReportPub "https://github.com/jenkins-infra/pipeline-library/blob/master//vars/publishReports.groovy"

    %% Styling
    classDef steps fill:#90EE90,stroke:#333,stroke-width:2px
    classDef config fill:#87CEEB,stroke:#333,stroke-width:2px
    classDef test fill:#DDA0DD,stroke:#333,stroke-width:2px
    classDef pipeline fill:#FFB6C1,stroke:#333,stroke-width:2px
    classDef external fill:#FFA07A,stroke:#333,stroke-width:2px
```
