The one who does not make a mistake, usually does nothing. Mistakes happen. However, it is important as to quickly and effectively eliminate and draw conclusions. An effective form of error verification is the well-known by software developers Continuous Integration. One of CI’s most popular tools is Jenkins, which allows you to automate the development process, such as running a test, building a project, or collecting information about your operations by setting up tasks (called “jobs”).
As we all know, developers send source code to the repository. After that, Jenkins starts a game – it can e.g. automatically download the code (for example, from a BitBucket webhook that informs him about it) and goes to the assigned set of actions. This can be i.e. compilation, starting unit tests, adding changes to the test environment. Tasks can be set in different, appropriate way for us. For applications based on modern PHP frameworks and frontend frameworks like React, the first task will be to start Composer to update packages, run webpack to compile JS and CSS files, then run Jenkins to perform the unit tests necessary to test every single part of the application and detect errors in the early phase. In addition, Jenkins can run static code analysis and launch automated tests (such as Selenium) to minimize the need for manual tests or regression testing and simply automatize the entire web application testing process. If you use Docker, it can also build whole docker container images and upload them to Docker Registry (you can use Amazon ECR for that).
Inform and release changes as soon as possible!
The most significant, fundamental feature of continuous integration is communicating information as quickly as possible. We can rely on that with Jenkins. Each deviation detected in the test is appropriately communicated by sending a message to the team’s integrated mailbox or via communicator (e.g. Slack). Jenkins can also gets in touch with developers on Twitter, Skype, or talk to an app on smartphones 🙂
The notification mechanism is extremely easy to work with because it knows almost immediately which code is OK and which does not work properly and needs to be corrected. CI carefully checks for all errors in the code provided by the developer in every new version thrown into the repository. Jenkins will also tell you where the error in the file is located and who is responsible for it [our blog post about the system of “penalties” and “prizes” for team members will be available shortly].
Jenkins will also notify us when the problem is resolved. Appropriate information will reach every programmer interested in the project, and as a result, the entire team is aware of the current status of work and it is easier to plan the tasks. After a successful build process, we can finally release our changes into the selected environment – during daily work, the changes land on the “dev” environment, where programmers and testers can test the given functionality. Jenkins is also responsible for releasing these changes into the “stage” environment as well as production. You will save a lot of time this way, and releases will become easier, more stable, so that they will be done more often.
Static code analysis
One of the next sample things that Jenkins can do, is performing static code analysis – it analyzes syntax correctness, finds dangerous and outdated features, memory leaks, buffer overflows, SQL Injections, it can detect unnecessary code repetitions or unused elements. This allows you to increase productivity, detect bottlenecks or inefficient construction. In addition, we can automatically verify that the developer has actually made the appropriate description in the code for the classes and methods (so-called doc) – if the programmers had forgotten it, it would not be possible to generate documentation for the project. However, it must be remembered that Jenkins is not for writing the documentation itself, but only for the generation and automation of the process.
What can I use Jenkins for?
C#, NodeJS, PHP, Java? It doesn’t matter – Jenkins is for everyone. The application is cross-platform, so it can be installed on Windows, Ubuntu, MacOS. In addition, although Jenkins is written in Java, it is suitable for all projects, even those created in C #/NET. Jenkins supports the automation of some of the code development, test, and documentation procedures. This is a powerful compendium of information about your project. And last, but not least, it really helps in releasing changes to different environments (dev, stage, production). Once used, you’ll see a lot of benefits and save a lot of time. Is it worth? We think you know the answer.