orbitalci / orbital

Orbital is a self-hosted CI system for solo/small consulting dev teams. Written in Rust.
GNU General Public License v3.0
29 stars 2 forks source link

adding github creds from file fails if clientId field is not provided #195

Closed eccramer closed 4 years ago

eccramer commented 5 years ago

According to the output of ocelot creds vcs add --help:

Github
 ------
 With Github, instead of creating an OAuth consumer, you must create a personal access token for your account.
 https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/
 a ClientId will not be required, only this token.

Help output says no clientId is required for github credentials, but when adding creds from a file:

eccramer-mbp:ocelotconfigs evancramer$ cat github-test-ocy.yml
vcs:
  - clientSecret: <OMITTED>
    tokenURL:  https://github.com/login/oauth/access_token
    acctName: eccramer
    subType: github
    sshFileLoc: /Users/evancramer/.ssh/id_ed25519
eccramer-mbp:ocelotconfigs evancramer$ ocelot creds vcs add --credfile-loc github-test-ocy.yml
Entry with Account Name eccramer and Vcs Type github already exists. Do you want to overwrite? Only a YES will continue with update, otherwise the client will exit.  YES
Could not add credentials for account: eccramer
Error: rpc error: code = InvalidArgument desc = VCS cred failed validation. Errors are: oauth client id is required

Adding a meaningless clientId makes this work:

eccramer-mbp:github-ocelot-test evancramer$ cat ~/ocelotconfigs/github-test-ocy.yml
vcs:
  - clientId: nada
    clientSecret: <OMITTED>
    tokenURL:  https://github.com/login/oauth/access_token
    acctName: eccramer
    subType: github
    sshFileLoc: /Users/evancramer/.ssh/id_ed25519
eccramer-mbp:github-ocelot-test evancramer$ ocelot creds vcs add --credfile-loc ~/ocelotconfigs/github-test-ocy.yml
Entry with Account Name eccramer and Vcs Type github already exists. Do you want to overwrite? Only a YES will continue with update, otherwise the client will exit.  YES
Succesfully update VCS Credential.
Added credentials for account: eccramer
    detected ssh file location: /Users/evancramer/.ssh/id_ed25519
    Successfully uploaded private key at /Users/evancramer/.ssh/id_ed25519 for GITHUB/eccramer

We should fix this.