How to Continuously Integrate a Powershell script

336 Views Asked by At

I have written a script which builds out the various IIS sites that a team of developers will use, ideally when a new Dev comes online, to build their IIS they would checkout our get repo then run the script. In the longer term this script would also do various other tasks in an Environment setup. What I now need to do is ensure the script is continuously integrated, as such how do I set up a testing environment to ensure the script still work after each git commit. I.e the steps would be something as follows - New commit is made - spin up fresh VM - Execute script on VM - Assert the script executed properly

3

There are 3 best solutions below

0
E. Staal On

You could start with the following:

  • make sure that script is in source control. That way, the script always matches the version of your code
  • Your're probably using TFS? If thats correct you van use TFS Release management to automate this process for you after one checks-in some code. If your're not using TFS the Octopus Deploy might be a nice alternative
0
Yasirmx On

I would advise using jenkins https://jenkins.io/ as continuous integration. You can trigger a build after a commit is detected.

1
OCram85 On

I recommend using a CI environment containing:

  1. source control and review system
  2. do code reviews in the repo with systems like phabricator, github or gitlab
  3. track your changes with a build server like jenkins
  4. use the build server to trigger your psake and pester tests.
  5. and finally publish your build to the final destinations.