If you follow this blog, or maybe we already met before, you know i’m not a developper, actuallyt, i’m really far away from that 🙂
But, in your life, you can’t be always right, there are (many) times when you need to rethink about the whole situation. that’s exactly what’s happening to me now. And i’m sure, the last Microsoft moves make you start thinking the same as me. Or, you may use PowerShell as you are currently, but be sure that the world will continue moving to the DevOps side and this is an awesome news !Idea There are many good books talking about theses ideas. You should read The phoenix project if you have no idea about what i talk in this post
Yes, this is pretty good, think about a world where developpers will take care about operators point of view, and operators will change their way of scripting to match devs best practice (which actually are pretty good)! This is where we push PowerShell to a greater place, this is where two ways will be create the old one for operators, and the seconds for the devops with big great cool infrastructures figthing alongside with Chef, Puppy, CFEngine, etc.. Gain scalability, readiblity and time using Desired State Configuration on all your infastructure sounds very good, no ?
By talking about best practices, i was meaning source control and unit testing. Source control is a tool we should have used since the start, but we have been dropped with our scripts as operators and the time is always a problem, so we scripted, scripted and scripted. But how about handle the versionning, and how about working together on same scripts ? This is were few tools are coming to help us (Git, Github, Subervsion, etc…) and you might take a look at PoSH-Git which can enable the Git power(Shell) in your favorite console and help you get a very good tools for your daily work !
Github is a good tool too in order to share your work public, or by paying a few amount, in both modes.
Once you have a good version control, your work is pretty safe, you can revert and work as a team on same projects, but now comes the best part of this post: The tests, Unit Testing to be exact, is what we call BDD Testing, and some folks in the community have created an awesome framework : Pester !
The goal of this post is not to show you how Pester works and how you can use it, but to give you ideas about the power of this method of working. IT companies which allow us to bring cool PowerShell stuff in production, now want that automation to take less time between Think, Build and Run phases. So we need set of tools in order to guarantee a good tested stuff bringing to production.
You’ll have to first think about the testbook before build the script, but once tests are done, you will gain time scripting it, and you’ll test your script and/or his result without difficulties, in order to validate your work with no time 🙂
So, take time reading the Pester README file, there are many examples and few links explaining how you can start small to use it !
This is the first part of articles talking about Pester, and i hope you’ll like them!