Example schema

{
  "id": "main-layerfile",
  "layerfile_relative_path": "Layerfile",
  "status": "SUCCESS",
  "was_retried": false,
  "runner_index": 1
}

Layerfile runner ID

Layerfile runners are indentified by a string composed of the runner name and index sepreated by a dash.

A Layerfile runner’s name is determined in one of three ways:

  1. A display name is set using the LABEL directive
  2. The naming structure of the directories containing the Layerfile containing names of up two two parent directories sepreated by a dash
  3. If the Layerfile is not in a directory it will be named main-layerfile

A Layerfile runner’s index is incremented if it has been created as a retry or copied through the SPLIT directive.

Examples

A Layerfile that contains the instruction:

Layerfile
LABEL display_name=cool_layerfile_name

Will have the id cool_layerfile_name.

If the Layerfile runner is retried the id of the new Layerfile runner will be cool_layerfile_name-2

A layerfile in the directory /Cypress/Layerfile will have the id Cypress.

A layerfile in the directory /Tests/Cypress/Layerfile will have the id Tests-Cypress.

A layerfile in the directory /Layerfiles/Tests/Cypress/Layerfile will have the id Tests-Cypress.

A Layerfile in the directory /Cypress/Layerfile that contains the instruction:

Layerfile
SPLIT 3

Will produce three Layerfile runners having the ids: Cypress Cypress-2 Cypress-3

Get the Layerfile runners for a given CI job

It’s often useful to get the most recent CI job given specific filters. This API endpoint allows for that.

require 'faraday'
require 'json'

# get the most recent failing jobs
res = Faraday.get 'https://webapp.io/api/v1/runners/repo_name/job_uuid?token=(your api key)'

res = JSON.parse(res.body)

Output:

{
  "runners": [
    {
      "id": "main-layerfile",
      "layerfile_relative_path": "Layerfile",
      "status": "ERROR",
      "was_retried": true,
      "runner_index": 1
    },
    {
      "id": "main-layerfile-2",
      "layerfile_relative_path": "Layerfile",
      "status": "SUCCESS",
      "was_retried": false,
      "runner_index": 2
    }
  ],
  "status": "ok"
}

— or —

{
  "error": "There is no run for layerdemo matching uuid job_uuid.",
  "status": "error"
}

Prioritize a Layerfile runner snapshot

require 'faraday'
require 'json'

res = Faraday.post(
    'https://webapp.io/api/v1/runners/repo_name/ci_job_id/layerfile_runner_id/prioritize-snapshot?token=(your api key)',
)

res = JSON.parse(res.body)

Output:

{
  "status": "ok",
  "job": {
    "id": "main-layerfile",
    "layerfile_relative_path": "Layerfile",
    "status": "SUCCESS",
    "was_retried": false,
    "runner_index": 1
  }
}

status can be one of "ok" or "error". If the latter exists, an "error" value will be included with an explanation.