Skip to content

Add job inputs to job payload for runner

Problem

As part of implementing CI job inputs, we need to pass those inputs from GitLab Rails to the Runner.

Suggested JSON payload

When the Runner runner requests a job to run from Rails, it sends a JSON JobRequest. Rails responds with a JSON JobResponse.

Job inputs need to be added to the JobResponse. The suggested format is adding an inputs array, where inputs look like the following:

{
  "key": "username",
  "value": {
    "type": "string",
    "content": "fred",
    "sensitive": false
  }
}
  • key is a string
  • value is a complex type to allow for sensitive, and to allow additional value types in future (e.g. bytes, big numbers, steps, etc)
  • supported types are string, number, boolean, array, struct
Expand for more complete example
{
  "inputs": [
    {
      "key": "username",
      "value": {
        "type": "string",
        "value": "fred",
        "sensitive": false
      }
    },
    {
      "key": "password",
      "value": {
        "type": "string",
        "value": "123456",
        "sensitive": true
      }
    },
    {
      "key": "age",
      "value": {
        "type": "number",
        "value": 1,
        "sensitive": false
      }
    },
    {
      "key": "likes_spaghetti",
      "value": {
        "type": "boolean",
        "value": false,
        "sensitive": false
      }
    },
    {
      "key": "friends",
      "value": {
        "type": "array",
        "value": [
          "bob",
          "sally"
        ],
        "sensitive": false
      }
    },
    {
      "key": "address",
      "value": {
        "type": "struct",
        "value": {
          "line1": "42 Wallaby Way",
          "line2": "Sydney"
        },
        "sensitive": false
      }
    }
  ]
}
Edited by 🤖 GitLab Bot 🤖