Initial Successful Request

The developer is making the first request. The starting point is the base image and two empty PPAs.

User -> CLI

The user creates a request, providing a source package and binary packages to add.

python ubuntu-ci create_ticket -t "Ticket name" -d "Ticket description" -b 123 -o user@example.com -s /full/path/to/_source.changes -s /full/path/to/_source.changes

CLI -> Ticket System

The CLI creates a ticket through the ticket system, then pushes the source package files into the data store.

Create the ticket:

create_ticket {
    "owner": "default-user@example.com",
    "title": "Default title",
    "description": "Default description",
    "bug_id": "https://bugs.launchpad.net/bugs/1234567",
}

Returns:

"http://ticket-system-url:8000/api/v1/ticket/1/"

Create the source package upload:

create_source_package_upload {
    "sourcepackage": "/api/v1/sourcepackage/X/",
    "version": "1.5~dev.1"
}

Returns:

"http://ticket-system-url:8000/api/v1/spu/1/"

Create the sub-ticket for the source package:

create_subticket {
    "source_package_upload": "/api/v1/spu/1/",
    "ticket": "/api/v1/ticket/1",
    "assignee": "default-user@example.com"
}

Returns:

"http://ticket-system-url:8000/api/v1/subticket/1/"

For each source package file, upload to the data store:

data_store = DataStore("ticket.1", "sources", public=True)
while open("autopilot_1.5~dev.1_source.changes") as f:
    url = data_store.put_file("autopilot_1.5~dev.1_source.changes", f.read())

Returns (as ‘url’):

https://swift.canonistack.canonical.com/v1/AUTH_bucket_id/ticket.1.sources/autopilot_1.5~dev.1_source.changes"

then create the artifact:

create_artifact {
    "name": "autopilot_1.5~dev.1_source.changes",
    "subticket": "/api/v1/subticket/1/",
    "reference": "https://swift.canonistack.canonical.com/v1/AUTH_bucket_id/ticket.1.sources/autopilot_1.5~dev.1_source.changes"],
    "type": "SPU"
}

Returns:

"http://ticket-system-url:8000/api/v1/artifact/1/"

Ticket System -> Lander

The ticket system requests a build of the source packages and image through the lander:

execute_request {
    "ticket_id": "1",
    "source_packages": [
        "https://swift.canonistack.canonical.com/v1/AUTH_bucket_id/ticket.1/autopilot_1.5~dev.1.diff.gz",
        "https://swift.canonistack.canonical.com/v1/AUTH_bucket_id/ticket.1/autopilot_1.5~dev.1.dsc",
        "https://swift.canonistack.canonical.com/v1/AUTH_bucket_id/ticket.1/autopilot_1.5~dev.1_source.changes"
    ],
    "binary_packages": ["python-autopilot", "python3-autopilot"],
    "series": saucy,
    "base_image": "https://swift.canonistack.canonical.com/v1/AUTH_bucket_id/images/saucy-desktop-amd64.iso",
    "progress_queue": "ticket-1-exchange"
}

Returns TBD result.

Lander -> PPA Assigner

The lander requests a PPA to perform the build:

get_ppa {
   "ticket_id": 1
}

Returns:

"ppa:ci-team/ppa_build_1"

Lander -> Branch/Source Builder

The lander sends the source files to the ppa:

build_source {
    "source_packages": [
        "https://swift.canonistack.canonical.com/v1/AUTH_bucket_id/ticket.1/autopilot_1.5~dev.1.diff.gz",
        "https://swift.canonistack.canonical.com/v1/AUTH_bucket_id/ticket.1/autopilot_1.5~dev.1.dsc",
        "https://swift.canonistack.canonical.com/v1/AUTH_bucket_id/ticket.1/autopilot_1.5~dev.1_source.changes"
    ],
    "ppa": "ppa:ci-team/ppa_build_1",
    "progress_queue": "bsbuilder-1-exchange"
}

Returns:

Nothing (just a successful status code).

Branch/Source Builder -> Lander

Build progress messages are passed back via the progress queue:

TBD

Completion is signaled on the progress queue:

message {
    "state": "COMPLETED",
}

Lander -> Image Builder

The lander requests a new image from the image builder:

build_image {
    "base_image": {
        "image_type": "CLOUD",
        "url_list": [
            "https://swift.canonistack.canonical.com/v1/AUTH_bucket_id/images/saucy-desktop-amd64.iso"
        ],
        "series": "saucy",
    "ppa_list": ["ppa:ci-team/ppa_build_1", "ppa:ci-team/ppa_archive"],
    "package_list": ["python-autopilot", "python3-autopilot"],
    "progress_queue": "image-builder-1-exchange"
}

Image Builder -> Lander

Build progress messages are passed back via the progress queue:

TBD

Completion and location of image is sent via a message on the progress queue:

message {
    "state": "COMPLETED",
    "url_list": [
        "https://swift.canonistack.canonical.com/v1/AUTH_bucket_id/ticket.1/ticket.1.iso"
    ]
}

Lander -> Test Runner

The image and list of binary packages is sent to the test runner:

test_image {
    "test_request_id": "1",
    "image_url": "http://glance_url/image-1.iso",
    "package_name": "unity8"
}

Test Runner -> Lander

Returns status through progress messages:

message {
    "test_request_id": "1",
    "message": "10%",
    "current": "1",
    "total": "10",
}

Test completion is signaled by a final progress message:

message {
    "state": "COMPLETED",
    "test_request_id": "1",
    "status": "SUCCESS",
    "test_result": "PASSED",
    "artifacts": [
        "https://swift.canonistack.canonical.com/v1/AUTH_bucket_id/ticket.1.test-runner/autopilot-run.log",
        "https://swift.canonistack.canonical.com/v1/AUTH_bucket_id/ticket.1.test-runner/autopilot.xml"]
}

Lander -> Ticket System

The lander provides progress to the ticket system through the ticket system’s progress API:

TBD

Completion of a build is provided to the ticket system through the ticket system’s progress API:

TBD