Press "Enter" to skip to content

Tag: automation

Validating Jenkinsfile

I had many problems with Jenkinsfiles lately. The syntax is so picky that after a push my plan fails just because I forgot a comma or something as ridiculous as that. In my opinion there are better human input methods for such a file, like yaml. But hey! I’m not developing Jenkins.

Anyway I just integrated a target into my project makefile to test the validity of the Jenkins file. The only way in this case is to send it to your Jenkins server in order to test it like so:

test: jenkins.validate
jenkins.validate:
    @curl -X POST -F "jenkinsfile=<Jenkinsfile" \
      http://localhost:8080/pipeline-model-converter/validate
    @echo "Jenkinsfile tested."

Is super nice to use the REST API to validate your files but still this has some problems to consider: security (posting to http) or weight of the solution (you need to have a complete Jenkins server in your local host). But that’s not in the scope of this entry.

DevOps with Chef. Sweet.

I needed to setup few servers for QA and provision development environments for my team so I started a small make-based repo where to put all the nasty configuration and provisioning stuff. After few days of work I decided to look for solutions in the world wide web. Then discovered DevOps discipline.

DevOps enlightened me. Is exactly what I was looking for!

I work in an industrial environment with real time and embedded software using tools such as Yocto and scripting. Not related to web development at all and even less with cloud computing… So DevOps was quite far away from my environment, but as a curious guy I started diving into it: Ansible, Docker, Puppet, Salt… And finally I looked into Chef.

Exactly what I was looking for.

Remember my objective: setting up some servers for QA and CI for my team and provisioning our developer environments with the proper tools. Well,  Chef is designed exactly for that!

Why Chef?

Ruby.

If you don’t know about Ruby, it is a small and nifty language. I recommend to start with the koans.

As a developer, having a language instead of some custom file syntax or an obscure engine is allays a plus. Of course you will have some drawbacks enforcing yourself to deal with infrastructure and setup, but depending on the size of your team, is something you may need to deal with it anyway.

If your team is not enlightened yet by DevOps something you will get from Chef among other similar tools are the DevOps mantras:

  • Environment replication.
  • Scalability.
  • Infrastructure as code. (Version controlled)
  • Quality and reliability.

And with Chef, as an open source project, you will also have lots and lots of community support and a complete community repository of recipes: The supermarket.

Where to start?

Is not in the scope of this blog entry to show Chef, but there are lots of information in their learning portal and some nice books to start with. Is a matter of a couple of days to start doing Chef recipes and organizing your infrastructure just learning Ruby and having a nice introductory reading, I personally read Learning Chef.

Please, let me know if this information was helpful for you!

Arduino pneumatic control – revision 2a (I)

I had the opportunity to work around a small platform to perform duration tests using some pneumatic equipment.

It consist on some Festo valves and cylinders and a small Arduino with some shields on it. After a brief revision of the schematics I’ve started to improve the design. Using the same interfaces and pin-out to make it retro-compatible.

If you can, and probably ‘you can’, make it retro compatible: just make it. Don’t waste previous effort until you have a good reason.

This second revision consist on an upgrade on the sensor adaptation inputs to make them software configurable. Also a good documentation was added to the silkscreen layers. And detailed files and information was added to the project.

Lack of documentation is the worst case for incoming engineers. So to keep it clear document all your changes.

This is the list of features (new are in bold)

  • Controls up to 4 solenoids
  • Measures up to 4 analog inputs
  • LCD screen with current status
  • Controllable sensing gain controlled by software
  • Data login into SD card
  • Selectable sensor voltage supply
  • 3 x 4 control keypad
  • LCD controlled by I2C