v1
Double column
API
CLI
JS Client

Jobs /

Run job

Starts a new job run for the given job

Required permission

Project > Jobs > General > Read

Path parameters

    • projectId

      string required

      ID of the project

    • jobId

      string required

      ID of the job

Request body

  • {object}
    • runtimeEnvironment

      {object}

      An object containing the environment variables overrides to use when running the job. Keys must only contain letters and numbers separated with underscores, may not start with a number

      • deployment

        (multiple options)
        • {object}

          Optional: Override the run to use a previously built commit

          • cmdOverride

            string

            The CMD override to use when running the job.

          • storage

            {object}
            • ephemeralStorage

              {object}
              • storageSize

                integer

                Ephemeral storage per container in MB

                one of
                1024, 5120, 10240, 20480
                min
                1024
                max
                20480
          • internal

            {object}

            Optional: Specify the commit to run

            • 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

            • buildId

              string

              ID of the build that should be deployed

          OR

        • {object}

          Optional: Override the run to use an external image

          • cmdOverride

            string

            The CMD override to use when running the job.

          • storage

            {object}
            • ephemeralStorage

              {object}
              • storageSize

                integer

                Ephemeral storage per container in MB

                one of
                1024, 5120, 10240, 20480
                min
                1024
                max
                20480
          • external

            {object}

            Optional: Specify the external image to run

            • imagePath

              string required

              Image to be deployed. When not deploying from Dockerhub the URL must be specified.

              pattern
              ^(?:(?:https?:\/\/)?([a-zA-Z0-9\-]+\.[a-zA-Z0-9\.\-]+)(\/v1)?)?(?:\/)?([a-zA-Z/-9\.\-_]+)(?:\:([a-zA-Z/-9\.\-_\:]+)|\@([a-zA-Z/-9\.\-_\:]+))$
            • credentials

              string

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

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

    Response body

    • {object}

      Response object.

      • data

        {object} required

        Result data.

        • id

          string required

          The ID of the job run

        • runName

          string required

          The name of the job run

    API
    CLI
    JS Client

    POST /v1/projects/{projectId}/jobs/{jobId}/runs

    Example request

    Request body
    curl
    curl --header "Content-Type: application/json" \
      --header "Authorization: Bearer NORTHFLANK_API_TOKEN" \
      --request POST \
      --data '{"runtimeEnvironment":{"VARIABLE_1":"abcdef","VARIABLE_2":"12345"},"deployment":{"cmdOverride":"nginx -g","storage":{"ephemeralStorage":{}},"internal":{"id":"example-build-service","branch":"master","buildSHA":"latest","buildId":"premium-guide-6393"}}}' \
      http://api.northflank.com/v1/projects/{projectId}/jobs/{jobId}/runs

    Example response

    200 OK

    Details about the new job run.

    JSON

    {
      "data": {
        "id": "d34582a4-35bd-4c71-8e7c-e36999b88723",
        "runName": "example-job-5fcf67bc56e1913e21d49504"
      }
    }

    © 2022 Northflank Ltd. All rights reserved.