Jenkins Calling a REST API to Report Status

The Problem: Testing and Managing Lots of Hardware for Different Projects is Hard

Today will be another day I present Jenkins as a solution to one of our problems where I currently work.

We test hardware using different equipment APIs.  We use all these APIs through software through an internal home-grown tool.  This tool has a REST API (see more about what REST is here).  We have run into issues where we may have 6-10 different pieces of hardware at a given time.  In addition to multiple pieces of hardware to test, several people are modifying both the hardware or the software during that time.  To make matters worse, the hardware sits in a different building than where the software testers sit.

This can get really convoluted very quickly.

Maze

  • How do you know if the hardware is still available?  If it is, how do you know someone didn’t accidentally leave a cable unplugged?
  • How do you know if the tests are consistent?  Testing hardware can sometimes pass with one run and fail on the next run.  Inconsistency is bad.
  • From a management perspective, how can you keep both software and hardware teams accountable?  How do you know what is “done” is really done?

Those can be challenging problems to solve.

Jenkins to the rescue!

Test Software + Jenkins = Match Made in Paradise

Paradise

The test software consists of tests that run multiple different checks to verify pieces of the hardware.  In a nutshell, if a few of these tests pass, we can mark off the hardware as being good-to-go.

Having a few things that can run to validate everything is very nice.  Getting the software to that point has been challenging, but that is another story.  Let’s say the test takes anywhere from 10 minutes – 8 hours to run.

We have limited hardware (and the tests need to be run on each piece of hardware), so we need to use our time on that hardware wisely.  Fortunately, the REST API on our software allows using that software from third-party applications relatively straight-forward.

From Jenkins, we create different jobs for different pieces of that hardware.  So we might have a job for HardwareA, HardwareB, etc.  Each job is scheduled to run shortly after every engineer leaves work or in the morning right before all the engineers get to work.  Those jobs use the REST API to start the test.  It then continues polling the API to determine when the test ends.  Once it is over, it generates an email and sends it to the team.  This has been a really big game-changer for us.

Rather than chasing the status of 5 or 10 different pieces of hardware each morning, Jenkins has automatically told the entire team the status of each of them.

  • Is a cable unplugged?  The test fails and Jenkins lets us know it failed.
  • Are the tests inconsistent?  We will see the test pass perhaps 3 or 4 times during the week and then fail the 5th time.  Time to debug what’s going on.
  • How do I know what is done?  The emails (although they aren’t smart enough yet) can eventually tell us all the steps that were tested as a part of that test.

We can keep adding to this automation to make it easier and easier each morning.  It also scales really well.  Suppose we have 100 pieces of hardware.  The email subject line contains pass or fail messages in them.  If I want to go to that level of granularity, I can filter my email based on those subjects and only looked at failed pieces of hardware in the morning.

Jenkins saves the day!

Superman

Conclusion

Automation can be used in so many pieces of a business to make everyone’s lives so much easier.  Seriously, who enjoys looking through reports to determine what passed, what failed, and what needs work next?  Automation can make these tasks so much easier and more efficient.

The best part about this case was the fact that our software already had a REST API.  This made tying it to Jenkins literally take about 5 or 10 minutes.  And it saves us so much time and keeps us much more accountable.  From a management perspective, I can keep the team accountable, making sure different projects are passing.  It only takes about 5 minutes to sift through those email messages to determine which ones need attention.

Think about how you can use similar technologies and strategies in your own organization to make yourself more productive.  Jenkins can, at times, be low-hanging fruit to track the progress of projects.  The best companies use these types of technologies to make better use of their time.  If you want to compete, you should use this and similar mindsets/technologies too.

Leave a Reply

Your email address will not be published. Required fields are marked *