24.2.1 • Published 3 days ago

@opentext/ocp v24.2.1

Weekly downloads
-
License
Apache-2.0
Repository
-
Last release
3 days ago

OCP command line tool

A command line tool for OpenText Cloud Platform (OCP), allowing packaging and deployment of application projects. Applications for OpenText Cloud Platform can be developed with OpenText Developer Tools for VS Code extensions, see the OpenText extensions in the VS Code Marketplace.

  • Installation
  • Usage info
    • Organization profiles
    • Package and deploy
  • Detailed help and examples
    • Profile management
    • Profile usage examples
    • Tenant configuration
    • Authentication
    • Deployments
    • Service Clients
    • Monitoring deployments
    • Environment variables

Installation

The OpenText Cloud Platform cli can be installed with the following command:

npm install -g @opentext/ocp

Usage info

The following main features are available.

Help info

  • ocp --help : Shows the usage information.
  • ocp <action> --help : Shows the usage information for the specific action.

Organization profiles

  • ocp list-profiles : List the configured organization profiles.
  • ocp update-profile : Add or update an organization profile. One of the profiles must be set as default profile. That profile would be used when no specific profile is specified with the action.
  • ocp delete-profile : Delete the given profile from the profiles configuration.
  • ocp authenticate : Authenticate or Reauthenticate a profile with OCP environment. The profile marked as "default" is used, unless a specific profile is given via the command line.
  • ocp update-profile-properties : Add, update or delete global profile properties, impacting all configured profiles.

Manage tenants per organization

  • ocp add-tenant : Add a new tenant to the given organization profile. You must provide a tenant name and tenant ID. The tenant ID must be a valid UUID and has to match a tenant that is provisioned in the organization referred to via the profile organization id. The first tenant added is set as the default tenant, this can be changed at any time.
  • ocp update-tenant : Updates an existing tenant in the given organization profile. You may change the name and default setting for the tenant. The name must be unique within the list of tenants associated with the organization profile. Within an organization profile there will be only one tenant marked as default.
  • ocp delete-tenant : Delete an existing tenant from the given organization profile. In case the deleted tenant was the default tenant then you will need to set another tenant as default tenant for the organization profile.
  • ocp default-tenant : Mark a specific tenant in the given organization profile, as the default tenant for authentication and deployment.
  • ocp list-tenants : List the tenants currently associated with the specified profile. If no profile is specified the default profile will be used.

Package and deploy

  • ocp deploy : Package, upload and deploy an application project to the OpenText Cloud Platform. The deployment will be monitored until either it completes or the configured timeout is reached.
  • ocp monitor-deployment : Monitor an ongoing deployment or display the final status of a prior deployment.

Application Service Clients

  • ocp regenerate-app-credentials Regenerate the credentials for the service clients associated with the specified profile. If no profile is specified the default profile will be used. As the credentials are associated with a deployed application the command must either be executed within the root directory of the deployable project associated with the application or you must provide the path to the directory containing the deployable project.

Detailed help and examples

Profile management

Organization profiles contain all the configurations required to communicate with the OpenText Cloud Platform environment, down to the appropriate tenants within an allocated organization. You can have multiple organization profiles, where, for example, some point to a development environment and others to a test and production environment, or to an environment in another regions.

Profile Configuration

By default your configuration is held in a sub directory .ot2 found within your home directory. If it does not currently exist a file named profiles.json will be created to hold your profile configuration. This will be updated each time a change is made.

You should avoid manually modifying this file as it may lead to corruption, however within the .ot2 directory you will find backups of the configuration file to assist with any need to recover following an accidental change.

The current backup is called profiles.json.backup and in addition up to 10 additional historic backups are also held profiles.json.backup.1 through to profiles.json.backup.10 where profiles.backup.10 is the oldest backup.

Please be aware that the profile configuration is versioned. An older version of the ocp cli or OpenText Developer Tools extension for VS Code may refuse to run if they encounter a profile configuration that saved in a newer format. If you encounter this scenario then your tooling must be upgraded to the latest versions.

Profile properties

Properties may be configured within the profiles.json file either globally or against a specific profile. Where a property exists both globally and against a profile the version defined against the profile will take precedence.

Note: Profile properties take precedence over any equivalent environment variable. The following profile properties are currently supported:

  • authentication_callback_url : Alternative authentication flow callback URL. Defaults to http://localhost:22682/login/oauth2/code. When using a different value then be sure to configure that URL also as callback URL in the Developer Console.
  • authentication_timeout : Timeout in milliseconds for the authentication flow web authentication process. The default is 180000 (3 minutes).
  • deployment_monitor_timeout : Set the maximum period in milliseconds that we will wait for a deployment to complete whilst monitoring. Exceeding this limit will result in timeout being reported for any non deployed artifacts although the actual deployment continues running. A value of 0 indicates run until completed. Default is 120000 (2 minutes).
  • deployment_monitor_refresh Set the refresh interval in milliseconds for monitoring a deployment. The default is 2000 (2 seconds).
  • upload_max_flow_rate Set the maximum flow rate for model uploads into ALM. The set value is in multiples of Kb hence a value of 25 would indicate 25Kb/s maximum. Setting the property to 0 indicates an unlimited flow rate. The default value is 29 (29,696 bytes / second) for GCP environments and 0 (unlimited) for all other environments.
  • http_upload_timeout The maximum time in ms that the tool will wait for a model data block to be uploaded. Exceeding the timeout is interpreted as a network issue and will result in the upload being aborted. Setting the value to 0 is interpreted as no timeout. The default setting is 10000 (10 seconds).
  • http_upload_max_time The maximum time in ms for the model data upload to complete. The default setting is 0 indicating there is no maximum time set to allow for slow running uploads.
  • http_timeout The maximum time in ms that a request to the ALM is allowed to take exluding the upload of model data. The default setting is set to 30000 (30 seconds).
  • http_timeout_max_retries. The number of times we will attempt to retry upon a timeout to ALM having been encountered. The default setting is 3.

Profile usage examples

ocp list-profiles

Outputs the currently configured profiles as a list.

ocp list-profiles : Lists all profiles defined within the default configuration file:

ocp list-profiles

The following command line switches are accepted:

  • --config_file <file path> : Selects an alternative configuration file to load the profiles from.
  • --project <project name> : When specified then the output will be restricted to those profiles visible to the specified project, suppressing output for profiles targeting a different project or any global profile with the same profile name as a project specific profile. Where not specified all profiles are shown.
  • --extended : When specified then additional information about the profiles is displayed.

The following fields are displayed:

  • Name : The profile name.
  • Project : The project the profile is associated with. Typically this field will be blank.
  • Org Name : The user readable organization name associated with the organization.
  • Org ID : The UUID code for the organization.
  • Default : Set to YES if this is a default profile, otherwise it is blank.
  • Auth Creds (Only with --extended) : Type of configured authentication credentials. Either Public, Confidential or Undefined. The actual configured values are not shown.
  • Authenticated (Only with --extended) : Has the profile previously been authenticated. Shows YES if the profile previously has been authenticated successfully, SUSPECT if previously authenticated but subsequently something has gone wrong or blank if not authenticated.
  • Properties (Only with --extended) : List of properties associated with the profile. There will be 2 lists present in this field. properties - those properties associated with this profile. global properties - those properties configured at a global level and inherited by the profile.

ocp add-profile

ocp add-profile : Add a profile to the configuration. Here is an example of how to to add a profile:

ocp add-profile --profile MyDev --org_id 6bab3d9a-16b1-453b-b6dd-8866a1aa5806 --org_name Acme --client_id 4509843uriejfif9843 --region na-1

The following command line switches are accepted:

  • --profile <name>. This field is mandatory and identifies the name of the profile to add. Note: This field cannot be subsequently modified.
  • --project <name>. This field is optional. It allows a profile to be associated specifically with a project as created by the VSCode tool set. The field cannot be subsequently modified. Note: This is for advanced usage only. The --project switch should be avoided unless you have a specific requirement.
  • --config_file <file path>. Selects an alternative configuration file to load and store the profile from.
  • --org_id <UUID>. When initially creating the profile you must specify a valid ORG ID. Subsequently you only need to specify if there is a need to modify the ORG ID.
  • `--org_name . When initially creating the profile you must specify a name for your organization. Subsequently you only need to specify if there is a need to modify the ORG name.
  • --client_id <ID>. When initially creating the profile you must specify a client ID for authentication purposes. Subsequently you only need to specify if there is a need to modify the client ID.

Note: By default the client ID is a public client ID, however if the --client_secret switch is also specified then this is assumed to be a confidential client ID. It is not possible to subsequently convert from public to confidential and vis-versa.

  • --client_secret <secret>. Sets the associated client_id as confidential and configures the secret for authentication purposes.

Note: If you wish to use confidential credentials then this must be done when the profile is initially created otherwise the profile is assumed to use public credentials.

  • --default. Marks the profile as being the default. Any existing default profile is unset as part of the operation.
  • --region <region>. This is a convenience operation allowing the region property to be easily set. We provide this as the profile must point at a target environment whether this is specified via the region or the apigee_url property. Typically it is assumed that region will be used to specify the environment. If no region or apigee_url is specified then the profile will inherit from the global properties if possible and will error if this is not possible.

Note: Specifying the region via the --region option actually adds a property so "--region na-1-dev" is analogous to "--properties region=na-1-dev".

  • --properties <List of properties>. Allows properties to be added to the profile. The possible profile properties are listed further below.

Examples

  • Setting properties with values:
ocp add-profile --profile MyDev --org_id 6bab3d9a-16b1-453b-b6dd-8866a1aa5806 --org_name Acme --client_id 4509843uriejfif9843 --properties apigee_url=https://devx1.dev.apigee.otxlab.net,authentication_handler=otDeveloperIdp
  • Setting properties with empty values:
ocp add-profile --profile MyDev --org_id 6bab3d9a-16b1-453b-b6dd-8866a1aa5806 --org_name Acme --client_id 4509843uriejfif9843 --region na-1 --properties authentication_handler=
  • Setting the region via --region:
ocp add-profile --profile MyDev --org_id 6bab3d9a-16b1-453b-b6dd-8866a1aa5806 --org_name Acme --client_id 4509843uriejfif9843 --region na-1-dev
  • Setting the region via --profile:
ocp add-profile --profile MyDev --org_id 6bab3d9a-16b1-453b-b6dd-8866a1aa5806 --org_name Acme --client_id 4509843uriejfif9843 --properties region=na-1-dev
  • Setting the apigee_url via --profile:
ocp add-profile --profile MyDev --org_id 6bab3d9a-16b1-453b-b6dd-8866a1aa5806 --org_name Acme --client_id 4509843uriejfif9843 --properties apigee_url=https://devx1.dev.apigee.otxlab.net

ocp update-profile

ocp update-profile : Update an existing profile to the configuration. Here is an example of how to update a profile:

ocp update-profile --profile MyDev --org_id 6bab3d9a-16b1-a53b-b6dd-8866a1aa5807 --org_name "Updated Acme"

The following command line switches are accepted:

  • --profile <name> : This field is mandatory and identifies the name of the profile to update. This field cannot be modified.
  • --project <name> : This field is optional. It allows a profile to be associated specifically with a project as created by the VS Code tool set. This field cannot be modified afterwards. Note: This is for advanced usage only. The --project switch should be avoided unless you have a specific requirement.

  • --config_file <file path> : Selects an alternative configuration file to load and store the profiles from.

  • --org_id <UUID> : When initially creating the profile you must specify a valid organization id. Subsequently you only need to specify it if there is a need to modify it.
  • --org_name <name> : When initially creating the profile you must specify a name for your organization. Subsequently you only need to specify it if there is a need to modify it.

  • --client_id <ID> : When initially creating the profile you must specify a client id for authentication purposes. Subsequently you only need to specify it if there is a need to modify it. Note: By default the client id is seen as a public client id, however if the --client_secret switch is also specified then this is assumed to be a confidential client id. It is not possible to subsequently convert from public to confidential client and vice-versa.

  • --client_secret <secret> : Sets the associated client id as a confidential client and configures the secret for authentication purposes. Note: If you wish to use confidential credentials then this must be specified when the profile is initially created otherwise the profile is assumed to use public credentials.

  • --default : Marks the profile as being the default. Any existing default profile is unset as part of the operation.

  • --region <region> : Sets the region for the speific profile. An organization is created in a specific region (also called stack), for example na-1 or eu-1. The region is used to determine the actual endpoint to authenticate with and where to deploy to. Currently the following regions are available au, ca, eu-1, na-1, na-1-dev and us. Note: Specifying the region via the --region option actually adds a property so "--region na-1-dev" is analogous to "--properties region=na-1-dev".

  • ocp update-profile --profile DEFAULT --properties <list of properties> : Allows properties to be added, replaced or removed from a profile. The possible profile properties are listed further below.

Examples

  • Setting the region via --profile:
ocp update-profile --profile DEFAULT --properties region=na-1-dev
  • Setting a property with value:
ocp update-profile --profile DEFAULT --properties deployment_monitor_timeout=180000
  • Deleting a property:
ocp update-profile --profile DEFAULT --properties deployment_monitor_timeout
  • Setting the region via --region:
ocp update-profile --profile DEFAULT --region na-1-dev

ocp delete-profile

Deletes a profile from your profile configuration file. Note: You may not delete the default profile unless it is the only configured profile. If you need to delete the default profile then first specify a replacement using ocp update-profile --profile <name> --default.

The following command line switches are supported:

  • --profile <name> : This field is mandatory and identifies the name of the profile to be removed.
  • --project <name> : Required where the profile has been previously created against a named project.
  • --config_file <file path> : Indicates that you wish to remove a profile from an alternative configuration file.

ocp update-profile-properties

This command adds, updates and removes global profile properties. These are properties that apply globally to all profiles present within your configuration file. Note: Were a profile also defines a setting for the same global property then the value in the profile will take precedence. The following command line options are supported:

  • --config_file <file path> : Selects an alternative configuration file to load and store the profile from.
  • --properties <list of properties> : Allows properties to be added, replaced or removed from a profile. The possible profile properties are listed further below.

Examples

  • Setting a property with values:
ocp update-profile-properties --properties deployment_monitor_timeout=180000
  • Deleting a property:
ocp update-profile-properties --properties deployment_monitor_timeout

Tenant configuration

The organization configured within a profile will normally contain at least one tenant with potentially other tenants being addition to this. A developer trial account will normally contain a single tenant.

The configured tenants can be associated with a profile for deployment purposes. One tenant will be the default with the others being selectable on demand. The current behavior from the cli will be to deploy to the single default tenant or, in case no default is set, to all tenants in the organization.

ocp add-tenant

Add a new tenant to the provisioned list of tenants. Note: If this is the first tenant then it will automatically be set as the default tenant for deployments.

The following command line options are supported:

  • --profile <name> : Identifies the name of the profile to add the tenant against.
  • --project <name> : This field is optional. It selects a profile that is associated with a project.
  • --config_file <file path> : Selects an alternative configuration file to load the profile from.
  • --tenant_id <UUID> : Specifies the tenant id for the new tenant. Must be specified as a UUID. This must be a tenant id that is part of the organiztion as configured in the profile.
  • --tenant_name <name> : Specifies the tenant name associated with the new tenant. This value is optional and allows a user override of the setting in the Developer console. If not specified then the value is derived directly from the Developer console which ensures a match. Best practice is to not specify the name ensuring we match the Developer Console. If the tenant_name is specified without the corresponding tenant_id parameter then a lookup is performed using the name to locate the corresponding tenant_id from the DEVX Console.
  • --default : Sets this tenant as the default tenant. Any existing default tenant is unset from this role as a consequence.
  • --all_tenants : Add all tenants configured at the DEVX Console to the profile where those tenants are not yet present in the profile.

Note: The first tenant added always defaults to be the default regardless of this switch being specified. Examples:

  • Add a tenant with id 7d90cf7d-d771-4bf0-af52-1502560e3f89. The tenant name is retrieved from the DEVX Console.If this is the first tenant that is added to this specific organization profile then it will be marked as the default tenant:
ocp add-tenant --profile DEV --tenant_id 7d90cf7d-d771-4bf0-af52-1502560e3f89
  • Add a tenant with name Tenant 4. The tenant with name = Tenant 4 is retrieved from the DEVX Console in order to located the tenant ID.If this is the first tenant that is added to this specific organization profile then it will be marked as the default tenant:
ocp add-tenant --profile DEV -- tenant_name "Tenant 4"
  • Add a tenant with id a397b5b9-b6c7-430c-9123-522ae95abb80 and name Tenant 1. If this is the first tenant that is added to this specific organization profile then it will be marked as the default tenant:
* ocp add-tenant --profile DEV --tenant_id a397b5b9-b6c7-430c-9123-522ae95abb80 -- tenant_name "Tenant 1`
  • Add a tenant with id 1963d0d2-fa43-4a85-8703-8737fd532af5 and name Tenant 2. This tenant will be marked as the default tenant with any other tenant previously being set as the default being unset as part of the operation:
ocp add-tenant --profile DEV --tenant_id 1963d0d2-fa43-4a85-8703-8737fd532af5 --tenant_name "Tenant 2" --default
  • Add all unassociated tenants to the profile. The DEVX console is queried to obtain the list of current tenants and any tenants not yet associated with the profile are added. If the result is that only a single tenant is added and present in the profile then this profile will be marked as the default:
ocp add-tenant --profile DEV --all_tenants`

ocp default-tenant

Sets an existing tenant as the default tenant for deployment. Any tenant previously marked as the default is unset from this role as part of the process. The following command line options are supported:

  • --profile <name> : Identifies the name of the profile managing the configured tenants.
  • --project <name> : This field is optional. It selects a profile that is associated with a project.
  • --config_file <file path> : Selects an alternative configuration file to load the profile from.
  • --tenant_id <UUID> : Specifies the tenant id for the tenant. The field is optional, however you must specify either the tenant_id or the tenant_name.
  • --tenant_name <name> : Specifies the tenant name associated with the tenant. The field is optional however you must specify either the tenant_id or the tenant_name.
  • --default <true|false> : Optional switch to set the default value as true or false. If the switch is not specified or is provided without a value then the default behavior is to set default as true.

Example

  • Locates the tenant with id a397b5b9-b6c7-430c-9123-522ae95abb80 and marks it as the default tenant:
ocp default-tenant --profile DEV --tenant_id a397b5b9-b6c7-430c-9123-522ae95abb80

ocp delete-tenant

Deletes either an existing tenant or all tenants from a specified profile.

The following command line options are supported:

  • --profile <name> : Identifies the name of the profile managing the configured tenants.
  • --project <name> : This field is optional. It selects a profile that is associated with a project.
  • --config_file <file path> : Selects an alternative configuration file to load the profile from.
  • --tenant_id <UUID> : Specifies the tenant id for the tenant to delete. The field is optional, however you must specify either the tenant_id, the tenant_name.
  • --tenant_name <name> : Specifies the tenant name associated with the tenant to delete. The field is optional however you must specify either the tenant_id or the tenant_name.

Examples

  • Locates the tenant with name Tenant 1 in the DEV profile and deletes it:
ocp delete-tenant --profile DEV --tenant_name "Tenant 1"

Note: If this tenant is your default tenant then at this point you have no default tenant until a replacement is selected.

ocp update-tenant

Updates an existing tenant.

The following command line options are supported:

  • --profile <name> : Identifies the name of the profile managing the configured tenants.
  • --project <name> : This field is optional. It selects a profile that is associated with a project.
  • --config_file <file path> : Selects an alternative configuration file to load the profile from.
  • --tenant_id <UUID> : Specifies the tenant id for the tenant to update. The field is a UUID and is mandatory.
  • --tenant_name <name> : Specifies a replacement value for the tenant name. The field is optional.
  • --default <true|false> : Optional switch to set the default value as true or false. If the switch is not specified or is provided without a value then the default behavior is to set default as true.

Note: Where a tenant id and a tenant name are specified, the operation will update the tenant name field. It is not possible to modify the tenant id. Delete the tenant and add it again in case the tenant id must be updated.

Examples

  • Locates the tenant with id a397b5b9-b6c7-430c-9123-522ae95abb80, changes the name to New Tenant Name and marks it as the default tenant:
ocp update-tenant --profile DEV --tenant_id a397b5b9-b6c7-430c-9123-522ae95abb80 --tenant_name "New Tenant Name" --default

ocp list-tenants

List the tenants associated with a profile. If it is possible to authenticate with the DEVX console then any unassociated tenants will also be output and any mismatches between the profile and the DEVX console will be shown.

The following options are supported:

  • --profile <name> : Identifies the name of the profile managing the configured tenants.
  • --project <name> : This field is optional. It selects a profile that is associated with a project.
  • --config_file <file path> : Selects an alternative configuration file to load the profile from.

Output Fields

The following fields are output by ocp list-tenants:

  • Tenant ID : The tenant id.
  • Tenant Name : The tenant name.
  • Default : Set to YES if the tenant is a default otherwise left as blank.

Authentication

Note: The authentication option is provided as a convenience mechanism to check the connectivity and correctness of the supplied profile credentials. All operations that interact with ALM will automatically authenticate or re-authenticate as required regardless of whether a previous authentication operation has been invoked.

ocp authenticate

The authenticate action authenticates or re-authenticates with the OpenText Cloud Platform, using the credentials contained within your profile. If the authentication is successful an access token will be obtained and cached for subsequent use. By default authentication is performed against the default profile, however this may be overridden by providing suitable command line switches.

The following command line switches are accepted:

  • --profile <name> : This authenticates using an alternative profile selected from your profile configuration file. Example:
ocp deploy --profile QA
  • --config_file <file path> : Allows you to use an alternative configuration file than the default .ot2/profiles.json.
  • --project <name> : This field is optional. It allows a profile to be associated specifically with a project as created with the OpenText Developer Tools extensions for VS Code.

Examples

  • Authenticate or re-authenticate using the configured default profile:
ocp authenticate

Authenticate or re-authenticate using a profile named "QA":

ocp authenticate --profile QA

Deployments

ocp deploy

ocp deploy : This deploys the project available in the current folder using the default profile. The current folder must contain deployable artifacts and an .otproject file as generated by the OpenText Developer Tools extensions for VS Code. In addition you may specify command line switches to modify the behavior.

  • --profile <name> : This deploys using an alternative profile selected from your profile configuration file.
  • --target <file name> : This generates a deployable package without actually deploying. The package is saved in the current folder and has an .otpp file extension appended.
  • --source <file name> : This takes a previously generated package (as generated by --target) and deploys it using the default profile or other profile as specified via the --profile <name> switch.
  • --tenant_id <UUID> : Specifies the tenant to deploy against as opposed to the default tenant. Note: Where tenants exist within your selected profile the tenant_id must match a configured tenant, however where the tenant list is empty you may specify any valid tenant id.

  • --tenant_name <name> : Allows the deployment tenant to be selected using it's configured name. This is likely to be easier to use than the tenant id. The selected tenant must exist within your profile.

  • --all_subscribed_tenants <true | false>. The deployment will target all tenants currently subscribed to by the application. The true | false switch value is considered optional and if not present it is assumed set to true. Note: Setting the switch value to false effectively negates the switch so removes it from the command line. When deploying to all subscribed tenants the tenants currently defined within the profile are ignored. However it is possible to add additional tenants to the set of subscribed tenants by using this option in conjunction with the --tenant_id or --tenant_name switches.
  • --app_credentials_output <file path>. If set then the credential properties generated when an application is initially created will be saved in the properties file indicated by the file path. These properties will be merged into any exiting properties present in the target file. The following properties will be written if available:
    • APPLICATION_ID=\
    • PUBLIC_CLIENT_ID=\
    • CLIENT_ID=\
    • CLIENT_SECRET=\

Note: The target credentials file is validated as being a suitable properties file before the deployment and should an issue be identified then the deployment will abort. Also be aware that the actual properties are only writen on initial application creation. For subsequent runs there will be no output.

  • --config_file <file path> : Allows you to use an alternative configuration file than the default .ot2/profiles.json.
  • --client_id <client id> : For use where no profile exists (for example CI/CD). You may manually specify your client id. This will be used as a public client id unless the client_secret switch is also specified in which case it will be used as a confidential client id.
  • --client_secret <client secret> : For use where no profile exists. You may manually specify a client secret. If this is done then the associated client_id is assumed to be a confidential client id for authentication purposes.
  • --org_id <UUID> : For use where no profile exists. You may manually specify an organization id.
  • --region : For use where no profile exists. Allows you to point the deployment at the required OpenText Cloud Platform environment.
  • --workspace <path> : Optional parameter allowing you to point the cli at the directory containing your application project. By default the current working directory is used to look for the application artifacts.

Examples

  • Initiate a deployment to the default profile targeting the default tenant:
ocp deploy
  • Initiate a deployment using a profile named "QA" targeting the default tenant:
ocp deploy --profile QA
  • Initiate a deployment using the default profile but targeting a tenant name "Tenant 2":
ocp deploy --tenant_name "Tenant 2"
  • Initiate a deployment to all the tenants currently subscribed to your application adding 2 new tenant subscriptions at the same time:
ocp deploy --all_subscribed_tenants --tenant_id c0b4dca0-e860-4eb9-be7f-3924695abc6b,7e019e2d-afcc-4b3e-bc0c-7413f2825c40

Note: To add multiple additional tenants we are providing a comma separated list of tenant IDs. White space characters are not allowed in the list unless you enclose the list in double quotes "". Regardless the individual tenant IDs must be supplied as correctly formatted and valid UUIDs.

  • This is a typical use-case for CI/CD type environment where no profile is configured. By specifying the client_secret authentication will be via OAuth2 grant type with the client id and client secret being confidential credentials. No user interaction via a browser is required in this case, making it suitable for CI/CD:
ocp deploy --org_id 6dd45f25-e88b-453b-9eab-a1eb157da9a1 --client_id Z7JFAKE363a67joplga56g8IhaDrX1 --client_secret fk195kf94lkdd9 --region na-1-dev --tenant_id a52460e6-ce3a-47c1-9bbc-6bb595a7adaa

Note: It is not possible to specify property overrides. If these are needed you will need to look at using a real profile or make use of environment variables as an alternative (see below for environment variable settings).

Monitoring deployments

Deployments are monitored automatically following a deployment, however for a long running deployment this monitoring may timeout with the actual deployment still progressing. The actual deployment continues even though monitoring has stopped from the cli, so a mechanism is provided to restart the monitoring. Additionally this allows for the final state of a completed deployment to be returned.

ocp monitor-deployment

Restart monitoring a deployment or report the final state of a completed deployment. The following command line options are supported:

  • --deployment_id <id> : The id of the deployment to monitor. The id is returned by the previous ocp deploy command and is a mandatory field.
  • --profile <name> : Identifies the name of the profile associated with the deployment. The default profile will be selected if not specified.
  • --project <name> : This field is optional. It selects a profile that is associated with a project.
  • --config_file <file path> : Selects an alternative configuration file to load the profile from.
  • --timeout <value in ms> : Provides an override value for the timeout configured within the profile. By default the deployment will be monitored for 120000ms. Note: a value of 0 will cause the deployment to be monitored until it eventually completes.
  • --refresh <value in ms> : Provides an override value for the monitor refresh period configured within the profile. By default the deployment state is refreshed every 2000ms.

Service Clients

When an application is first deployed a pair of service clients are automatically generated for the application. Each application has a public service client and a confidential service client. Associated with each service client is a client ID. The confidential client also has an asspciated client secret used for authentication. The public client authenticates using OTConnect and requires the use of a password.

Should the cconfidential client credentials be lost or compromised it is possible to regenerate these by the OCP CLI.

Note: As part of the operation to regenerate the service client credentials the existing public client ID will be returned. This is never changed hence we are only regenerating the confidential service client credentials which will return a new client ID and client secret pair.

ocp regenerate-app-credentials

Regenerate the service client credentials.

The following command line options are supported:

  • --profile <name>. This field is optional. Identifies the name of the profile used to originally deploy the application. If not specified the default profile will be used.
  • --project. This field is optional. It selects a profile that is associated with the project by name.
  • --workspace <path to project workspace>. This field is optional. If specified it will contain the path to the project workspace folder used for the original deployment. This may be an absolute or relative path. If not specified it is assumed that the current directory path contains the project workspace.
  • --config_file <path to config file>. This field is optional. If specifoed an alternative config file will be used to load the profile.
  • --force. By default the ocp cli will ask the user to confirm they wish to regenerate the service client credentials and will abort if not confirmed. By specifying the --force switch the confirmation check will be skipped.
  • --app_credentials_output <file path> If set then the regenerated service client credential properties generated will be saved in the properties file indicated by the file path. These properties will be merged into any exiting properties present in the target file. The following properties will be written if available:
    • APPLICATION_ID=\
    • PUBLIC_CLIENT_ID=\
    • CLIENT_ID=\
    • CLIENT_SECRET=\

Examples

  • Regenerate the credentials for the default profile from the workspace directory used for the initial deployment:
ocp regenerate-app-credentials
  • Regenerate the credentials for the default profile specifying the path to the workspace:
ocp regenerate-app-credentials --workspace ./my_project
  • Regenerate the credentials for a specific profile whilst providing the path to the workspace:
ocp regenerate-app-credentials --profile MY_PROFILE --workspace ./my_project
  • Regenerate the credentials for a specific project and workspace directory whilst saving the output to an environment file:
ocp regenerate-app-credentials --profile MY_PROFILE --workspace ./my_project --app_credentials_output project_props.env

Environment variables

The following environment variables can be used. They can be set in the context or in the .env.

  • OCP_REGION : the region that points to the runtime environment.
  • EXCLUDES : an array of folder names that need to ignored when deploying. Default value is [".git"].
  • OCP_ORGANIZATION_ID : Organization id to authenticate against.
  • OCP_ORGANIZATION_CLIENT_ID : Organization client id for authentication.
  • OCP_ORGANIZATION_CLIENT_SECRET : Organization client secret for immediate authentication in conjunction with the client id.
  • OCP_AUTHENTICATION_CALLBACK_URL : Authentication flow callback endpoint - defaults to http://localhost:22682/login/oauth2/code.
  • OCP_LOGIN_TIMEOUT : timeout period in milliseconds to wait for the authentication flow to return from the login page. Defaults to 180000 (3 minutes).
  • OCP_DEPLOYMENT_MONITOR_TIMEOUT : timeout period in milliseconds to wait for a deployment to complete. Defaults to 120000 (2 minutes if unset). A value of 0 indicates wait indefinitely otherwise the minimum allowed value is 100.
  • OCP_DEPLOYMENT_MONITOR_REFRESH : refresh period in milliseconds for monitoring of an on going deployment. Defaults to 2000 (2 seconds) if unset. The minimum allowed value is 100.
  • OCP_TENANT_ID : Tenant id to target for deployment.

Environment variables can be set or put in an .env file in the root of the project folder.  Please note that the environments variables are only picked up when there is no profiles.json available.

Keywords

  • ALM
  • Developer Tools
  • OpenText Cloud Platform