Build

In programming terms, the build is the version of the program or product, but the term is also used to refer to the continuous integration of DevOps. So we should be sure of the build of the code is built each time code is committed into the Git repository. The reason for this is because there are many developers involved in such projects, working individually on their own machines, which might work fine. But until the code is committed and built on the continuous integration server, which will trigger source code analysis and unit testing on the committed code, we won't know if we have pushed broken code. So it is essential to trigger a build with every commit.

The artifact of a successful build should always be versioned. The best practice is to version them on the Nexus repository, so that all the nonproduction builds should be pushed into snapshot repositories of the nexus and the release candidate should be pushed into the release repository of the nexus. This process will help us to keep the release build separate from the snapshot build, which is temporary and should be regularly purged, as it is created for each build and will not be needed later.

The build should also trigger source code analysis, which could be linting for a Node.js and Python application, and if you are using Java or C#, then there are lots of tools available for source code analysis. The source code analysis will make sure that the proper coding standards are followed by developers. It also performs security checks and checks for cyclomatic complexity within the code. The tools will generate reports as well, and we can also set a threshold for the source code analysis pass parameters that will eventually pass the build. So if the source code analysis checks are below the baseline set, then the build will fail and then the developer will have to fix the issue.

If we are using Java as a language for serverless, then there are many open source tools available for us to use, such as PMD, Checkmarx, Checkstyle, FindBugs, and SonarQube. SonarQube is a popular tool for source code analysis. It supports lots of languages, such as Java, C# , Node.js, and Python. It also has a lovely dashboard and is pretty easy to install and configure. The SonarQube official image is there on Docker Hub. You can set it up and give it a try. 

You can find the SonarQube image on Docker Hub at https://hub.docker.com/_/sonarqube/.