With this blog I would like to offer an overview about building SAP HANA Cloud Platform applications by using an open source based continuous integration development infrastructure.
When you start with cloud application development you are usually not very interested in your build environment right from the beginning. But as soon as you have finished your first steps and implemented your first proof of concept the build topic becomes more important – at least when being confronted with questions like:
Having these questions in mind you probably do cloud application development using agile software methodologies to profit from much faster time-to-market.
So, on one hand we do have the known build infrastructure requirements like: building applications, running automated tests, supporting bug fixing processes and running automated deployments. These requirements belong to the core functionality of every build infrastructure, but additionally we do have demand for a light-weight infrastructure supporting agile and fast processes.
A few years ago, when we started with the development of SAP HANA Cloud Platform, we faced very similar questions inside SAP. After a phase of analysis we decided to setup a build infrastructure based on well-known open source components for two major reasons:
We decided to use Maven as our build tool since it’s open source, has a remarkable community, consists of a small core with a huge plugin ecosystem and finally because it supports versioned components. Maven plugins provide solutions for most of the existing build challenges. In the rare case where functionality is missing we can implement it as Maven plugins on our own.
Describing the advantages and usage of versioned components would be beyond the scope of this blog and therefore I can only scratch the surface here. In Maven any built artifact has a version, which is defined in a pom.xml file. Such versioned artifacts are published (deployed) into a maven repository from where they can be consumed by other builds.
In general, Maven distinguishes between development versions and release versions. Development versions end with ‘-SNAPSHOT’ e.g. 1.3.0-SNAPSHOT and are expected to be transient. Release versions like 1.3.0 are expected to be immutable and adhere to Semantic Versioning guidelines.
Let’s assume you want to add a new feature to your cloud application. During the development of a new feature you usually build development versions of your application. You deploy them to your cloud development account (e.g. with the SAP HANA Cloud Deployment Plugin), where the application is tested. With every new build the prior development version is replaced by the latest one. Using transient development versions fits well during the development phase, when you are not very interested in intermediate results. But as soon as you have finished your new feature and want to deploy it to your quality or production account in the cloud, it is strongly recommended to use immutable components, which can be reproduced and fixed. Therefore you build a release version (without ‘-SNAPSHOT’) of your application.
Additionally to the build of that release version you should create a tag in your source code management system (SCM) marking the source revision, which corresponds to the created release build artifact. This helps to find the correct source revision when you need to apply fixes later on.
This raises the question which SCM to use with an open source based development infrastructure. From my personal point of view it is a matter of taste. If you do have a source repository already, you most probably want to continue to use it. Inside SAP we did the same. We reused our existing SCM but in order to provide more flexibility and a code review system to our development teams we decided to go for Git and the code review system Gerrit.
In Gerrit developers comment, discuss and vote on proposed changes. Additionally build servers vote on any proposed source change in Gerrit by running pre-integration builds and automated tests. Only after a change is reviewed and accepted by other developers and the build and tests are successful, a proposed change is pushed into Git. This review process helps us to keep the code quality high. In addition it helps developers to get a common understanding of quality code.
For build servers we separate central build servers and local team build servers. Team build servers produce, test and deploy Maven development artifacts (SNAPSHOT-Versions). The centrally provided build servers produce release versions and apply product standard rules to the build process e.g. restrict dependencies required for the build.
Team build servers are hosted by individual development teams and it’s their choice which build server to use. Most teams use Jenkins, but also Hudson and TeamCity are also used, just to name a few. Team build servers act as continuous integration servers in the development infrastructure. They listen on SCM change events and build those changes right away to provide immediate feedback to developers.
For our centrally provided servers we decided to take Jenkins for similar reasons we picked Maven. It consists of a small core and tons of plugins provided by a strong community around the globe which takes care of its products.
Let me add here that the separation of local and central servers might be not required in your development organization. Inside SAP it helps us as it provides a good balance between flexibility and scalability, but your requirements may vary.
One mandatory component is still missing in the picture. In the Maven section above I told you that Maven artifacts are published into a maven repository from where they can be consumed by other builds. Usually a Maven build process does not just use a single repository, but several repositories. Those repositories are hosted on a repository manager. We decided to use Nexus as repository manager and this was a good choice. Nexus supports permission restrictions on the hosted maven repositories, configuring the lifetime of SNAPSHOT artifacts, and it supports a distributed setup with instances residing in different locations.
Now as we discussed all required components of our development infrastructure, I’d like to show the typical workflow of a developer, in which a new cloud application feature is implemented and released.
I hope this blog helps to get an overview about an open source based development infrastructure. As always in the agile world feedback is welcome and fast feedback appreciated ;-).
PS: If transparency about code quality is desired, consider Sonar as additional component in your development infrastructure.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
23 | |
11 | |
10 | |
9 | |
9 | |
8 | |
7 | |
7 | |
6 | |
6 |