voxpupuli / puppet-gitlab_ci_runner

Module to mange gitlab CI runners. Extracted from https://github.com/voxpupuli/puppet-gitlab
Apache License 2.0
14 stars 53 forks source link

add parameter to specify a ca certificate used to (un)register #130

Closed byteflood closed 1 year ago

byteflood commented 2 years ago

Pull Request (PR) description

Added an optional parameter ca_file to APIClient that can specify a certificate authority file. Added an optional parameter ca_file to gitlab_ci_runner and gitlab_ci_runner::runner

This Pull Request (PR) fixes the following issues

Fixes #124

byteflood commented 2 years ago

I have a question about the following two lines of code.

https://github.com/voxpupuli/puppet-gitlab_ci_runner/blob/9462f7ce515a28de8a30704e2e8e09f4c6bbdb54/spec/functions/register_spec.rb#L22

https://github.com/voxpupuli/puppet-gitlab_ci_runner/blob/9462f7ce515a28de8a30704e2e8e09f4c6bbdb54/spec/functions/unregister_spec.rb#L17

Why do they differ in syntax: => vs :? Are they supposed to be semantically the same?

I'm unfamiliar with Ruby, but from looking through the code, my guess is that : is used to bind optional parameters. And my guess is that => binds keys to values in objects.

It looks to me the first one is correct (register_spec.ruby), except that for this pull request perhaps the argument should be enclosed in {}, so that we can add a 3rd parameter to the function. So that we get:

    allow(PuppetX::Gitlab::Runner).to receive(:register).with(url, { 'token' => regtoken }, ca_file: nil).and_return(return_hash)

However, that leaves me in a situation where I believe that the token is not correctly passed and interpreted by the gitlab instance for bolt tasks, so I must be doing something wrong.

Note that in my local instance, the puppet register code using ca_file actually works (although I'm unsure about unregister).

tuxmea commented 2 years ago

I assume we can close this issue. Fix was merged with #135

vox-pupuli-tasks[bot] commented 2 years ago

Dear @byteflood, thanks for the PR!

This is Vox Pupuli Tasks, your friendly Vox Pupuli GitHub Bot. I noticed that your pull request contains merge conflict. Can you please rebase?

You can find my sourcecode at voxpupuli/vox-pupuli-tasks

bastelfreak commented 1 year ago

I think this is obsolete now. Please reopen it if you think it's still required.