How to add new services under builds in Jenkins

Overview: Whenever a new service is developed, to test it on the server this service needs to be dockerized and deployed on the cluster. For this, we maintain a build-config.yaml file to enable Jenkins to pull and dockerize the code.

Prerequisites: Ensure that Dockerfile and migrate.sh files are present within the service folder. We have attached a sample for your reference.

Steps:

  1. Checkout master branch of the code repository

  2. Go to the build-config.yaml file present inside build folder within the repository where your code resides -

For e.g. if my code resides in this repository, I will open this build-config.yaml file.

3. Under config key present in build-config.yaml file, we can add an entry of the service for which we want

to package(dockerize) for deployment in the following format -

- name: {BUILD_PATH_PLACEHOLDER} build: - work-dir: {PATH_OF_SERVICE_WITHIN_REPOSITORY} image-name: {SERVICE_IMAGE_NAME} dockerfile: {PATH_TO_DOCKERFILE} - work-dir: {PATH_TO_DATABASE_DOCKERFILE_AND_CONFIGURATIONS} image-name: {DATABASE_CONTAINER_IMAGE_NAME}

4. Run JobBuilder so as to enable the build entry for the new service to appear in Jenkins.