Property referencing is one of the most powerful features in the CloudBees CD product suite. Mastering property referencing will let you extend CloudBees CD to meet your organization’s deployment needs.
This use case shows how to leverage properties to create a flexible deployment model. It assumes that you are developing a CloudBees CD application for a web application deployment to production. The deployment process requires that the application is properly tested in the DEV and QA environments before deploying it to the production. Each of these environments uses different database connections for certifying various aspects of the web application. The QA environment uses a database that is created specifically to test the scalability aspects of the application. The challenge is to determine how to manage the database configuration across these environments.
Start by modeling three environments under a project called Banking:
Then create the appropriate database (DB) credentials in the Banking project for each database used with these stages. Each credential is identified by a name:
For each environment, create a property called
DB_credential and initialize it with its corresponding DB credentials name.
To leverage these properties in an application or component process step, use
$[/myEnvironment/DB_CREDENTIAL] to identify and access the DB credential information as described in these following knowledge base articles:
Using this credential information, you can connect CloudBees CD to the appropriate database and populate the necessary test data. In this use case,
myEnvironment refers to the currently running environment. There are similar shortcuts available for other deploy objects, such as
myEnvironmentTier. You can extend this concept to store environment- or environment-tier specific attributes such as port numbers or URLs.