You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 7 Next »

Introduction

Automatics provides Build and deployment pipeline by making use of Jenkins scripts for creating pipeline jobs to build Automatics projects like Orchestration, properties and Device Manager and giving Docker images as final output. The build job will pull the code of each Automatics Project from CMF repo and build the war files using maven, then the corresponding docker images will be created

Pre-Requisites

  1. A VM should be available and Jenkins server should be installed in it.
  2. Also the below applications should be installed in the VM.
    1. Docker -  The sample shell script can be referred for installing docker - https://get.docker.com/
    2. Maven - version 3
    3. JDK - 1.8
  3. Create a new user group in the VM named "docker" and add the Jenkins user to this user groups the below commands can be referred for the same
    1. Create the docker group.

      $ sudo groupadd docker
      
    2. Add your user to the docker group.

      $ sudo usermod -aG docker $USER
      
    3. Log out and log back in so that your group membership is re-evaluated.

      If testing on a virtual machine, it may be necessary to restart the virtual machine for changes to take effect.

      On a desktop Linux environment such as X Windows, log out of your session completely and then log back in.

      On Linux, you can also run the following command to activate the changes to groups:

      $ newgrp docker 
      
    4. Verify that you can run docker commands without sudo.

      $ docker run hello-world
      

      This command downloads a test image and runs it in a container. When the container runs, it prints a message and exits.

  4. Access to pull the docker base image like tomcat, mysql from dockerhub should be available. If access cannot be provided then those images should be available locally in the Jenkins VM for building docker images of Automatics tools.

Jenkins Pipeline Setup

  1. Login to Jenkins webpage
  2. Click on New Item button at the Left hand side menu
  3. Now Enter the name of the pipeline job and select pipeline option from below and click OK, as shown in the image below
  4. Navigate to the pipeline menu in the options and select "Pipeline script from SCM" in the drop down menu under the header definition. Then select the option Git for SCM. After that provide the Repo URL credentials and the branch. Then click save

The above steps can be used for creating the build pipeline similarly the same steps could be used for creating the deployment pipeline as well.

Running the jobs

  • Build Job

To pull the code from the repository and building the Docker images of each tools the below parameters as shown in the sample images should be populated.


  1. "BUILD_AUTOMATICS_ORCHESTRATION" check box should be ticked for orchestration build to run
  2. In the subsequent steps give the Repo URL, its branch and credentials for Git repo(if any)
  3. Similarly enter the details for Automatics Properties and Device manager
  4. At last press the Build button to start the build

Deployment Job

This job will get the details of VM's in which each of the tools - Orchestration, Automatics Properties and Device Manager should be deployed including the user details for logging in to the VM's and deploy the docker images of the corresponding tools. All the VM's should have the SSH connection to the Jenkins VM for executing the commands as well as copying the docker images from Jenkins VM.  All the tools can be deployed in one execution or each one can be executed individually based on the selection of check box provided. Sample images of the deployment job are as follows


Provide all the fields based on the description provided against each field and press the build button to build the job.

  • No labels