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

Have `hab setup` check and use `HAB_ORIGIN` and `HAB_AUTH_TOKEN` as defaults #1651

Merged
merged 3 commits into from Jan 19, 2017

Conversation

Projects
None yet
5 participants
@fnichol
Member

fnichol commented Jan 19, 2017

[hab] Use HAB_ORIGIN envvar if present as default origin in hab setup

This change makes the hab setup defaults slightly better, especially
when executed inside a Studio where the HAB_ORIGIN environment
variable is likely to be set. Unless a cli.toml was already present with
the value for origin, the previous behavior was to default the value
to the USER environment variable. For example:

> env USER=seniorcoolpants hab setup

Habitat CLI Setup
=================

...

Set up a default origin? [Yes/no/quit]

  Enter the name of your origin. If you plan to publish your packages
  publicly, we recommend that you select one that is not already in use on
  the Habitat build service found at https://app.habitat.sh/.

Default origin name: [default: seniorcoolpants]

Create origin key pair

  It doesn't look like you have a signing key for the origin
  `seniorcoolpants'. Without it, you won't be able to build new packages
  successfully.

  You can either create a new signing key now, or, if you are building
  packages for an origin that already exists, ask the owner to give you
  the signing key.

  For more information on the use of origin keys, please consult the
  documentation at https://www.habitat.sh/docs/concepts-keys/#origin-keys

Create an origin key for `seniorcoolpants'? [Yes/no/quit] quit

With this change, the presence of the HAB_ORIGIN environment variable
will be preferred over the USER environment variable. For example:

> env USER=seniorcoolpants HAB_ORIGIN=admiralsweaterjacket hab setup

Habitat CLI Setup
=================

...

Set up a default origin? [Yes/no/quit]

  Enter the name of your origin. If you plan to publish your packages
  publicly, we recommend that you select one that is not already in use on
  the Habitat build service found at https://app.habitat.sh/.

Default origin name: [default: admiralsweaterjacket]

Create origin key pair

  It doesn't look like you have a signing key for the origin
  `admiralsweaterjacket'. Without it, you won't be able to build new
  packages successfully.

  You can either create a new signing key now, or, if you are building
  packages for an origin that already exists, ask the owner to give you
  the signing key.

  For more information on the use of origin keys, please consult the
  documentation at https://www.habitat.sh/docs/concepts-keys/#origin-keys

Create an origin key for `admiralsweaterjacket'? [Yes/no/quit] quit

[hab] Use HAB_AUTH_TOKEN envvar if present as default auth token in hab setup

This change makes the hab setup defaults slightly better, especially
when a user has their HAB_AUTH_TOKEN environment variable set. Now,
unless a cli.toml was already present with the value for auth, the
value of the HAB_AUTH_TOKEN will be used if present as the default.
For example:

> env HAB_AUTH_TOKEN=wakkawakka hab setup

Habitat CLI Setup
=================

...

GitHub access token: [default: wakkawakka]
Analytics

  The `hab` command-line tool will optionally send anonymous usage data to
  Habitat's Google Analytics account. This is a strictly opt-in activity
  and no tracking will occur unless you respond affirmatively to the
  question below.

  We collect this data to help improve Habitat's user experience. For
  example, we would like to know the category of tasks users are
  performing, and which ones they are having trouble with (e.g. mistyping
  command line arguments).

  To see what kinds of data are sent and how they are anonymized, please
  read more about our analytics here:
  https://www.habitat.sh/docs/about-analytics/

Enable analytics? [Yes/no/quit] quit

fnichol added some commits Jan 19, 2017

[hab] Use `HAB_ORIGIN` envvar if present as default origin in `hab se…
…tup`.

This change makes the `hab setup` defaults slightly better, especially
when executed inside a Studio where the `HAB_ORIGIN` environment
variable is likely to be set. Unless a cli.toml was already present with
the value for `origin`, the previous behavior was to default the value
to the `USER` environment variable. For example:

```
> env USER=seniorcoolpants hab setup

Habitat CLI Setup
=================

...

Set up a default origin? [Yes/no/quit]

  Enter the name of your origin. If you plan to publish your packages
  publicly, we recommend that you select one that is not already in use on
  the Habitat build service found at https://app.habitat.sh/.

Default origin name: [default: seniorcoolpants]

Create origin key pair

  It doesn't look like you have a signing key for the origin
  `seniorcoolpants'. Without it, you won't be able to build new packages
  successfully.

  You can either create a new signing key now, or, if you are building
  packages for an origin that already exists, ask the owner to give you
  the signing key.

  For more information on the use of origin keys, please consult the
  documentation at https://www.habitat.sh/docs/concepts-keys/#origin-keys

Create an origin key for `seniorcoolpants'? [Yes/no/quit] quit
```

With this change, the presence of the `HAB_ORIGIN` environment variable
will be preferred over the `USER` environment variable. For example:

```
> env USER=seniorcoolpants HAB_ORIGIN=admiralsweaterjacket hab setup

Habitat CLI Setup
=================

...

Set up a default origin? [Yes/no/quit]

  Enter the name of your origin. If you plan to publish your packages
  publicly, we recommend that you select one that is not already in use on
  the Habitat build service found at https://app.habitat.sh/.

Default origin name: [default: admiralsweaterjacket]

Create origin key pair

  It doesn't look like you have a signing key for the origin
  `admiralsweaterjacket'. Without it, you won't be able to build new
  packages successfully.

  You can either create a new signing key now, or, if you are building
  packages for an origin that already exists, ask the owner to give you
  the signing key.

  For more information on the use of origin keys, please consult the
  documentation at https://www.habitat.sh/docs/concepts-keys/#origin-keys

Create an origin key for `admiralsweaterjacket'? [Yes/no/quit] quit
```

Signed-off-by: Fletcher Nichol <fnichol@nichol.ca>
[hab] Use `HAB_AUTH_TOKEN` envvar if present as default auth token in…
… `hab setup`.

This change makes the `hab setup` defaults slightly better, especially
when a user has their `HAB_AUTH_TOKEN` environment variable set. Now,
unless a cli.toml was already present with the value for `auth`, the
value of the `HAB_AUTH_TOKEN` will be used if present as the default.
For example:

```
> env HAB_AUTH_TOKEN=wakkawakka hab setup

Habitat CLI Setup
=================

...

GitHub access token: [default: wakkawakka]
Analytics

  The `hab` command-line tool will optionally send anonymous usage data to
  Habitat's Google Analytics account. This is a strictly opt-in activity
  and no tracking will occur unless you respond affirmatively to the
  question below.

  We collect this data to help improve Habitat's user experience. For
  example, we would like to know the category of tasks users are
  performing, and which ones they are having trouble with (e.g. mistyping
  command line arguments).

  To see what kinds of data are sent and how they are anonymized, please
  read more about our analytics here:
  https://www.habitat.sh/docs/about-analytics/

Enable analytics? [Yes/no/quit] quit
```

Signed-off-by: Fletcher Nichol <fnichol@nichol.ca>
[rustfmt] Formatting due to rustfmt.
Signed-off-by: Fletcher Nichol <fnichol@nichol.ca>

@fnichol fnichol added the Feature label Jan 19, 2017

@fnichol

This comment has been minimized.

Show comment
Hide comment
@fnichol
Member

fnichol commented Jan 19, 2017

gif-keyboard-8069186328272379790

@eeyun

This comment has been minimized.

Show comment
Hide comment
@eeyun

eeyun Jan 19, 2017

Contributor

Oh, I ❤️ this.

Contributor

eeyun commented Jan 19, 2017

Oh, I ❤️ this.

@fnichol

This comment has been minimized.

Show comment
Hide comment
@fnichol

fnichol Jan 19, 2017

Member

Right? Sure makes a lot of sense when you expected this behavior all along 😄

Member

fnichol commented Jan 19, 2017

Right? Sure makes a lot of sense when you expected this behavior all along 😄

@reset

This comment has been minimized.

Show comment
Hide comment
@reset
Member

reset commented Jan 19, 2017

gif-keyboard-10346361117179315320

@thesentinels approve

@thesentinels

This comment has been minimized.

Show comment
Hide comment
@thesentinels

thesentinels Jan 19, 2017

Contributor

🤘 I am testing your branch against master before merging it. We do this to ensure that the master branch is never failing tests.

Contributor

thesentinels commented Jan 19, 2017

🤘 I am testing your branch against master before merging it. We do this to ensure that the master branch is never failing tests.

@thesentinels

This comment has been minimized.

Show comment
Hide comment
@thesentinels
Contributor

thesentinels commented Jan 19, 2017

:neckbeard: Travis CI has started testing this PR.

@thesentinels

This comment has been minimized.

Show comment
Hide comment
@thesentinels

thesentinels Jan 19, 2017

Contributor

💖 Travis CI reports this PR passed.

It always makes me feel nice when humans approve of one anothers work. I'm merging this PR now.

I just want you and the contributor to answer me one question:

gif-keyboard-3280869874741411265

Contributor

thesentinels commented Jan 19, 2017

💖 Travis CI reports this PR passed.

It always makes me feel nice when humans approve of one anothers work. I'm merging this PR now.

I just want you and the contributor to answer me one question:

gif-keyboard-3280869874741411265

@thesentinels thesentinels merged commit a9f44fc into master Jan 19, 2017

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@thesentinels thesentinels deleted the fnichol/hab-setup-checks-envvars branch Jan 19, 2017

@eeyun eeyun added C-feature and removed Feature labels Jun 6, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment