Originally published on LinkedIn on 2020-01-19.

In my last article I wrote about Powershell DevOps pipeline and that I would like to use gitlab-ce for that project. So today I combined some things that I’m interessted in, at my homelab. Lets spawn gitlab-ce with podman in a Centos 8.1 VM.

[administrator@podnode01 ~]$ sudo podman run --detach --hostname gitlab.test.vm --env GITLAB_OMNIBUS_CONFIG="external_url 'http://gitlab.test.vm/'"   --publish 443:443 --publish 80:80 --publish 222:22 --name gitlab gitlab/gitlab-ce:latest

Here we go. I create a git project on my local machine and pushed the repository to the gitlab-ce instance.

Lets spawn also a Windows 2019 server in the lab and lets run a Powershell shell gitlab-runner in it.

Es wurde kein Alt-Text für dieses Bild angegeben.

Okay so I have the gitlab-ce server, the powershell gitlab-runner with a “windows” label and a git repository. How to combine those? Just add a .gitlab-ci.yml file inside the git repository.

cat .gitlab-ci.yml  
pages:
 stage: deploy
 tags:
 - windows
 script:
 # run PowerShell Command
 - powershell -Command “Get-Date”
 # run PowerShell script
 # - powershell -File copyFiles.ps1

Okay lets do a commit and a push to see if it triggers a “build”. I know “Get-Date” isn’t a command that triggers a build, but instead of “Get-Date” we can use other powershell scripts like Pester in the future.

Es wurde kein Alt-Text für dieses Bild angegeben.

So this was just a POC. But I took me less than 1 hour to create the machines, and combine those together. I think that is a easy way to create a build pipeline also for Powershell modules and scripts.

The next step will be to run the tests of Pester within the build pipeline.