Multibranch Pipeline support for GitLab SCM

Goal: Add Multibranch Pipeline support for GitLab SCM private and SaaS instances so that Jenkins can automatically build branches and pull requests with Jenkinsfile

Status: Completed

Team

Details

Currently GitLab Plugin does not support Multibranch Pipeline jobs. The underlying API does not implement calls to fetch Merge Requests during builds. Other problems with this plugin is doesn’t follow conventional SCM plugin design, doesn’t support folder org, doesn’t have separate api plugin etc. So this project is about solving issues with the GitLab Jenkins Integration by improving the current GitLab Plugin and creating separate plugins for GitLab Api and GitLab Branch Source. One stretch goal is to add GitLab Pipeline support for Blueocean.

Issues

  • No folder organisation support for GitLab

  • No Multibranch Pipeline Job support for GitLab

  • GitLab APIs currently used does not have all GitLab APIs features and limits the scope of future expansion

  • GitLab Plugin does not follow convention of SCM Plugins i.e. 3 separate plugins for api, build and branch Source

  • GitLab Plugin also does not leverage new SCM trait APIs, some features like auto-management of webhooks, password authentication are missing

  • No Pipeline Support for GitLab in Blueocean while GitHub and BitBucket are supported

Solutions

  • [NEW] GitLab Api Plugin that wraps new GitLab Java Api repository which is actively maintained and has almost all GitLab Apis support

  • [NEW] GitLab Branch Source Plugin that supports Branch Source Functionality like Github BS, Bitbucket BS etc

  • [IMPROVED] GitLab Plugin that is lightweight and provides build triggers, web hooks management and other API support

  • [NEW] Pipeline Support for GitLab in Blueocean

For more details, see this Google Doc - Proposal

Evaluation Phase 1

  1. Complete implementation with documentation and plugin release of GitLab API Plugin that wraps the gitlab4j-api into a plugin

  2. Implementation of GitLab Server Configuration in GitLab Branch Source Plugin with JCasC support. The implementation was done inside the plugin to support new GitLab API Plugin and also use Java 8 streams.

    • Features:

      • GitLab Personal Access Token Creator

      • Allows duplicate GitLab server entries with unique id

      • Supports GitLab Server versions above 11.0

      • Configure server via yaml (JCasC)

      • Supports GitLab API Plugin - abstracts api calls

      • Supports incremental tools - check if PRs work with downstream plugins

      • Supports Maven Checkstyle Plugin - enforces good coding style

      • Java 8 compatibility - streams API

      • Jenkins version - 2.150.3

      • 3 enhancement and fix release

    • Repo - https://github.com/baymac/gitlab-branch-source-plugin

Evaluation Phase 2

  1. Implementation of Branch Source part of GitLab Branch Source Plugin with Multibranch Pipeline and Folder Organization support.

Evaluation Phase 3

  1. Improvements to GitLab Branch Source Plugin, lots of improvements including major bugs fixes. Complete documentation in the repository documents.

    • Features:

      • Web hook events trigger for Push/Merge Request/Tag Events fixed

      • Trusted Permission Strategy for MRs from forked projects

      • Add support for System Hooks to detect newly created projects

      • Add symbols to discovery traits for JCasC support

      • Merge Requests web hook trigger fix

      • Trigger Merge Request with comment trait

      • Log build status as comment trait

      • 3 beta releases and 1 GA release

Meeting Schedule

  • Weekdays - Tuesday and Friday

  • Time - 04:00pm (UTC)

Links