Package com.xebialabs.deployit.ci.mapping

Mappings allow a user to add detailed deployment information to a Deployment CI

See:
          Description

Class Summary
KeyValuePair A key/value pair.
Mapping A ConfigurationItem that can be used to specify that a certain package artifact or resource should be targeted to a specific environment member
SourcePropertyOverridingMapping A mapping that has a list of key/value pairs that can override values of the source.
 

Package com.xebialabs.deployit.ci.mapping Description

Mappings allow a user to add detailed deployment information to a Deployment CI

When deploying a Deployment Package to an Environment with a Deployment you sometimes need to be more precise which artifact in the Deployment Package should go to which member of an Environment. Also differences between environments need different settings and/or actions during the deployment of applications/packages. Database settings for example differ for several environments, hostnames, usernames and password are likely to be different. Mappings and Mappers can handle the logic to perform different actions and change settings according to the environment. Mappings even allow you to override properties of artifacts of a Deployment Package with the SourcePropertyOverridingMapping.

As an example

Lets say you have the following deployment package named "MyApplication"

The environment named "prod_env" where you will deploy the "MyApplication" deployment package to, contains

You want to deploy the "frontend" ear to "frontend_cluster_1" and to "frontend_cluster_2". The "admin" ear should only go to the "admin_server". The "frontend" application is used by more then 10.000 users so therefore it should run on 2 clusters, while the "admin" application is only used by 5 people and should only be accessible from the company network. Therefore it has been decided to split the administration part of the application of the "frontend" part. By using mappings, deployit allows a user to specify which ear should go where.

In the example case it would mean, create a deployment ci, source="MyApplication", target="prod_env" with 3 mappings

The runbook which then will trigger, can get the mappings from the deployment ci and know where the individual ears should be deployed on.

Overriding properties

In the above example there are also 2 datasources in the deployment package, named "myApplication_ds" and "remoteSystem_ds". When deploying these 2 datasources to the environment you might want to specify the location of the database, username and password, because in most environments these properties differ. For example; the datasource in the test environment points to a different database then the datasource in the production environment while some properties, like JNDI name remain the same.

SourcePropertyOverridingMapping

Deployit allows to override properties from a ci which is in the Deployment Package by using the SourcePropertyOverridingMapping. You specify the source of a mapping and the target and add key value pairs for every property you want to override of that ci.

Overriding example

To override the location, username and password properties of the 2 datasources you create a SourcePropertyOverridingMapping mappings. (always a subclass) The runbook can ask the SourcePropertyOverridingMapping for its source and the key, value pairs will be overlayed onto the properties of the source ci.

Optimizing the deployment (isSimilar, isIdentical)

Sometimes when upgrading a deployment package to an environment, certain artifacts in the deployment package are the same. Deployit offers support to find out if certain mappings are identical (All properties are the same, nothing to do) or if they are similar (Identifying properties are the same but some properties are different).

isIdentical

When 2 mappings are identical, that usually means, a runbook does not need to create steps.

isSimilar

When 2 mappings are similar, that usually means, a runbook only needs to create modify steps. Example; change the username of a datasource

When NOT isSimilar or isIdentical

Then the runbook needs to create destroy and create steps.

Using the mappings in your runbook

Deployment newDeployment = deploymentChange.getNewRevision();
List earMappings = newDeployment.getMappingsOfType(EarMapping.class);
Ear ear = earMapping.getSource();
Server server = earMapping.getTarget();
addStep(new DeployEarToServer(ear, server));

Using default mappings in your runbook

Deployit also offers a way to generate mappings for runbooks, see the com.xebialabs.deployit.mapper package.

Version:
1.2


Copyright © 2010. All Rights Reserved.