Promoting a Folder from DEV to PROD

This tutorial demonstrates how to promote a folder and all the jobs within it from a DEV environment to a PROD environment by applying a Deploy Descriptor and deploying the resulting definitions to the PROD environment.

For more information, see Promotion.

Promoting a Folder

This procedure describes how to perform a manual promotion of a folder from DEV to PROD.

Before You Begin

Ensure that you meet the following prerequisites:

  • You have successfully completed API setup, as described in Setting Up the API.

  • You have valid credentials for both the DEV and PROD environments and you have network access to the Automation API endpoints of both environments.

Begin

  1. Register the DEV and PROD environments with environment add API commands:

    ctm env add DEV https://<DEV_ENDPOINT>/automation-api <DEV_USER> <DEV_PASSWORD>

    ctm env add PROD https://<PROD_ENDPOINT>/automation-api <PROD_USER> <PROD_PASSWORD>

  2. Set DEV as the default environment by running the environment set API command:

    ctm env set DEV

  3. Export folder definitions from DEV by running the deploy jobs::get API command:

    ctm deploy jobs::get -s "server=<DEV_SERVER>&folder=<FOLDER_NAME>" > data.json

    Folder definitions (including definitions of all jobs within the folder) are saved in a file named data.json.

  4. Author a JSON-format Deploy Descriptor, as described in Deploy Descriptor, and save it as a file named DEV-TO-PROD.json.

  5. Apply the rules in the DEV-TO-PROD.json file to the folder definitions for the PROD environment in a new file named prod_data.json. Use the following deploy transform API command:

    ctm deploy transform data.json DEV-TO-PROD.json > prod_data.json

  6. Validate the new folder definitions against the PROD environment by running the build API command:

    ctm build prod_data.json -e PROD

    The build command validates the transformed folder definitions against the PROD environment without deploying the definitions (that is, a dry run). The response includes information about the numbers of folders, jobs, and connection profiles that would be created in a deployment, as in the following example response:

    Copy
    [
      {
        "deploymentFile": "prod_data.json",
        "successfulFoldersCount": 0,
        "successfulSmartFoldersCount": 1,
        "successfulSubFoldersCount": 0,
        "successfulJobsCount": 2,
        "successfulConnectionProfilesCount": 0,
        "successfulDriversCount": 0,
        "isDeployDescriptorValid": false
      }
    ]
  7. Deploy folder definitions to PROD by running the deploy API command:

    ctm deploy prod_data.json -e PROD

    The following response is an example of a successful deployment:

    Copy
    [
      {
        "deploymentFile": "prod_data.json",
        "deploymentState": "DEPLOY FOLDERS 1/1",
        "deploymentStatus": "ENDED_OK",
        "successfulSmartFoldersCount": 1,
        "successfulJobsCount": 2,
        "deployedFolders": [
          "Folder_1"
        ]
      }
    ]