v1
Double column
API
CLI
JS Client

Services /

Update service build options

Updates the build options for a given service.

Required permission

Project > Services > General > Update

Path parameters

    • projectId

      string required

      ID of the project

    • serviceId

      string required

      ID of the service

Request body

  • {object}

    Build from a Dockerfile

    • dockerfile

      {object} required
      • buildEngine

        string

        Build engine to use. Defaults to recommended build engine kaniko

        one of
        kaniko, buildkit
      • useCache

        boolean

        Should intermediate image layers be cached? Only supported by Kaniko.

      • dockerFilePath

        string

        The file path of the Dockerfile.

        pattern
        ^\/([a-zA-Z0-9-._]+\/)*[a-zA-Z0-9-._]+$
      • dockerWorkDir

        string

        The working directory of the Dockerfile.

        pattern
        ^\/([a-zA-Z0-9-._]+\/)*[a-zA-Z0-9-._]*$
    • prRestrictions

      [array]

      An array of pull request build rules. Only supported for build services. Each commit belonging to a pull request on a branch that matches one of the provided build rules will be built automatically.

      • string

        A pull request build rule. Can contain * as a wildcard to match multiple branch names. For example, feature/* will build all commits from pull requests from branches that start with feature/.

        pattern
        ^[^?:@$~ [\]{}]*$
    • branchRestrictions

      [array]

      An array of branch build rules. Only supported for build services. Each commit belonging to a branch that matches one of the provided build rules will be built automatically.

      • string

        A branch build rule. Can contain * as a wildcard to match multiple branch names. For example, feature/* will build all commits from branches that start with feature/.

        pattern
        ^[^?:@$~ [\]{}]*$
    • pathIgnoreRules

      [array]

      An array of path ignore rules. A commit will only be built if a file has been changed that does not match any of the ignore rules. Path ignore rules follow .gitignore syntax.

      • string

        A path ignore rule, following .gitignore syntax. For example, *.md will ignore all files ending with .md.

OR
  • {object}

    Build from a Buildpack

    • buildpack

      {object} required
      • builder

        string

        Buildpack stack to use. Defaults to recommended stack HEROKU_20.

        one of
        HEROKU_20, HEROKU_18, GOOGLE_V1, CNB_ALPINE, CNB_BIONIC, PAKETO_TINY, PAKETO_BASE, PAKETO_FULL
      • buildpackLocators

        [array]

        Array of custom buildpacks to use.

        • string

          Url or registry identifier of custom buildpack.

      • buildContext

        string

        The working directory to build in.

        pattern
        ^\/([a-zA-Z0-9-._]+\/)*[a-zA-Z0-9-._]*$
    • prRestrictions

      [array]

      An array of pull request build rules. Only supported for build services. Each commit belonging to a pull request on a branch that matches one of the provided build rules will be built automatically.

      • string

        A pull request build rule. Can contain * as a wildcard to match multiple branch names. For example, feature/* will build all commits from pull requests from branches that start with feature/.

        pattern
        ^[^?:@$~ [\]{}]*$
    • branchRestrictions

      [array]

      An array of branch build rules. Only supported for build services. Each commit belonging to a branch that matches one of the provided build rules will be built automatically.

      • string

        A branch build rule. Can contain * as a wildcard to match multiple branch names. For example, feature/* will build all commits from branches that start with feature/.

        pattern
        ^[^?:@$~ [\]{}]*$
    • pathIgnoreRules

      [array]

      An array of path ignore rules. A commit will only be built if a file has been changed that does not match any of the ignore rules. Path ignore rules follow .gitignore syntax.

      • string

        A path ignore rule, following .gitignore syntax. For example, *.md will ignore all files ending with .md.

OR
  • {object}

    Don't modify build type settings

    • prRestrictions

      [array]

      An array of pull request build rules. Only supported for build services. Each commit belonging to a pull request on a branch that matches one of the provided build rules will be built automatically.

      • string

        A pull request build rule. Can contain * as a wildcard to match multiple branch names. For example, feature/* will build all commits from pull requests from branches that start with feature/.

        pattern
        ^[^?:@$~ [\]{}]*$
    • branchRestrictions

      [array]

      An array of branch build rules. Only supported for build services. Each commit belonging to a branch that matches one of the provided build rules will be built automatically.

      • string

        A branch build rule. Can contain * as a wildcard to match multiple branch names. For example, feature/* will build all commits from branches that start with feature/.

        pattern
        ^[^?:@$~ [\]{}]*$
    • pathIgnoreRules

      [array]

      An array of path ignore rules. A commit will only be built if a file has been changed that does not match any of the ignore rules. Path ignore rules follow .gitignore syntax.

      • string

        A path ignore rule, following .gitignore syntax. For example, *.md will ignore all files ending with .md.

Response body

  • {object}

    Response object.

    • data

      {object} required

      Result data.

    API
    CLI
    JS Client

    POST /v1/projects/{projectId}/services/{serviceId}/build-options

    Example request

    Request body
    Build from a Dockerfile
    curl
    curl --header "Content-Type: application/json" \
      --header "Authorization: Bearer NORTHFLANK_API_TOKEN" \
      --request POST \
      --data '{"dockerfile":{"buildEngine":"kaniko","useCache":false,"dockerFilePath":"/Dockerfile","dockerWorkDir":"/"},"prRestrictions":["feature/*"],"branchRestrictions":["feature/*"],"pathIgnoreRules":["README.md"]}' \
      http://api.northflank.com/v1/projects/{projectId}/services/{serviceId}/build-options
    OR
    Build from a Buildpack
    curl
    curl --header "Content-Type: application/json" \
      --header "Authorization: Bearer NORTHFLANK_API_TOKEN" \
      --request POST \
      --data '{"buildpack":{"builder":"HEROKU_20","buildpackLocators":["https://buildpack-registry.heroku.com/cnb/mars/create-react-app"],"buildContext":"/"},"prRestrictions":["feature/*"],"branchRestrictions":["feature/*"],"pathIgnoreRules":["README.md"]}' \
      http://api.northflank.com/v1/projects/{projectId}/services/{serviceId}/build-options
    OR
    Don't modify build type settings
    curl
    curl --header "Content-Type: application/json" \
      --header "Authorization: Bearer NORTHFLANK_API_TOKEN" \
      --request POST \
      --data '{"prRestrictions":["feature/*"],"branchRestrictions":["feature/*"],"pathIgnoreRules":["README.md"]}' \
      http://api.northflank.com/v1/projects/{projectId}/services/{serviceId}/build-options

    Example response

    200 OK

    The operation was performed successfully.

    JSON

    {
      "data": {}
    }

    © 2022 Northflank Ltd. All rights reserved.