ngetchell / PSGitLab

An interface for administering GitLab from the PowerShell command line.
MIT License
71 stars 42 forks source link

Automated Unit Testing / Continuous Integration #84

Open lw-schick opened 7 years ago

lw-schick commented 7 years ago

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

ngetchell commented 7 years ago

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.

lw-schick commented 7 years ago

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

ngetchell commented 7 years ago

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 commented 7 years ago

useful snippet

$URI = 'http://10.5.116.121:10080//api/v4/session?login=root&password=Pass1word!'
$Body = @{
    login='root'
    password='Pass1word'
    email='fake@email.com'
}
$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
michaeltlombardi commented 7 years ago

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

ngetchell commented 6 years ago

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

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

ngetchell commented 5 years ago

@TerrapinStation asked offline if he could contribute to this and I say I'm all for it. Here is my to-do list.

Please track all work against the travis branch as that is where I'm keeping the work. Until it is ready for production.