Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add registerToken support #17

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

flipflopsimsommer
Copy link

No description provided.

@evanlucas
Copy link
Owner

Thanks for the contribution! Can you please explain the change and why it is needed? Thanks!

@flipflopsimsommer
Copy link
Author

why:

i want to deploy servers for projekts as needed, so the first time the server start i will execute ./bin/cmd -u <url> -r <projekttoken> to register it, later the token is in the config and the registertoken will not be needed.

how i understand it:

there are 2 tokens the runner token and the registertoken with wich you need to get a new runner token.
since no runner token is provided in my cmd call it will look for registerToken and register the runner to get the runner toke.

what it does:

i wanted to register and start a new runner from cli without questions.

@flipflopsimsommer
Copy link
Author

@evanlucas let me know if you have more questions or if i should chance something. imho what i added might also be usefull for others.
BR

@zartdinov
Copy link

Actual for me!
I prefer to configure container service once and then just scale up their number.
Every gitlab runner is not so unique for me, I just need free one at some moment of time.
For my runners config I must use "expect" command, cause need to pass reg. token to not friendly gcr dialog interface.

@bushong1
Copy link
Collaborator

Hey @flipflopsimsommer. I'm trying to get these PRs taken care of. Can you clean up the conflicts and rebase off current master? I definitely think this is a good addition.

@flipflopsimsommer
Copy link
Author

@bushong1 can do, i will look at it tomorrow

@flipflopsimsommer
Copy link
Author

@bushong1 let me know if you need anything else, looking forward of using your repo again.

@@ -25,6 +25,7 @@ var gcr = require('../lib/gcr')
, sslcert: path
, sslkey: path
, cacert: path
, registerToken: String
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix spacing to align with the others

@bushong1
Copy link
Collaborator

bushong1 commented Sep 2, 2016

Okay, i added some comments on cleaning it up. I'm also trying to walk through the logic.

So, the main issue is that this application doesn't allow the user to manually set a "Registration Token", and GitLab doesn't allow the user to procure a single-use "Runner Token" outside of the API. To be clear, a Registration Token is what you receive from the gitlab project page/runner registration page. When the application connects the first time, it will take the Runner Token, make a request to api/v1/runners/register.json, and get a "Runner Token", then gcr stores that in the ~/.config/gcr.json.

This update is trying to allow a gcr instance to register without asking a human for input. Logic chart is as follows:

  1. Runner Token = true; Register Token = true OR false
    • Use the Runner Token to request Builds
  2. Runner Token = false; Register Token = true
    • Use the Register Token to request a Runner Token
    • Save Runner Token
    • Use the Runner Token to request Builds
  3. Runner Token = false; Register Token = false
    • Prompt the user for a Register Token
    • Use the Register Token to request a Runner Token
    • Save Runner Token
    • Use the Runner Token to request Builds

Does that sound right?

@bushong1 bushong1 self-assigned this Sep 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants