Build application

  • POST
  • /workspaces
  • /:domain
  • /projects
  • /:project_name
  • /pipelines
  • /:pipeline_id
  • /actions

Request

URL PARAMETERS
domainrequired string
The workspace domain.
project_namerequired string
The name ID of the project.
pipeline_idrequired integer
The numerical ID of the desired pipeline.
POST PARAMETERS
namerequired string
The name of the action.
typerequired string
The type of the action. Should be set to BUILD.
docker_image_namerequired string
The name of the Docker image.
docker_image_tagrequired string
The tag of the Docker image.
execute_commandsrequired string[]
The commands that will be executed.
run_as_userstring
All build commands are run as the default user defined in the selected Docker image. Can be set to another username (on the condition that this user exists in the selected image).
volume_mappingsstring[]
The path preceding the colon is the filesystem path (the folder from the filesystem to be mounted in the container). The path after the colon is the container path (the path in the container, where this filesystem will be located).
cached_dirsstring[]
The dependencies & directories to be cached and available to every execution in this pipeline.
working_directorystring
The directory in which the pipeline filesystem will be mounted.
setup_commandsstring[]
The command that will be executed only on the first run.
servicesrequired Service
main_service_namestring
The hostname of the container in which the action is run. The container will be available under this name in the docker network for services defined in the services field.
shellstring
The name of the shell that will be used to execute commands. Can be one of SH (default) or BASH.
execute_every_commandboolean
If set to true all commands will be executed regardless of the result of the previous command.
cacheBaseImageboolean
If set to true, the cached version of the image is used, instead of being pulled each time.
reset_entrypointboolean
If set to true, resets the default entrypoint set by the image. Default value: false.
ignore_image_pull_failuresboolean
if set to true, use cached image on timeouts (only for official images).
cache_base_imageboolean
If set to true, the cached version of the image is used, instead of being pulled each time.
image_locationstring
The location of the image used by the action. Available values: PUBLIC_REGISTRY, PRIVATE_REGISTRY, ACTION. If the value is other than ACTION, it must be provided together with the docker_registry field. If not provided, the system will automatically set it based on other data from the action.
docker_registrystring
The type of registry from which the image used by the action is retrieved. Available values: NONE, DOCKER_HUB, AMAZON_ECR, GOOGLE_GCR, GOOGLE_ARTIFACT_REGISTRY, OTHER. It must be provided together with image_location. If not specified, the system will automatically set it based on other data from the action.

Last modified on Nov 4, 2024

Example: Build action

curl -X POST "https://api.buddy.works/workspaces/:domain/projects/:project_name/pipelines/:pipeline_id/actions" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "Content-Type: application/json" \
-d '{
  "name": "Build application",
  "type": "BUILD",
  "trigger_time": "ON_EVERY_EXECUTION",
  "docker_image_name": "library/ubuntu",
  "docker_image_tag": "latest",
  "volume_mappings": [
    "/:/buddy/mount/directory"
  ],
  "execute_commands": [
    "ls -al > $fileName"
  ],
  "setup_commands": [
    "apt-get update -y",
    "apt-get install -y wget"
  ],
  "cached_dirs": [
    "/build/test",
    "/bin/Debug"
  ],
  "variables": [
    {
      "key": "fileName",
      "value": "ls.log"
    }
  ],
  "working_directory": "/buddy/my-repo-dir",
  "shell": "SH",
  "main_service_name": "my-app.svc",
  "cacheBaseImage": true,
  "services": [
    {
      "type": "MYSQL",
      "version": "5.7"
    },
    {
      "type": "MONGO_DB",
      "version": "3.2.4"
    }
  ]
}'
EXAMPLE RESPONSE
{ "url": "https://api.buddy.works/workspaces/buddy/projects/company-website/pipelines/2/actions/2", "html_url": "https://app.buddy.works/buddy/company-website/pipelines/action/2/edit", "id": 2, "name": "Build application", "type": "BUILD", "trigger_time": "ON_EVERY_EXECUTION", "last_execution_status": "INITIAL", "docker_image_name": "library/ubuntu", "docker_image_tag": "latest", "volume_mappings": [ "/:/buddy/mount/directory" ], "execute_commands": [ "ls -al > $fileName" ], "setup_commands": [ "apt-get update -y", "apt-get install -y wget" ], "cached_dirs": [ "/build/test", "/bin/Debug" ], "variables": [ { "key": "fileName", "value": "ls.log" } ], "working_directory": "/buddy/my-repo-dir", "shell": "SH", "main_service_name": "my-app.svc", "cacheBaseImage": true, "services": [ { "type": "MYSQL", "version": "5.7", "connection": { "address": "mysql:3306", "user": "root", "password": "qwerty" } }, { "type": "MONGO_DB", "version": "3.2.4", "connection": { "address": "mongo:27017" } } ], "pipeline": { "url": "https://api.buddy.works/workspaces/buddy/projects/company-website/pipelines/2", "html_url": "https://app.buddy.works/buddy/company-website/pipelines/pipeline/2", "id": 2, "name": "Live mirror", "refs": [ "refs/heads/master" ], "last_execution_status": "SUCCESSFUL", "last_execution_revision": "506a3963507943d6908154f4bc9646e829128a08" } }
STATUS
201 Created
LIMITS
X-Rate-Limit-Limit: 1 X-Rate-Limit-Remaining: 999

Example: Build action services

curl -X POST "https://api.buddy.works/workspaces/:domain/projects/:project_name/pipelines/:pipeline_id/actions" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "Content-Type: application/json" \
-d '{
  "name": "Build application",
  "type": "BUILD",
  "trigger_time": "ON_EVERY_EXECUTION",
  "docker_image_name": "library/ubuntu",
  "docker_image_tag": "latest",
  "volume_mappings": [
    "/:/buddy/mount/directory"
  ],
  "execute_commands": [
    "ls -al > ls.log"
  ],
  "services": [
    {
      "type": "CUSTOM",
      "connection": {
        "host": "custom.service"
      },
      "use_image_from_action": true,
      "docker_build_action_id": 0,
      "wait_for_port": 1234,
      "working_directory": "/buddy/git-repo",
      "volume_mappings": [
        "/:/buddy/mount/directory"
      ],
      "cached_dirs": [
        "/var/data/"
      ],
      "pass_variables": true,
      "entrypoint": "/bin/sh"
    },
    {
      "type": "MYSQL",
      "version": "5.7",
      "persistent": true,
      "connection": {
        "host": "mysql",
        "user": "root",
        "password": "root"
      },
      "pass_variables": true
    },
    {
      "type": "MARIADB",
      "version": "10.1.16",
      "persistent": true,
      "connection": {
        "host": "mariadb",
        "user": "root",
        "password": "root"
      },
      "pass_variables": true
    },
    {
      "type": "REDIS",
      "version": "3.2.1",
      "persistent": true,
      "connection": {
        "host": "redis"
      },
      "pass_variables": true
    },
    {
      "type": "MONGO_DB",
      "version": "3.2.4",
      "persistent": true,
      "connection": {
        "host": "mongo"
      },
      "pass_variables": true
    },
    {
      "type": "POSTGRE_SQL",
      "version": "9.5.3",
      "persistent": true,
      "connection": {
        "host": "postgres",
        "user": "root",
        "password": "root"
      },
      "pass_variables": true
    },
    {
      "type": "CASSANDRA",
      "version": "3.11",
      "persistent": true,
      "connection": {
        "host": "cassandra"
      },
      "pass_variables": true
    },
    {
      "type": "MEMCACHED",
      "version": "1.4.29",
      "connection": {
        "host": "memcached"
      },
      "pass_variables": true
    },
    {
      "type": "ELASTICSEARCH",
      "version": "2.3.4",
      "connection": {
        "host": "elasticsearch"
      },
      "pass_variables": true
    },
    {
      "type": "SELENIUM_FIREFOX",
      "version": "3.0.1",
      "connection": {
        "host": "selenium-ff"
      },
      "pass_variables": true
    },
    {
      "type": "SELENIUM_CHROME",
      "version": "3.0.1",
      "connection": {
        "host": "selenium-ch"
      },
      "pass_variables": true
    },
    {
      "type": "GANACHE",
      "version": "latest",
      "persistent": true,
      "connection": {
        "host": "ganache"
      },
      "gas_price": 20000000000,
      "gas_limit": 90000,
      "accounts": [
        "0xfd7ac8b32e8a2391cad323efd7b162d77dd9ca67806d09877552c38b618713a5:1000000000000000000"
      ],
      "pass_variables": true
    },
    {
      "type": "RABBIT_MQ",
      "version": "3.7.8",
      "persistent": true,
      "connection": {
        "host": "rabbitmq",
        "user": "guest",
        "password": "guest"
      },
      "pass_variables": true
    }
  ]
}'
EXAMPLE RESPONSE
{ "url": "https://api.buddy.works/workspaces/buddy/projects/company-website/pipelines/2/actions/2", "html_url": "https://app.buddy.works/buddy/company-website/pipelines/action/2/edit", "id": 2, "name": "Build application", "type": "BUILD", "trigger_time": "ON_EVERY_EXECUTION", "last_execution_status": "INITIAL", "docker_image_name": "library/ubuntu", "docker_image_tag": "latest", "volume_mappings": [ "/:/buddy/mount/directory" ], "execute_commands": [ "ls -al > ls.log" ], "services": [ { "type": "MYSQL", "version": "5.7", "persistent": true, "connection": { "host": "mysql", "port": 3306, "user": "root", "password": "root" }, "plugins": [], "pass_variables": true }, { "type": "MARIADB", "version": "10.1.16", "persistent": true, "connection": { "host": "mariadb", "port": 3306, "user": "root", "password": "root" }, "plugins": [], "pass_variables": true }, { "type": "REDIS", "version": "3.2.1", "persistent": true, "connection": { "host": "redis", "port": 6379 }, "plugins": [], "pass_variables": true }, { "type": "MONGO_DB", "version": "3.2.4", "persistent": true, "connection": { "host": "mongo", "port": 27017 }, "plugins": [], "pass_variables": true }, { "type": "POSTGRE_SQL", "version": "9.5.3", "persistent": true, "connection": { "host": "postgres", "port": 5432, "user": "root", "password": "root" }, "plugins": [], "pass_variables": true }, { "type": "CASSANDRA", "version": "3.11", "persistent": true, "connection": { "host": "cassandra", "port": 9042 }, "plugins": [], "pass_variables": true }, { "type": "MEMCACHED", "version": "1.4.29", "persistent": false, "connection": { "host": "memcached", "port": 11211 }, "plugins": [], "pass_variables": true }, { "type": "ELASTICSEARCH", "version": "2.3.4", "persistent": false, "connection": { "host": "elasticsearch", "port": 9200 }, "plugins": [], "pass_variables": true }, { "type": "SELENIUM_FIREFOX", "version": "3.0.1", "persistent": false, "connection": { "host": "selenium-ff", "port": 4444 }, "plugins": [], "pass_variables": true }, { "type": "SELENIUM_CHROME", "version": "3.0.1", "persistent": false, "connection": { "host": "selenium-ch", "port": 4444 }, "plugins": [], "pass_variables": true }, { "type": "GANACHE", "version": "latest", "persistent": true, "connection": { "host": "ganache", "port": 8545 }, "gas_price": 20000000000, "gas_limit": 90000, "accounts": [ "0xfd7ac8b32e8a2391cad323efd7b162d77dd9ca67806d09877552c38b618713a5:1000000000000000000" ], "pass_variables": true }, { "type": "RABBIT_MQ", "version": "3.7.8", "persistent": true, "connection": { "host": "rabbitmq", "port": 5672, "user": "guest", "password": "guest" }, "pass_variables": true } ], "pipeline": { "url": "https://api.buddy.works/workspaces/buddy/projects/company-website/pipelines/2", "html_url": "https://app.buddy.works/buddy/company-website/pipelines/pipeline/2", "id": 2, "name": "Live mirror", "refs": [ "refs/heads/master" ], "last_execution_status": "SUCCESSFUL", "last_execution_revision": "506a3963507943d6908154f4bc9646e829128a08" } }
STATUS
201 Created
LIMITS
X-Rate-Limit-Limit: 1 X-Rate-Limit-Remaining: 999