Skip to end of metadata
Go to start of metadata

You are viewing an old version of this content. View the current version.

Compare with Current View Version History

Version 1 Current »

Prerequisite

  • CustomCD service is already created in your company.

  • Personal Access Token is created in your company.

Endpoint to create a custom job

  • POST https://<server>:<port>/webhook/company/<company_id>/cicd_job

  • Data should be sent as JSON body

  • Token should be sent in Authorization header

Header Key = ‘Authorization’

Header Value = ‘Bearer <token>’

Base Fields

  • job_id [Required] [String] - Custom string value to uniquely identify this job. Allstacks assumes this may not be truly unique, and will use a different value for the primary key. This will be stored as a property in allstacks.

  • commit_sha [Required] [String] - The full SHA of the commit being deployed. This means this will be a string of 40 characters OR 64 Characters for the new version that’s being rolled out. This will be stored as a property in allstacks.

  • service_id [Required] [Integer] - The ID of the Custom CD Service that this data will be routed to.

  • job_start_time [Required] [Integer] - The epoch timestamp of the start of the job. (i.e seconds since epoch). This will be stored as the item creation date and item start date of the service item.

  • job_duration [Required] [Integer] - The duration of the job in seconds, as an integer. This will be stored as a property in allstacks.

  • status [Required] [String] - This field indicates the status of the job. Valid values are ‘Succeeded’, ‘Failed’, ‘On Hold’. This will be stored as a property in allstacks.

  • repo_id OR repo_name [Required] [String] - One of repo id and repo name must be supplied. This will be stored as a property in allstacks.

  • triggered_by [Optional] [String] - The user email OR agent username that triggered the job. A service user will be created in allstacks for this user if one doesn’t already exist. If this field is blank, we will use a default value, ‘Custom CD Agent’. This will be stored as the item creation user of the service item.

  • job_type  [Optional] [String] - A customer defined field that allows a user to distinguish between types of jobs. If this field is blank, we will use a default value, ‘CUSTOM_CD_JOB’. This will be stored as the item subtype of the service item.

Optional Fields

  • List of optional fields can be supplied. They will be stored as properties in allstacks. Maximum number of optional fields allowed is 20.

  • Valid types are ‘string’, ‘integer’, ‘float’, ‘duration’, ‘timestamp’

    • duration type must be supplied as an integer

    • timestamp type must be supplied as an integer i.e seconds since epoch

  • Value can be a single value or a list of values. (maximum limit is 20)

  • Format is {‘key’: ‘name of key’, ‘value’: ‘value’ / [list of values], ‘type’: ‘type of key’}

Sample Payload

{

   "job_id": "1",

   "status": "Succeeded",

   "commit_sha": "a2e7da86cc392417b0d9f605b28038aae80b002f",

   "triggered_by": "testuser@org.com

   "repo_id": “12345”,

   "service_id": 2,

   "job_start_time": 1704018030,

   "job_duration": 300,

   "job_type": "Production Deploy",

   "optional": [

     {

       "key": 'microservice',

       "value": ['frontend', 'backend'],

       "type": 'string'

     },

     {

       "key": 'lead_time',

       "value": 20,

       "type": 'duration'

     },

     {

       "key": 'float_key',

       "value": 20.5,

       "type": 'float'

     },

     {

       "key": 'qa_approved_on',

       "value": 1704018030,

       "type": 'timestamp'

     },

   ]

}

  • No labels