When running tests in your Cloud Platform CD environment, you may want to copy a database from another Cloud Platform environment into your Cloud Platform CD environment. To sync a database as part of a deployment, perform the following steps:
cde-databases
key to your YAML file as described in
Creating and managing your build definition file.
Any databases you want to copy must be explicitly specified in the
cde-databases
key.For more information about the Cloud Platform CD user interface, see Managing your Pipelines in the Cloud Platform interface. For example build definition files, see Example Pipelines build definition files.
To select a source database for database syncing:
Sign in to the Cloud Platform user interface with an account that has the Execute pipelines permission.
Select the application you want to use.
In the left menu, click Pipelines.
Select More Links > View Application Info.
In the DB Sync source environment, section, select the environment to copy the database from, and your selection will be saved.
After selecting a source database for syncing and adding a cde-databases
key to your YAML file, add a post-deploy
step to your events
key as displayed in the following example, replacing db1
and
db2
with databases listed as parameters in the cde-databases
key:
version: 1.2.0
cde-databases:
- db1
- db2
events:
post-deploy:
steps:
# Deploy the build artifact to an on-demand environment,
# and sync the specified databases.
- deploy:
script:
- pipelines-deploy
- pipelines-sync-dbs db1 db2
In the previous example, the pipelines-deploy
command creates the
environment and deploys the build result. The pipelines-sync-dbs
command
syncs the databases provided as parameters, provided they are also listed as
parameters in the cde-databases
key.
Important
Before performing testing, you should scrub the copy of the database in your Cloud Platform CD environment of any sensitive or personal identifying user information to prevent unintended user notifications or data leaks.