GSoC 2018. Simple Pull-Request Job Plugin

This site is the new docs site currently being tested. For the actual docs in use please go to https://www.jenkins.io/doc.

Goal:

Status: Completed

Team

Student: no image Abhishek Gautam

Mentor(s): no image Kristin Whetstone no image Jeff Knurek martinda Martin d’Anjou

This project aims to develop a Job Plugin which can interact with Bitbucket Server, Bitbucket Cloud, and Github whenever a pull request is created or updated. Users should be able to configure job type using YAML file which will be placed in root directory of the Git repository being the subject of the PR.

Detect the presence of certain types of the report based on a conventional location, and automatically publish them. If the reports are not in a conventional location, users could specify the location using the YML file.

Project Summary

This plugin will be developed on the top of the MultiBranch Pipeline plugin.

This plugin will follow below steps
  • clone target repo

  • checkout to target branch

  • fetch the source branch

  • merge source-branch

  • call user call user script to build the repo.

  • push to target branch [if specified by user in YAML]

  • harvest results and reports and post to PR

Plugin will start above steps if and only if the pull request is will be mergeable to avoid merge conflicts while merging the source branch to target branch. The pull request is mergebale or not can also be decided by the webhook also.

Internally, it converts the user written YAML file into Declarative Pipeline DSL code which is then executed by the declarative engine.

Work done

Phase 1

  • Use a Jenkinsfile.yaml for build.

  • Git Push step (Users do not call git push explicitly)

  • Build and tests performed by user defined script called from Jenkinsfile.yaml

  • Agent configuration in “Jenkinsfile.yaml” harvest results and reports.

    • junit()

    • findbugs()

    • archiveArtifacts section

  • Basic interface to parse and get build specifications from YAML file.

Phase 1 Blog Post(June 15, 2018) Phase 1 Presentation video(June 14, 2018) Phase 1 Presentation Slides(June 14, 2018)

Phase 2

  • Step Configurator (Based on JCasC plugin)

    • Limitations:

      • Difficulty with Enums (Resolved now by JCasC plugin developers)

      • Difficulty with “JiraTestDataPublisher.class” and may be other classes

  • A format for “Jenkinsfile.yaml”. (All details present in Phase 2 Blog Post)

  • Tools property in agent section of Jenkinsfile.yaml.

  • Some tests for the plugin.

  • Documentation for yaml examples written

Phase 2 Blog Post(July 17, 2018) Phase 2 Presentation video(July 12, 2018) Phase 2 Presentation Slides(July 12, 2018)

Code improvements.

  • Manual indentation removed from PipelineSnippetGenerator class.

Phase 3

  • Declarative pipeline code generator detach to extensions.

  • Unit tests were written for extensions.

  • Documentation improved.

Future tasks

  • Test the integration with various platforms Bitbucket, Gitlab, Github.

  • Support for webhooks

  • Check if trusted people have approved a pull request and start build accordingly

  • Automatic Workspace Cleanup when PR is closed

  • Support the “when” Declarative Pipeline directive

  • Nice2have: Support hierarchical report types

  • Acceptance Test Harness tests

Regular meeting Hours

Every Wednesday 5 PM to 6 PM UTC. Click here to see it in your local time.