v1
Double column
API
CLI
JS client

Jobs /

Create normal job

Creates a new normal job

Path parameters

    • projectId

      string required

      ID of the project

Request body

  • {object}
    • name

      string required

      The name of the job.

      min length
      3
      max length
      20
      pattern
      ^[a-zA-Z](-?[a-zA-Z0-9]+((-|\s)[a-zA-Z0-9]+)*)?$
    • description

      string

      A description of the job.

      max length
      200
      pattern
      ^[a-zA-Z0-9.,?\s\\/'"()[\];`%^&*\-_:!]+$
    • billing

      {object} required
      • deploymentPlan

        string required

        The ID of the deployment plan to use.

        pattern
        ^[A-Za-z0-9-]+$
    • backoffLimit

      integer required

      The number of attempts to rerun a job before it is marked as failed.

    • activeDeadlineSeconds

      integer

      The maximum amount of time, in seconds, for a job to run before it is marked as failed.

      min
      1
    • deployment

      (multiple options)

      Where to deploy the job from.

      • {object}

        Deploy from version control

        • vcs

          {object} required
          • projectUrl

            string required

            URL of the Git repo to build.

          • projectType

            string required

            The VCS provider to use.

            one of
            bitbucket, gitlab, github, self-hosted
          • vcsId

            string

            If projectType is self-hosted, the ID of the self-hosted vcs to use.

            pattern
            ^[A-Za-z0-9-]+\/[A-Za-z0-9-]+$
          • dockerFilePath

            string required

            The file path of the Dockerfile.

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

            string required

            The working directory of the Dockerfile.

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

            string required

            The name of the branch to use.

        OR

      • {object}

        Deploy from an external image

        • external

          {object} required
          • imagePath

            string required

            Path of the external image excluding the hostname

          • credentials

            string

            ID of the saved credentials to use to access this external image.

            pattern
            ^[A-Za-z0-9-]+$

        OR

      • {object}

        Deploy from a Northflank build service

        • internal

          {object} required
          • id

            string

            ID of the build service to deploy

            pattern
            ^[A-Za-z0-9-]+$
          • branch

            string

            Branch to deploy

          • buildSHA

            Commit SHA to deploy, or 'latest' to deploy the most recent commit

    • environment

      {object}

      An object containing the environment variables to set for the job.

      • buildArguments

        {object}

        An object containing the build arguments to set for the job.

      Response body

      • {object}
        • id

          string required

          The ID of the newly created job

        • jobType

          string required

          The type of the job created

        • buildInitiated

          boolean required

          Whether the job will be built immediately

        • name

          string required

          The name of the newly created job.

        • description

          string

          The description of the newly created job.

      API
      CLI
      JS client

      POST /v1/projects/{projectId}/jobs/normal

      Example request

      request body

      curl
      curl --header "Content-Type: application/json" \
        --header "Authorization: Bearer NORTHFLANK_API_TOKEN" \
        --request POST \
        --data '{"name":"Example Service","description":"A service description","billing":{"deploymentPlan":"nf-compute-20"},"backoffLimit":0,"activeDeadlineSeconds":600,"deployment":{"vcs":{"projectUrl":"https://github.com/northflank/gatsby-with-northflank","projectType":"github","dockerFilePath":"/Dockerfile","dockerWorkDir":"/","projectBranch":"master"}},"environment":{"variable1":"abcdef","variable2":"12345"},"buildArguments":{"variable1":"abcdef","variable2":"12345"}}' \
        https://api.northflank.com/v1/projects/{projectId}/jobs/normal

      Example response

      200 OK

      Details about the newly created job.

      JSON

      {
        "id": "new-job",
        "jobType": "normal",
        "buildInitiated": true,
        "name": "New Job",
        "description": "This is a new job."
      }

      © 2021 Northflank Ltd. All rights reserved.