CI File Generator

This plugin uses template files to automatically generate the Jenkinsfile and/or K8 files necessary for building and deploying the application. This will also generate a dibr.md file that contains deployment information such as required consul and vault variables.

NOTE: With Release 3.0 ci-file-generator will generate a separate Jenkinsfile for each environment:

  • Jenkinsfile-sandbox - the sandbox Jenkins server

  • Jenkinsfile - SQA and up

For Sandbox Jenkins you will have to modify the job to look for those file names rather than just a plain Jenkinsfile

Plugin Setup

The following steps must be done one time in order to set up the plugin to work on all projects.

Add BitBucket Token to Maven Settings

To use the generator, you must have an account for the VA BitBucket - coderepo.mobilehealth.va.gov

Add your account credentials to the ~/.m2/settings.xml file so that it can be used during Maven builds:

    <server>
      <id>bitbucket</id>
      <username>YourUserName</username>
      <password>YourPassword or Token</password>
    </server>

NOTE: As of Release 3.0 you can use either a plain text password, or a maven encrypted password: mvn --encrypt-password <password>

Project Setup

CFG uses the metadata.yaml file to properly fill out the necessary values, it no longer uses the pom properties except for the values already expected in the pom such as the parent, artifactId, version, etc.
Please see jersey-service-parent::index.adoc for detailed information on each metadata.yaml property

Generate CI Files

The ci-file-generator will be run by default with jersey-service-parent. In order to skip running one of the mojos you can use one of the following profiles

$ mvn package -Pskip-all-generation
$ mvn package -Pskip-generate-jenkinsfile
$ mvn package -Pskip-generate-k8-files
$ mvn package -Pskip-generate-dibr-readme

This should generate (and overwrite) the following files:

  • Jenkinsfile

  • Jenkinsfile-sandbox

  • kubernetes/deployment.yaml

  • kubernetes/horizontalpodautoscaler.yaml

  • kubernetes/service.yaml

  • docs/dibr.md

Be aware that the updated file will blindly overwrite any files that already exist in the repo.

CI File Generator Tile

This project defines multiple modules which are maven-tiles to help compose their pom files to include the configuration for automatically generating specific project files.

This allows projects to leverage the automatic file generation capabilities without inheriting from a parent pom.

Modules

Here are the following modules:

  • Deployment-readme-generator-tile -> This module defines a tile that generates the deployment readme file

  • Jenkins-generator-tile -> This module defines a tile that generates the Jenkins files needed for the project

  • K8-generator-tile -> This module defines a tile that generates the K8 files needed for a project

Usage

Execute mvn clean install within this module to build the child modules that contain the tiles that allow for automatic generation of particular project files.

Kustomize

Canary Deployments

See the Canary Deployment Guide guide.