Currently I'm trying to build a CD pipeline for our application, which is a typical Maven J2EE
project and we'll deploy a war to Tomcat
container.
Our plan for the CD pipeline looks like this:
CI(Run UT and build the WAR) -> Deploy to DEV -> Deploy to SIT -> Deploy UAT -> Deploy PROD
To follow the best practices of CD, we only build the binary(war) once in the CI phase, but we have some configuration files which are different for each environment, so what's the best way to put the related configuration files for each environment during the deployment phase?
We're using Jenkins and the build-pipe-line plugin
to build the pipeline
, are there any recommended plugins to make this happen?
Thanks.
Configuring the artifact
You may employ maven-antrun-plugin to
The ant task should be reused for different environments:
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<configuration>
<tasks>
<echo message="Configuring artifact, ${PIPELINE_STAGE}"/>
<!-- extracting,replacing,repacking -->
</tasks>
</configuration?
Sharing the artifact through pipeline stages
You may find the detail in the Sharing build artifacts throughout the pipeline from this article.