GET /v1/deploys/status

Get the status of code deployments that Code Manager is currently processing for each environment. You can specify an id query parameter to get the status of a particular deployment.

Request format

When forming Code Manager API requests to this endpoint, the request is a basic call with authentication, such as:

type_header='Content-Type: application/json'
auth_header="X-Authentication: $(puppet-access show)"
uri="https://$(puppet config print server):8170/code-manager/v1/deploys/status"

curl --header "$type_header" --header "$auth_header" "$uri"

A basic request returns the status of all deployments in the queue. You can append the optional id query parameter to get the status of a specific deployment by calling its position in the current deployment queue. For example, this request calls the status of the fifth deployment in the current queue:

type_header='Content-Type: application/json'
auth_header="X-Authentication: $(puppet-access show)"
uri="https://$(puppet config print server):8170/code-manager/v1/deploys/status?id=5"

curl --header "$type_header" --header "$auth_header" "$uri"

Response format

For requests that do not include the id parameter, the successful response is a JSON object describing the status of each deployment in the queue. The body is divided into three secondary objects (deploys-status, file-sync-storage-status, and file-sync-client-status) that report information about deployments depending on the deployments' statuses.:

  • deploys-status: Contains four arrays representing possible code deployment statuses, which are new, queued, deploying, or failed.
    • For each new, queued, deploying, and failed deployment, there is a nested object containing the deployment's position in the queue (id), the environment name (environment), and the time the deployment was put in the queue (queued-at).
    • For failed deployments, there is an additional error object describing the failure (details and corrected-name), the type of error (kind), and a longer error message (msg). Failure information remains in this endpoint's responses until cleaned up by garbage collection, even if the environment has a successful deployment after the failure. For more information, refer to Configuring garbage collection.
    • If there are no deployments with a particular status in the queue, the array for that status is empty.
    • Successfully completed deployments are reported in either the file-sync-storage-status or file-sync-client-status objects.
  • file-sync-storage-status: Contains a deployed object that lists environments that Code Manager has successfully deployed to the code staging directory, but not yet synced to the live code directory. For each deployed environment, the response includes the environment name (environment), the deployment date and time (date), and the commit SHA from the control repo that Code Manager used for the environment's code deploy (deploy-signature).
  • file-sync-client-status: Lists the status of your primary server and each compiler that Code Manager is deploying environments to, including whether the code in the primary server's staging directory has been synced to the live code directory. Contains:
    • all-synced: A Boolean indicating whether all requested code deployments are synced to the live code directories on their respective servers.
    • file-sync-clients: An object containing a list of servers that Code Manager deployed code to. For each server, the response includes the date and time of the server's last check in (last_check_in_time), whether the server synchronized with file sync storage (synced-with-file-sync-storage), and an array of deployment objects associated with that server. Each deployment object includes the environment name (environment), the deployment date and time (date), and the commit SHA from the control repo that Code Manager used for the environment's code deploy (deploy-signature).

For requests that include the id parameter, the response is condensed and uses the following keys to describe the specified deployment:

  • environment: The name of the environment.
  • status: The deployment's status at the time of the response. Can be new, queued, deploying, failed, syncing, or synced.
  • queued-at: The date and time when the deployment was put in the queue.

For example, this is a response for a single deployment:

{
  "environment": "production",
  "id": 1,
  "status": "deploying",
  "queued-at": "2018-05-10T21:44:25.000Z"
}

And this is an example response for an entire deployment queue:

{  
   "deploys-status":{  
      "queued":[  
         {  
            "environment":"dev",
            "id":3,
            "queued-at":"2018-05-15T17:42:34.988Z"
         }
      ],
      "deploying":[  
         {  
            "environment":"test",
            "id":1,
            "queued-at":"2018-05-15T17:42:34.988Z"
         },
         {  
            "environment":"prod",
            "id":2,
            "queued-at":"2018-05-15T17:42:34.988Z"
         }
      ],
      "new":[  

      ],
      "failed":[  
         {
            "environment": "test14",
            "error": {
                "details": {
                    "corrected-name": "test14"
                },
                "kind": "puppetlabs.code-manager/deploy-failure",
                "msg": "Errors while deploying environment 'test14' (exit code: 1):\nERROR\t -> Authentication failed for Git remote \"https://github.com/puppetlabs/puffppetlabs-apache\".\n"
            },
            "queued-at": "2018-06-01T21:28:18.292Z"
         }
     ]
   },
   "file-sync-storage-status":{
      "deployed":[
         {
            "environment":"prod",
            "date":"2018-05-10T21:44:24.000Z",
            "deploy-signature":"66d620604c9465b464a3dac4884f96c43748b2c5"
         },
         {
            "environment":"test",
            "date":"2018-05-10T21:44:25.000Z",
            "deploy-signature":"24ecc7bac8a4d727d6a3a2350b6fda53812ee86f"
         },
         {
            "environment":"dev",
            "date":"2018-05-10T21:44:21.000Z",
            "deploy-signature":"503a335c99a190501456194d13ff722194e55613"
         }
      ]
   },
   "file-sync-client-status":{
      "all-synced":false,
      "file-sync-clients":{
         "chihuahua":{
            "last_check_in_time":null,
            "synced-with-file-sync-storage":false,
            "deployed":[

            ]
         },
         "localhost":{
            "last_check_in_time":"2018-05-11T22:41:20.270Z",
            "synced-with-file-sync-storage":true,
            "deployed":[
               {
                  "environment":"prod",
                  "date":"2018-05-11T22:40:48.000Z",
                  "deploy-signature":"66d620604c9465b464a3dac4884f96c43748b2c5"
               },
               {
                  "environment":"test",
                  "date":"2018-05-11T22:40:48.000Z",
                  "deploy-signature":"24ecc7bac8a4d727d6a3a2350b6fda53812ee86f"
               },
               {
                  "environment":"dev",
                  "date":"2018-05-11T22:40:50.000Z",
                  "deploy-signature":"503a335c99a190501456194d13ff722194e55613"
               }
            ]
         }
      }
   }
}