@opentext/ocp
v24.3.2
Published
OCP CLI for managing application deployments to OpenText IM services
Downloads
1,013
Readme
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™ Thrust Studio 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 local profile list-
: List the configured organization profiles.ocp local profile update
: 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 local profile delete
: Delete the given profile from the profiles configuration.ocp local profile 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 local profile property global-update
: Add, update or delete global profile properties, impacting all configured profiles.
Manage tenants per organization
ocp local profile tenant add
: 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 local profile tenant update
: 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 local profile tenant delete
: 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 local profile tenant default
: Mark a specific tenant in the given organization profile, as the default tenant for authentication and deployment.ocp local profile tenant list
: List the tenants currently associated with the specified profile. If no profile is specified the default profile will be used.
Package and deploy
ocp local package 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 local package create
: Creates a package from the current folder project, with the default package name as<Project name>_<Application version>.otpp
.ocp local package upload
: Uploads a package to ALM consisting of zero or more models. The package may be subsequently deployed as desired.ocp alm deployment monitor
: Monitor an ongoing deployment or display the final status of a prior deployment.
Application Service Clients
ocp alm 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 subdirectory .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™ Thrust Studio
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 tohttp://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 is180000
(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 of0
indicates run until completed. Default is120000
(2 minutes).deployment_monitor_refresh
Set the refresh interval in milliseconds for monitoring a deployment. The default is2000
(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 to0
indicates an unlimited flow rate. The default value is29
(29,696 bytes / second) for GCP environments and0
(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 to0
is interpreted as no timeout. The default setting is10000
(10 seconds).http_upload_max_time
The maximum time in ms for the model data upload to complete. The default setting is0
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 excluding the upload of model data. The default setting is set to30000
(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 is3
.
Profile usage examples
ocp local profile list
Outputs the currently configured profiles as a list.
ocp local profile list
: Lists all profiles defined within the default configuration file:
ocp local profile list
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 local profile add
ocp local profile add
: Add a profile to the configuration. Here is an example of how to to add a profile:
ocp local profile add --name MyDev --org 6bab3d9a-16b1-453b-b6dd-8866a1aa5806 --org-name Acme --pub-client-id 4509843uriejfif9843 --region na-1
The following command line switches are accepted:
--name <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 <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.
--pub-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.This adds a public client ID.--conf-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.This adds a confidential client ID.--secret <secret>
. Sets the the client secret associated with a confidential client ID.--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 theregion
or theapigee_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 local profile add --name MyDev --org 6bab3d9a-16b1-453b-b6dd-8866a1aa5806 --org-name Acme --pub-client-id 4509843uriejfif9843 --properties apigee_url=https://devx1.dev.apigee.otxlab.net,authentication_handler=otDeveloperIdp
Setting properties with empty values
:
ocp local profile add --name MyDev --org 6bab3d9a-16b1-453b-b6dd-8866a1aa5806 --org-name Acme --pub-client-id 4509843uriejfif9843 --region na-1 --properties authentication_handler=
Setting the region via --region:
ocp local profile add --name MyDev --org 6bab3d9a-16b1-453b-b6dd-8866a1aa5806 --org-name Acme --pub-client-id 4509843uriejfif9843 --region na-1-dev
Setting the region via --profile
:
ocp local profile add --name MyDev --org 6bab3d9a-16b1-453b-b6dd-8866a1aa5806 --org-name Acme --pub-client-id 4509843uriejfif9843 --properties region=na-1-dev
Setting the apigee_url via --profile
:
ocp local profile add --name MyDev --org 6bab3d9a-16b1-453b-b6dd-8866a1aa5806 --org-name Acme --pub-client-id 4509843uriejfif9843 --properties apigee_url=https://devx1.dev.apigee.otxlab.net
ocp local profile update
ocp local profile update
: Update an existing profile to the configuration. Here is an example of how to update a profile:
ocp local profile update --name MyDev --org_6bab3d9a-16b1-a53b-b6dd-8866a1aa5807 --org-name "Updated Acme"
The following command line switches are accepted:
--name <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 <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.--pub-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. This specifies a public client ID.--conf-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. This specifies a confidential client ID.--secret <secret>
: Specifies a confidential client secret for use in conjunction with a confidential client..--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 specific 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 availableau
,ca
,eu-1
,na-1
,na-1-dev
andus
.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.ocp local profile update --name 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
--properties
:
ocp local profile update --name DEFAULT --properties region=na-1-dev
- Setting a property with value:
ocp local profile update --name DEFAULT --properties deployment_monitor_timeout=180000
- Deleting a property:
ocp local profile update --name DEFAULT --properties deployment_monitor_timeout
- Setting the region via
--region
:
ocp local profile update --name DEFAULT --region na-1-dev
ocp local profile delete
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 local profile update --profile <name> --default
.
The following command line switches are supported:
--name <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 local profile property global-update
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 local profile property global-update update-profile-properties --properties deployment_monitor_timeout=180000
- Deleting a property:
ocp local profile property global-update --properties deployment_monitor_timeout
Tenant configuration
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 local profile tenant add
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:
--name <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 local profile tenant add --name 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 locate 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 local profile tenant add --name 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 local profile tenant add --name 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 local profile tenant add --name 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 local profile tenant add --name DEV --all-tenants`
ocp local profile tenant default
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:
--name <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 thetenant-id
or thetenant-name
.--tenant-name <name>
: Specifies the tenant name associated with the tenant. The field is optional however you must specify either thetenant-id
or thetenant-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 astrue
.
Example
- Locates the tenant with id a397b5b9-b6c7-430c-9123-522ae95abb80 and marks it as the default tenant:
ocp local profile tenant default --name DEV --tenant-id a397b5b9-b6c7-430c-9123-522ae95abb80
ocp local profile tenant delete
Deletes either an existing tenant or all tenants from a specified profile.
The following command line options are supported:
--name <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 thetenant-id
, thetenant-name
.--tenant-name <name>
: Specifies the tenant name associated with the tenant to delete. The field is optional however you must specify either thetenant-id
or thetenant-name
.
Examples
- Locates the tenant with name Tenant 1 in the DEV profile and deletes it:
ocp local profile tenant delete --name 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 local profile tenant update
Updates an existing tenant.
The following command line options are supported:
--name <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 local profile tenant update --name DEV --tenant-id a397b5b9-b6c7-430c-9123-522ae95abb80 --tenant-name "New Tenant Name" --default
ocp local profile tenant list
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:
--name <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 local profile 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:
--name <profile name>
: This authenticates using an alternative profile selected from your profile configuration file. Example:
ocp local profile authenticate --name 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 local profile authenticate --name QA
Deployments
ocp local project deploy
ocp local project 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.--source <file name>
: This takes a previously generated package (as generated byocp package
) 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 thetenant-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-artifacts <true | false>
. The deployment package will include all artifacts regardless of whether they have previously been uploaded. 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. The default behaviour is to only upload artifacts that are considered changed therefore setting this flag may increase the size of the upload.--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=<Unique application ID>
- PUBLIC_CLIENT_ID=<Your public client secret>
- CLIENT_ID=<Your confidential client ID>
- CLIENT_SECRET=<Your confidential 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
.--pub-client-id <client id>
: For use where no profile exists (for example CI/CD). You may manually specify your client id. This option specficies a public client ID.--pub-client-id <client id>
: For use where no profile exists (for example CI/CD). You may manually specify your client id. This option specficies a confidential client ID.--secret <client secret>
: For use where no profile exists. You may manually specify a client secret. This specified a client secret to use in conjunction with the --conf-client-id option.--org <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 local project deploy
- Initiate a deployment using a profile named "QA" targeting the default tenant:
ocp local project deploy --profile QA
- Initiate a deployment using the default profile but targeting a tenant name "Tenant 2":
ocp local project 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 local project 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 local project deploy --org 6dd45f25-e88b-453b-9eab-a1eb157da9a1 --conf-client-id Z7JFAKE363a67joplga56g8IhaDrX1 --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).
ocp local package create
ocp local package create
: creates a package from the current folder project, with the default package name as <Project name>_<Application version>.otpp
In addition you may specify command line switches to modify the behavior.
--package-name <name>
: The package is created with this as filename, but always with extension .otpp.--workspace <path>
: Allowing 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.
ocp local package upload
ocp local package upload
: This uploads the project available in the current folder using the default profile. The current folder must contain uploadable 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 uploads using an alternative profile selected from your profile configuration file.--source <file name>
: This takes a previously generated package (as generated byocp package
) and uploads it using the default profile or other profile as specified via the--profile <name>
switch.--all-artifacts <true | false>
. The upload package will include all artifacts regardless of whether they have previously been uploaded. 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. The default behaviour is to only upload artifacts that are considered changed therefore setting this flag may increase the size of the upload.--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=<Unique application ID>
- PUBLIC_CLIENT_ID=<Your public client secret>
- CLIENT_ID=<Your confidential client ID>
- CLIENT_SECRET=<Your confidential client secret>
Note: The target credentials file is validated as being a suitable properties file before the upload and should an issue be identified then the upload 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
.--pub-client-id <client id>
: For use where no profile exists (for example CI/CD). This specifies a public client ID for authentication purposes.--conf-client-id <client id>
: For use where no profile exists (for example CI/CD). This specifies a confidential client ID for authentication purposes.--secret <client secret>
: For use where no profile exists. You may manually specify a client secret. The client secret is for use in conjunction with the --conf-client-id option.--org <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 upload 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 an upload to the default profile:
ocp local package upload
- Initiate an upload using a profile named "QA":
ocp local package upload --profile QA
- 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 local package upload --org 6dd45f25-e88b-453b-9eab-a1eb157da9a1 --conf-client-id Z7JFAKE363a67joplga56g8IhaDrX1 --secret fk195kf94lkdd9 --region na-1-dev
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 alm deployment monitor
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 previousocp 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 associated client secret used for authentication. The public client authenticates using OTConnect and requires the use of a password.
Should the confidential 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.
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 alm 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=<Unique application ID>
- PUBLIC_CLIENT_ID=<Your public client secret>
- CLIENT_ID=<Your confidential client ID>
- CLIENT_SECRET=<Your confidential client secret>
Examples
- Regenerate the credentials for the default profile from the workspace directory used for the initial deployment:
ocp alm app credentials
- Regenerate the credentials for the default profile specifying the path to the workspace:
ocp alm app credentials --workspace ./my_project
- Regenerate the credentials for a specific profile whilst providing the path to the workspace:
ocp alm 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 alm 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 tohttp://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 to180000
(3 minutes).OCP_DEPLOYMENT_MONITOR_TIMEOUT
: timeout period in milliseconds to wait for a deployment to complete. Defaults to120000
(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 ongoing deployment. Defaults to2000
(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
- OpenText™ Thrust Studio