Skip to content
This repository was archived by the owner on Jul 18, 2019. It is now read-only.

Bug 1395349 - refactor signin to use new client creator, don't store#174

Merged
djmitche merged 1 commit into
masterfrom
use-client-creator
Nov 7, 2017
Merged

Bug 1395349 - refactor signin to use new client creator, don't store#174
djmitche merged 1 commit into
masterfrom
use-client-creator

Conversation

@djmitche
Copy link
Copy Markdown
Contributor

@djmitche djmitche commented Nov 6, 2017

It's best to encourage users to not keep TC credentials on disk, so this
writes them out as env vars instead. The result will still read from
~/.config/taskcluster.yml, just not write to it.

Example:

dustin@jemison $ eval $(./taskcluster signin --scope 'queue:*')
Starting
Listening for a callback on: http://localhost:33459
Opening URL: https://tools.taskcluster.net/auth/clients/new?name=cli&description=Temporary+client+for+use+on+the+command+line&scope=queue:*&expires=1d&callback_url=http%3A%2F%2Flocalhost%3A33459
Credentials recorded as environment variables

dustin@jemison $ ./taskcluster api auth currentScopes
{
  "scopes": [
    "queue:*"
  ]
}

@djmitche djmitche self-assigned this Nov 6, 2017
@djmitche djmitche requested review from helfi92 and jonasfj November 6, 2017 19:54
@djmitche djmitche changed the title Bug - refactor signin to use new client creator, don't store Bug 1395349 - refactor signin to use new client creator, don't store Nov 6, 2017
@djmitche djmitche force-pushed the use-client-creator branch 3 times, most recently from 8a827af to 3d1bd5f Compare November 6, 2017 20:38
Copy link
Copy Markdown
Contributor

@jonasfj jonasfj left a comment

Choose a reason for hiding this comment

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

So this effectively solve these probably we had with AWS... for TC..

Comment thread cmds/signin/signin.go
// Open browser
fmt.Fprintln(cmd.OutOrStdout(), "Listening for a callback on: "+target)
fmt.Fprintln(cmd.OutOrStdout(), "Opening URL: "+loginURL)
fmt.Fprintln(cmd.OutOrStderr(), "Listening for a callback on: "+callbackURL)
Copy link
Copy Markdown
Contributor

@jonasfj jonasfj Nov 6, 2017

Choose a reason for hiding this comment

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

So one would write:

alias taskcluster-login="eval `taskcluster login`"

even better:

taskcluster() {
    if [[ $@ == "login" ]]; then
        eval `taskcluster login`
    else
        taskcluster "$@"
    fi
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could we make an argument like taskcluster login --setup that will install this in /etc/bash_completion.d/ or maybe we can integrate it with the bash completion we have.. (not sure if this abuse of bash_completion).

Or at-least have a section in taskcluster help login that explains how to create these and add them to .bashrc

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I don't want to mess with shell completion. And that function needs some work to properly find the path to taskcluster and not invoke itself recursively (and also to use taskcluster signin not taskcluster login). I think an alias is simpler.

It's best to encourage users to not keep TC credentials on disk, so this
writes them out as env vars instead.  The result will still *read* from
`~/.config/taskcluster.yml`, just not write to it.

Example:

```
dustin@jemison $ eval $(./taskcluster signin --scope 'queue:*')
Starting
Listening for a callback on: http://localhost:33459
Opening URL: https://tools.taskcluster.net/auth/clients/new?name=cli&description=Temporary+client+for+use+on+the+command+line&scope=queue:*&expires=1d&callback_url=http%3A%2F%2Flocalhost%3A33459
Credentials recorded as environment variables

dustin@jemison $ ./taskcluster api auth currentScopes
{
  "scopes": [
    "queue:*"
  ]
}
```
@djmitche djmitche merged commit 11edd11 into master Nov 7, 2017
@t0xicCode t0xicCode deleted the use-client-creator branch November 8, 2017 00:58
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants