Gradle Nebula Plugin

Nebula is a collection of plugins for Gradle. The Gradle Metrics Plugin provides metrics to a webservice endpoint after each build by Gradle.

Swingletree can provide a webservice endpoint to process the metics report of the plugin.

Features

The Swingletree Plugin offers following functionalites:

  • Collects information about tests running in your Gradle build
  • Collects performance metrics of your builds
  • Collects general information about your build
    • Gradle version
    • Java version
    • Project version
    • Project name
    • Executed Tasks

Processed data is persisted to ElasticSearch (if enabled in Scotty) and can be processed to reports using Kibana or Grafana. Information, which could contain sensitive information (like environment variables) are not processed and persisted.

Build Status decision

Swingletree blocks Pull Requests if tests are failing in the Gradle build.

Sending a metrics report to Swingletree

This plugin sends its data using the Nebula Gradle Metrics Plugin. Yoke CLI is not required to send reports.

The Nebula webhook is published when the Nebula Plugin is enabled. It accepts a Nebula Gradle Metrics Plugin report as a payload and needs some additional http headers to link the report to a GitHub repository:

buildscript {
  dependencies {
    classpath "com.netflix.nebula:gradle-metrics-plugin:9.0.1"
  }
}

if (thisIsCiBuild) { // needs to be specified by you
  apply plugin: "nebula.metrics"

  metrics {
      dispatcherType = 'REST'
      restUri = 'https://gate.swingletree/report/nebula' // can be injected by CI server using properties or env vars

      // header values need to be extracted and set ()
      headers['swingletree-org'] = project.findProperty('githubOrg')   // github organization provided with -PgithubOrg=<value> when invoking build
      headers['swingletree-repo'] = project.findProperty('githubRepo') // github repository provided with -PgithubRepo=<value> when invoking build
      headers['swingletree-sha'] = project.findProperty('sha')         // commit hash provided with -Psha=<value> when invoking build
      headers['swingletree-branch'] = project.findProperty('branch')   // branch provided with -Pbranch=<value> when invoking build
      headers['swingletree-uid'] = project.findProperty('buildId')     // build id generated by yoke , provided with -PbuildId=<value> when invoking build
  }
}

Swingletree will process the report and send a Check Run Status with the context gradle/nebula to the given GitHub coordinates.