Projects build REST API


ABF Build project REST API

This describes the resources that make up the official Rosa ABF API. If you have any problems or requests please contact support.

Note: This API is in a beta state. Breaking changes may occur.

All of the urls in this manual have the same tail: .json. Because the default

1. Show build data

This request will return you all needed data of requested build task into JSON format.

URL: /buils_lists/:id.json

TYPE: GET

PARAMS: * :id - identifier of current build task

RESPONSE:

{
  "build_list":
    {
      "id": <resource id>,
      "name": <name>,
      "container_path": <Container path>,
      "status": <status code>,
      "project_version": <parent project version>,
      "package_version": <package version>,
      "project": {
        "id": <project id>,
        "name": <project name>,
        "fullname": <project fullname>,
        "url": <url to project data page> 
      },
      "build_for_platform": {
        "id": <platform id>,
        "name": <platform name>,
        "url": <platform data page path>
      },
      "save_to_repository": {
        "id": <repository for package storage id>, 
        "name": <repository for package storage name>,
        "url":  <path to repository data page>,
        "platform": {
          "id": <repository platform id>, 
          "name": <repository platform name>,
          "url": <path to repository platform data page>
        }
      },
      "arch": {
        "id": <build architecture id>,
        "name": <build architecture name> 
      },
      "is_circle": <recurrent build>,
      "update_type": <update type>,
      "build_requires": <build with all the required packages>,
      "auto_publish": <automated publising>,
      "commit_hash": <last commit hash of project source>,
      "priority": <build priority>,
      "duration": <build duration in seconds>,
      "build_log_url": <build list log url>,
      "advisory": {
        "id": <advisory id>,
        "name": <advisory name>,
        "description": <advisory description>,
        "url": <path to advisory data page> 
      },
      "mass_build": {
        "id": <mass_build id>,
        "name": <mass_build name>,
        "url": <path to mass_build data page> 
      },
      "owner": {
        "id": <project owner id>,
        "name": <project owner name>,
        "url": <url to owner profile>
      },
      "include_repos": [
        {
          "id": <included repository id>, 
          "name": <included repository name>,
          "url": <path to included repository data page>,
          "platform": {
            "id": <repository platform id>, 
            "name": <repository platform name>,
            "url": <path to repository platform data page>
          }
        },
        ...
      ],
      "url": <url to build list page>
    }
}

EXAMPLE:

{
  "build_list":
    {
      "id": 10,
      "name": "evil_tools",
      "container_path": "/rosa2012/container/evil_tools",
      "status": 6000,
      "project_version": "latest_rosa2012",
      "package_version": "latest_rosa2012",
      "project": {
        "id": 666,
        "name": "evil_tools",
        "fullname": "",
        "url": "/api/v1/projects/1"
      },
      "build_for_platform": {
        "id": 1,
        "name": "rosa2012",
        "url": "/api/v1/platforms/1"
      },
      "save_to_repository": {
        "id": 12, 
        "name": "mr_evil/personal",
        "url":  "/api/v1/repositories/12",
        "platform": {
          "id": 2, 
          "name": "cocos_lts",
          "url": "/api/v1/platforms/2"
        }
      },
      "arch": {
        "id": 1,
        "name": "x84_64" 
      },
      "notifed_at": "Tue, 03 Apr 2012 14:06:10 UTC +00:00",
      "is_circle": false,
      "update_type": "bugfix",
      "build_requires": false,
      "auto_publish": true,
      "commit_hash": "4edafbe69632173a1800c4d7582b60b46bc1fb55",
      "priority": 0,
      "duration": nil,
      "build_log_url": "/downloads/warpc_personal/container/evil_tools-680163/log/evil_tools/build.log",
      "advisory": {
        "id": 666,
        "name": "at",
        "description": "warpc/at",
        "url": "/api/v1/advisories/666"
      },
      "mass_build": {
        "id": 666,
        "name": "rosa2012lts (main)",
        "url": "/api/v1/mass_builds/666"
      },
      "owner": {
        "id": 49,
        "name": "Mr. Evil",
        "url": "/users/49.json"
      },
      "include_repos": [
        {
          "id": 16, 
          "name": "main",
          "url": "/api/v1/repositories/16.json",
          "platform": {
            "id": 16, 
            "name": "warpc_personal",
            "url": "/api/v1/platforms/16.json"
          }
        }
      ],
      "url": "/api/v1/build_lists/10.json"
    }
}

2. Create build task

By this request you can create build task for project.

Create parameters:

{
  "build_list": {
    "project_id": <project id>,
    "commit_hash": <commit hash to build>,
    "update_type": <one of the update types>,
    "save_to_repository_id": <repository identifier for package storage>,
    "build_for_platform_id": <platform identifier of platform for build>,
    "auto_publish": <automated publising>,
    "build_requires": <true if build with all the required packages>,
    "include_repos[]": [
      <included repository id for each selected platform>
    ],
    "arch_id": <architecture identifier>
  }
}

Note: Request creates build list for each architecture and base platform.

POSIBLE UPDATE TYPES:

security
bugfix 
enhancement 
recommended 
newpackage

URL: /api/v1/build_lists.json

TYPE: POST

REQUEST EXAMPLE:

{
  "build_list": {
    "project_id": "10",
    "commit_hash": "751b0cad9cd1467e735d8c3334ea3cf988995fab",
    "update_type": "bugfix",
    "save_to_repository_id": 12,
    "build_for_platform_id": 2,
    "auto_publish": true,
    "build_requires": true,
    "include_repos[]": [
      54,
      53
    ],
    "arch_id": 1
  }
}

RESPONSE:

{
  "build_list":
    {
      "id": <build list id (null if failed) >,
      "message": <success of fail message>
    }
}

RESPONSE EXAMPLE:

{
  "build_list":
    {
      "id": 56,
      "message": "Build list for project version 'beta_2012', platform 'rosa2012' and architecture 'i586' has been created successfully"
    }
}

3. Cancel build task

By this request you can cancel build task.

URL: /buils_lists/:id/cancel.json

TYPE: PUT

RESPONSE:

{
  "is_canceled": <true or false>, # May be just result name will be better
  "url": <url to build list page>,
  "message": <success of fail message>
}

EXAMPLE:

{
  "is_canceled": true,
  "url": "/api/v1/build_lists/10.json",
  "message": "Build canceled"
}
{
  "is_canceled": false,
  "url": "/api/v1/build_lists/10.json",
  "message": "Errors during build cancelation!"
}

4. Publish build task

By this request you can publish build task.

URL: /buils_lists/:id/publish.json

TYPE: PUT

RESPONSE:

{
  "is_published": <true or false>, # May be just result name will be better
  "url": <url to build list page>,
  "message": <success of fail message>
}

EXAMPLE:

{
  "is_published": true,
  "url": "/api/v1/build_lists/10.json",
  "message": "Build is queued for publishing"
}
{
  "is_published": false,
  "url": "/api/v1/build_lists/10.json",
  "message": "Errors during build publishing!"
}

5. Reject publish build task

By this request you can reject publish build task.

URL: /builslists/:id/rejectpublish.json

TYPE: PUT

RESPONSE:

{
  "is_rejected": <true or false>, # May be just result name will be better
  "url": <url to build list page>,
  "message": <success or fail message>
}

EXAMPLE:

{
  "is_rejected": true,
  "url": "/api/v1/build_lists/10.json",
  "message": "Build is rejected"
}
{
  "is_rejected": false,
  "url": "/api/v1/build_lists/10.json",
  "message": "Errors during build rejecting!"
}

6. Search

By this way you can search build list you need.

Search params:

  • page - page number of build lists results list
  • per_page - amount of build list per one page (default 30, maximum 100)
  • filter[status] - integer code of the build status
  • filter[arch_id] - identifier of the architecture
  • filter[is_circle] - recurrent build (true or false)
  • filter[project_name] - project name
  • filter[createdatstart / createdatend] - start and end of the build list creation date diapason(unixtime)
  • filter[updatedatstart / updatedatend] - start and end of the build list last change date diapason(unixtime)
  • filter[ownership] - ownership type (owned/related/index)
  • filter[massbuildid] - mass build identifier
  • filter[savetoplatform_id] - platform id for build save

BUILD LIST POSIBLE STATUSES

    Build error: 666
    Build has been published: 6000
    Publishing rejected: 9000
    Build is being published: 7000
    Publishing error: 8000
    Dependences not found: ?
    Waiting for response: 4000
    Build pending: 2000
    Dependency test failed: ?
    Binary test failed: ?
    Build canceled: 5000
    Build complete: 0
    Build started: 3000
    Platform not found: 1
    Platform pending: 2
    Project not found: 3
    Project version not found: 4

URL: /build_lists.json?

TYPE: GET

RESPONSE:

{
  "build_lists": [
    {
      "id": <build list id>,
      "name": <build list name>,
      "status": <build list status>,
      "url": <build list page>
    }
  ],
  "url": <current url for build lists page>
}

EXAMPLE OF REQUEST URL:

/buildlists.json?filter[projectname]=rails

/buildlists.json?filter[ownership]=owned&filter[status]=6000&filter[archid]=2

EXAMPLES OF RESPONSES:

{
  "build_lists": [
    {
      "id": 25,
      "name": "evil_tools",
      "status": 6000,
      "url": "/api/v1/build_lists/25.json"
    },
    {
      "id": 26,
      "name": "evil_tools",
      "status": 6000,
      "url": "/api/v1/build_lists/26.json"
    }
  ],
  "url": "/api/v1/build_lists.json"
}

7. Destroy build task

You can't destroy build list. Only cancel it. :)

8. 404, 500, 503 and 401 errors.

Some requests can cause cancer of 404, 500 and 503 errors. In these situatins you will receive such data:

{
  "status": 404,
  "message": "Page not found"
}
{
  "status": 500,
  "message": "Something went wrong. We've been notified about this issue and we'll take a look at it shortly."
}
{
  "status": 503,
  "message": "We update the site, it will take some time. We are really trying to do it fast. We apologize for any inconvenience.."
}
{
  "status": 401,
  "message": "Requires authentication"
}

If you don't have enough rights for requested action, you will receive error response such this:

{
  "message": "Forbidden. Sorry, you don't have enough rights for this action!"
}

and http status code will be 403.


Last edited by warpc