Yoke CLI

Yoke is the CLI of Swingletree, providing a simple and convenient way of publishing build reports.

Features

  • Retrieves current Git information and annotates it to the report
  • Reads the .swingletree.yml repository configuration

Usage

Print help by running yoke -h. A report should be published after all build steps have finished and the report data is avaiable to yoke.

yoke publish -e https://gate.swingletree.domain

Build UUIDs

Swingletree distinguishes multiple build runs using a build UUID. Yoke automatically generates and attaches a build id to reports when uploading them to Swingletree.

However, some reports are not directly sent to Swingletree, since they need to be processed asynchronous by an other tool in order to obtain data. An example is the SonarQube sonar-runner, which sends the reports to a SonarQube server for processing. As soon as the SonarQube server completes processing the data provided by sonar-runner, the report is sent via webhook to Swingletree.

In these cases yoke can not be used to upload build reports.

Generating and using build ids using yoke

Yoke generates and prints a UUID to stdout using the command yoke generate buildid.

This UUID is constructed using following information

  • build path
  • user id
  • commit hash
  • repository name

This build id is intended to be consumed by plugins not served by yoke (like plugin-nebula and plugin-sonarqube). Instead of using yoke directly, the build id needs to be generated by yoke and passed to the upload tools, for example gradle-nebula-metrics-plugin or sonar-runner as extra properties. The property in this case can be passed as HTTP-Header swingletree-uid or query parameter uid. Please see the documentation pages of the respective plugins for more information about how to provide the build id for a specific plugin.

Swingletree Repo Config

Yoke picks the plugins and report locations from the .swingletree.yml of the repository.

A configuration could look like this:

yoke:
  reports:
    - plugin: zap
      contenttype: application/json
      report: build/zap/report.json
    - plugin: twistlock
      contenttype: application/json
      report: build/twistlock/report.json

Yoke would try to send the report contents of

  • build/zap/report.json to the zap plugin endpoint of Gate
  • build/twistlock/report.json to the twistlock plugin endpoint of Gate