PSGitLab icon indicating copy to clipboard operation
PSGitLab copied to clipboard

Automated Unit Testing / Continuous Integration

Open lw-schick opened this issue 7 years ago • 7 comments

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

lw-schick avatar Dec 07 '16 12:12 lw-schick

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.

ngetchell avatar Dec 08 '16 00:12 ngetchell

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...

lw-schick avatar Jan 09 '17 07:01 lw-schick

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.

ngetchell avatar Mar 04 '17 18:03 ngetchell

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

ngetchell avatar Apr 24 '17 19:04 ngetchell

Building on GitLab and using GitLab CI also lets you use docker images, fwiw.

michaeltlombardi avatar Apr 24 '17 20:04 michaeltlombardi

https://docs.gitlab.com/omnibus/docker/README.html#pre-configure-docker-container

https://docs.gitlab.com/ce/administration/environment_variables.html

ngetchell avatar Feb 07 '18 00:02 ngetchell

@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.

ngetchell avatar Mar 18 '19 16:03 ngetchell