PSGitLab
PSGitLab copied to clipboard
Automated Unit Testing / Continuous Integration
It would be really nice to have automated unit testing.
That could be realised with a gitlab docker image and a continuous integration tool into this repo.
The idea behind that is to avoid bugs like #85
I like this idea. A lot.
I don't think I'll have issues generating a key on the fly (http://stackoverflow.com/questions/23640961/gitlab-api-how-to-generate-the-private-token). The issue would be finding a service like appveyor that supports docker images. I wouldn't want to restrict PSGitLab development to users who understand docker and I would like to make sure that all commits run against this sort of testing.
I recommend using Travis CI. That service allows using docker see here.
I recommend that we first wait until PowerShell 6 is released. It supports also Linux...
I got to use Travis CI lately for some Ansible roles I've built. Pretty slick. I was able to get the latest version of PowerShell installed on Ubuntu Trusty using the following .travis.yml file.
I've been looking into this issue further and currently have a roadblock. GitLab no longer comes configured with a default username and password. I need a way to set credentials on a brand new instance. Once that is done I think I'm close.
useful snippet
$URI = 'http://10.5.116.121:10080//api/v4/session?login=root&password=Pass1word!'
$Body = @{
login='root'
password='Pass1word'
email='[email protected]'
}
$Session = Invoke-RestMethod -Uri $URI -Method Post
$Headers = @{
'PRIVATE-TOKEN'= $($Session.private_token)
}
Invoke-RestMethod -Uri 'http://10.5.116.121:10080/api/v4/projects' -Headers $Headers
Building on GitLab and using GitLab CI also lets you use docker images, fwiw.
https://docs.gitlab.com/omnibus/docker/README.html#pre-configure-docker-container
https://docs.gitlab.com/ce/administration/environment_variables.html
@TerrapinStation asked offline if he could contribute to this and I say I'm all for it. Here is my to-do list.
- [x] Set Access Token to a known value to bypass first-time user prompts.
- [ ] Skip integration tests when running Pester locally ( need to rework the Invoke-Build task )
- [ ] Only run Integration tests in CI env but should support running by hand if the developer wants
- [ ] Successfully run the Get-GitlabUser integration test found here
Please track all work against the travis branch as that is where I'm keeping the work. Until it is ready for production.