Skip to content

comtihon/enot_auto_builder

Repository files navigation

Enot build and load server Build StatusDocker Automated build

Build once, use everywhere. Automated service for building, storing and deploying Erlang packages with Enot.
Can be treat as a maven/pip for Erlang.

Adding your package to Enot

Read howto.

Running your own Enot build server

Standalone

Requirements:

  • postgres
  • EMAIL_USER env var set up
  • EMAIL_PASSWORD env var set up
  • GIT_SECRET is Enot's git application secret
  • kerl installed
  • enot installed

Monitoring

Monitoring is made via collectd and /metrics endpoint.

Docker

You can run all services with docker-compose. See docker-compose.yml for details.

Protocol

Build

POST /buildAsync - build request BODY:

{
    "full_name": <fullName>,
    "clone_url": <cloneUrl>,
    "versions": 
    [
        {
            "ref": <ref>,
            "erl_version": <erlVersion>
        }
    ]
}

Where:
fullName is a fullname of a repository, containing namespace and repo name. Ex. "comtihon/enot"
cloneUrl is a url for repository clone.
ref is a version to be built. Ex: "1.0.0".
erl_version (optional) is an Erlang version used for build. Ex: "19".

POST /rebuild - request a specific build to be rebuilt
BODY:

{
    "build_id" : <buildId>
}

Where: buildId is an id of a build for rebuild

POST /callback - build request from Github.
Header: x-hub-signature with request signature.
BODY:

{
    "repository": 
    {
        "full_name": <fullName>
        "clone_url": <cloneUrl>
    },
    "ref": <ref>,
    "ref_type": <refType>
}

Where:
refType is a type of reference. Only tag is supported.

Search

GET /search - search for packages.
PARAMETERS:
name - package name
namespace - package's namespace (GitHub fork name)
version - package's version
erl_version - Erlang version
RESPONSE:

{
    "result" : <result>,
    "response" : 
    [
        {
            "build_id" : <build_id>,
            "namespace" : <namespace>,
            "name" : <name>,
            "success" : <success>,
            "path" : <path>,
            "build_date" : <date>,
            "version" : <version>,
            "erl_version" : <erl_version>
         }
         ...
    ]
}

POST /builds - get a list of builds, available for download. Skip errored builds.
BODY:

{
    "full_name": <fullName>,
    "versions": 
    [
        {
            "ref": <ref>,
            "erl_version": <erlVersion>
        }
    ]
}

Where:
ref and erlVersion and versions are optional.
RESPONSE:

{
    "result": <boolean_result>,
    "response":
    [
        {"build_id" : <Id>, "result" : true, "message" : "", "artifact_path" : <Path>, "created_date" : <Date>}
        ...
    ]
}

Where:
response will be just string error message in case of result is not true.

POST /versions - get a list of versions, available for download. Skip versions without successful builds.
BODY: same as /builds
RESPONSE:

{
    "result": <boolean_result>,
    "response":
    [
        {"versionId" : <Id>, "ref" : <ref>, "erl_version" : <Erl>}
        ...
    ]
}

GET /last_builds - get last n built packages. PARAMETERS: n - N packages to return RESPONSE:

{
    "result" : <result>,
    "response" :
    [
        {
            "build_id" : <build_id>,
            "namespace" : <namespace>,
            "name" : <name>,
            "success" : <success>,
            "path" : <path>,
            "build_date" : <date>,
            "version" : <version>,
            "erl_version" : <erl_version>
         }
         ...
    ]
}

Download

GET /download/{id} - download artifact by id.

GET /download_erts/{version} - download erts for erlang version. version - is an Erlang version, not erts!

POST /get - try to download artifact by name, ref and version. If there is multiple - the last built will be fetched.
BODY:

{
    "full_name": <fullName>,
    "versions": 
    [
        {
            "ref": <ref>,
            "erl_version": <erlVersion>
        }
    ]
}

GET /build_log/ - get build's log.
PARAMETERS:
build_id - id of a build.
RESPONSE:

raw txt log