[Open Source] A Jenkins pipeline simplification and automation framework designed for the Chinese developer ecosystem

Open SourceProcess Management
2026-06-28 05:20 3 次浏览 • 0 次下载 0KB
[Open Source] A Jenkins pipeline simplification and automation framework designed for the Chinese developer ecosystem

1. Project Overview

ManCI is a Jenkins pipeline automation framework specifically designed for the Chinese developer community. It aims to address current CI challenges by adopting GitHub's CI workflow best practices and providing seamless integration with Gitee, a widely used code hosting platform in China, through a Jenkins library. It offers domestic development teams a convenient, efficient, and localized CI solution.

2. Open Source License

Licensed under Apache-2.0

3. Screenshots

Demo Preview

Image

4. Feature Overview

Current State and Pain Points of CI in China

Currently, CI processes in China are still developing and generally face the following problems:

  1. Tool Limitations: Although Jenkins is widely used, it is often treated merely as a basic build tool, lacking deep integration and intelligent management of CI workflows.

  2. Heavy Reliance on Manual Intervention: Many teams still depend heavily on manual triggering and monitoring during CI processes. Low automation leads to inefficiency and a higher risk of errors.

  3. Poor Platform Integration: Existing CI tools often lack deep integration with commonly used domestic code hosting platforms such as Gitee, making real-time feedback and interaction on PR pages difficult. Although Gitee has integrated its own Gitee Go platform, it still feels somewhat limited, mainly due to insufficient flexibility.

ManCI's Value and Advantages

To address these pain points, ManCI is provided as a Jenkins library, designed to offer:

Automation-Driven CI Workflows

  • Intelligent Triggers: ManCI automatically responds to key events in the Pull Request (PR) lifecycle (such as opening, updating, merging, closing, commenting, passing tests, and approval). It launches corresponding code checks, builds, tests, and other tasks without manual intervention.

  • Dynamic Execution: Dynamically determines which CI stages should run based on factors such as PR status, code change scope, and environment variables, avoiding unnecessary or excessive build operations.

Deep Integration with Gitee PR Pages

  • Real-Time Feedback: ManCI can display CI tables directly on Gitee PR pages, clearly listing the execution status, duration, trigger reason, and other details for each stage. Team members can view the complete build progress without leaving the PR interface.

  • Interactive Operations: Supports triggering specific stage reruns and passing custom parameters through PR comments. Developers can interact directly with CI workflows on the PR page, improving collaboration efficiency.

  • Automatic Label and Comment Management: Automatically adds labels to PRs based on CI results (such as "ci-success" and "ci-failure") and displays build results in clear tables under PRs. This ensures timely feedback for team members and facilitates code reviews and merge decisions. In addition, Gitee's minimum tester feature can be used to configure quality gates. When CI succeeds, the PR is marked as passed testing; otherwise, code merging is blocked.

5. Tech Stack

Quick start

Installation and Configuration

1. Install the Jenkins Gitee Plugin: Search for Gitee Plugin in Jenkins Plugin Manager and install it.

Image

2. Install ManCI: Go to Jenkins System Management, open Global Pipeline Libraries, add the ManCI library, and configure the relevant parameters.

Image

3. Configure the Gitee API: Add a private Gitee API token in Jenkins configuration to ensure that ManCI can access Gitee services. Visit the Gitee API and apply for a private token. In Jenkins Credentials Management, add a credential of type secret text and enter your Gitee API private token. Record the credential ID.

4. Configure Gitee Repository Credentials: In Jenkins configuration, add a Git SSH key to ensure ManCI can pull the source code. Generate an SSH public/private key pair. Add the public key under Gitee Personal Settings -> SSH Public Keys. Configure the corresponding private key in Jenkins and record the credential ID.

5. Create a New Job: Create a Pipeline project and configure it as shown below.

Image

Usage Examples

Add a Jenkinsfile to your project. An example is shown below:

// Jenkinsfile
@Library('manci')_

manci = new ManCI(this, "debug") // The log level can be configured; defaults to info

// Define parameters. These parameters will appear on the Jenkins parameterized build page and will also be displayed below the CI table.
manci.parameters = [
        [defaultValue: "ManCI V1", description: 'CI name, displayed in the status table', name: 'CIName', type: 'string'],
        [choices: ['main', 'develop'], description: 'Select the branch to deploy', name: 'BRANCH_NAME', type: 'choice']
]

// Define the SSH key used to pull code from the Git repository. This credential must exist in Jenkins Credentials and be of type SSH Username with private key.
manci.SSH_SECRET_KEY = "xxxxxx"

// Define the Gitee access token used to access Gitee API endpoints. This credential must exist in Jenkins Credentials and be of type Secret Text.
manci.GITEE_ACCESS_TOKEN_KEY = 'xxxxxx'

manci.withRun(){
    // Stages within the same group execute sequentially, while different groups execute concurrently
    manci.stage("init", [group: "setup", trigger: ["pr_note", "pr_open"], mark: "[Access URL](#)" ]){
        echo "Stages in the setup group will execute first"
    }

    manci.stage("pr_note", [group: "group1", trigger: ["pr_note"], fileMatches: "'.*'", mark: "[Access URL](#)" ]){
        sh 'sleep 1'
    }
    manci.stage("pr_merge", [group: "group2", trigger: ["pr_merge", "pr_note"], fileMatches: "'Jenkinsfile.groovy'", mark: "[Access URL](#)"]){
        sh 'sleep 1'
    }
    manci.stage("pr_push", [group: "group3", trigger: ["pr_push", "pr_note"], fileMatches: "'.*'"]){
        sh 'sleep 1'
    }
    manci.stage("env_match", [group: "group3", trigger: ["env_match"],envMatches: [role: "and", condition: ["BRANCH_NAME": "main"]]]){
        sh 'sleep 1'
    }
    manci.stage("pr_close", [group: "group3", trigger: ["pr_close"]]){
        sh 'sleep 1'
    }
    manci.stage("pr_tested", [group: "group1", trigger: ["pr_tested"]]){
        sh 'sleep 1'
    }
    manci.stage("pr_approved", [group: "group2", trigger: ["pr_approved"]]){
        sh 'sleep 1'
    }
    manci.stage("pr_open", [group: "group3", trigger: ["pr_open"]]){
        sh 'sleep 1'
    }
    manci.stage("always", [group: "group4", trigger: ["always"]]){
        sh 'sleep 1'
        echo "Stages in the always group will always execute"
    }
    manci.stage("clean", [group: "teardown", trigger: ["pr_merge"], fileMatches: "'.*'"]){
        echo "Stages in the teardown group will execute last"
    }
}
#1
资源直链https://gitee.com/guojongg/manci
去下载
星河码客

发现和分享优质开源项目,传承互联网精神,为开发者服务。

关于本站

联系我们

微信/广告合作:ITcloub (备注星河码客)

免责声明:本站资源版权归原作者所有,仅供学习与交流。如有侵权,请通过「关于我们 - 侵权投诉」联系删除。

Powered by Nuxt · Deployed on Cloudflare