Building and deploying from a CI/CD stack

You might want to share your decision services on an environment where you can develop, test, deploy, and execute them in a continuous way.

Before you begin

Having a dedicated CI/CD stack means that your decision automations are connected to a remote Git repository (remote repository). For more information about connecting to a remote repository, see Connecting to a remote repository automatically or Connecting to a remote repository manually.

About this task

You can use a continuous integration and delivery (CI/CD) stack to manage your builds and deployments.

For that, you need the following minimum requirements:
  • A Git server where you deploy the decision service source files.
  • A Git client to fetch the decision service source files and build them.
  • A settings.xml file (~/.m2/settings.xml) whose sections repositories and pluginRepositories point to the artifact repository.
  • An artifact repository to host the decision build Maven plug-in and the artifacts that are generated for external libraries.
Note: If you do not have your own artifact repository in place, you can find a sample implementation on GitHub, https://github.com/icp4a/automation-decision-services-ci-cd-stack External link opens a new window or tab, for you to install and use.

Procedure

  1. Install the decision build Maven plug-in.

    Follow the instructions given in Setting up your build environment.

  2. Build a decision service with Maven.
    1. Run the following command:
      git clone <URL_git_repo>

      Where <URL_git_repo> is the remote repository to which you connected your decision automation.

    2. Run the following command:
      cd <repo_name>/<project_name> ; mvn clean install

      Where <repo_name> is the name of the repository that is created by the git clone command.

      Where <project_name> is the name of the folder that contains the decision service to be built.

      The Maven command mvn inspects the pom.xml files of the project. It fetches all the dependencies, including the decision service build Maven plug-in that you installed in step 1. It compiles the decision service. Finally, it installs the resulting decision service archive (.jar file) into your local Maven repository (typically $HOME/.m2/repository). This jar file is installed under <repo_name>/<project_name>/.decisionservice/target.
  3. The decision service archive can be deployed by using the decision runtime REST API.

Results

The decision service archive is now ready to be used by the decision runtime to return a decision. For more information, see Executing decision services.