SQL Components


Build Guide

The build of any component within an xpresso.ai solution is according to the Jenkins Build Pipeline defined for the solution. This, in turn, is governed by the order of stages specified in the Jenkinsfile configuration file, located in the xprbuild folder for each component.

Stages in Jenkins Build Pipeline for Database Components

S. No.

Stage

Description

Steps

Checkout

checks out source code from the code repository and cleans the target folder

Checks out source code from the code repository

Build

Builds the Docker image for the component

Calls make build using the Makefile located at <component root>/xprbuild - this calls <component root>/xprbuild/docker/build.sh

Docker Push

Pushes the new Docker image into the xpresso.ai Docker registry

Calls make dockerpush using the Makefile located at <component root>/xprbuild - this pushes the new Docker image into the registry

Repository Folder Structure for Database Components

The folder structure for any Database component is described in detail below:

Folder

File

Description

Developer Tips

/

Makefile

Makes the solution (see above for details)

Changes will usually not be required to this file. However, it is a good idea to review the actions being performed on various make rules, especially clobber, prepare, build and dockerpush

/src

data.sql

Dummy code for data changes

Store all database code for the component in this folder in this folder (with sub-folders as required)

/src

desired-ddl.sql

Dummy code for DDL changes

/src

desired-dml.sql

Dummy code for DML changes

/xprbuild

Jenkinsfile

Stores the actions performed by the Jenkins pipeline for the component

See above for details. Review, but do not make changes to this file. Make changes to scripts being called by the pipeline if required

/xprbuild/database

Makefile

Dummy Makefile

Builds the component

/xprbuild/database

backup.py

Dummy backup script

Required to back up current database before installing new version of the component

/xprbuild/database

data-migrate.py

Dummy data migration script

Required to migrate current version of data to new version if required

/xprbuild/database

restore.py

Dummy restore script

Required to restore backup data

/xprbuild/database

schema-migrate.py

Dummy script to migrate schema

Required to migrate schema from old to new version

/xprbuild/docker

Dockerfile

Stores commands processed when building the Docker image for the component

Change this file as per the component requirements. See Docker documentation for details

/xprbuild/docker

build.sh

Called during the Build stage of the Jenkins Build Pipeline

Change as per component requirements

/xprbuild/docker

pre-build.sh

Installs various components required by the build. Change as per component requirements

/xprbuild/docker

test.sh