Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
Size: Mime:

doodle-node-cli

Continuous integration PRs Welcome

A collection of useful utilities for Doodlers :toolbox:

Install the CLI

Installing Dependencies

  • Node.js & npm : If you aren't sure if you have Node or npm installed, you can run npm -version or node --version. If they are installed, you will see a version number printed.
  • Vault: This will be used to grab important secrets required for some commands (like creating users, meetings, etc)

Login to NPM

You need to make sure that you have the following added to the global ~/.npmrc file:

@doodle:registry=https://npm-proxy.fury.io/tmf/
@doodlescheduling:registry=https://npm.pkg.github.com/

and that you are logged into the @doodlescheduling scope on npm (so that you can get access to Doodle's GitHub packages):

  1. Create a Personal Access Token (PAT) with read:packages and repo scopes

  2. Login to Github's package repository using the Personal Access Token as the password

    $ npm login --scope=@doodlescheduling --registry=https://npm.pkg.github.com
    

:warning: Important! Some commands require that you are connected to the staging VPN, like adding new test users via add user

Install via NPM

$ npm install --global @doodle/doodle-node-cli

:rainbow: That's it! Now you're ready to run the commands. Hint: run doodle init to get started. More info on that command below 👇

Initial Setup

You will need to get your CLI setup to automatically create test users. This should only need to be done once:

  1. Make sure you have a @doodle-test.com email address (see the warning below)
  2. Run doodle init to setup the initial configuration
  3. When it asks you for a password, this is not the password for the main @doodle-test.com account you entered in the first step (unless you want it to be), it is asking you for the password to use as a default when creating new test accounts with the CLI (but you can override this default with each new test account you create). Note that this password will be stored in plaintext on your machine for the CLI to recall later.
  4. Initial setup complete!

:warning: IMPORTANT! You will need to use an email address in the @doodle-test.com (GSuite) domain when creating test user accounts because these test accounts are required for logging in to our testing environments.

Usage

Once installed, you now have a doodle command in your terminal.

  Usage
    $ doodle <commands> [options]

  Commands
    init               Setup the CLI configuration
    pr             -p  Opens the current branch's pull request on GitHub
    jira           -j  Opens the current branch's ticket on JIRA
    add user       -a  Adds a new Keycloak user
    add meeting    -m  Creates a SchedEx meeting
    release        -r  Deploy a TagFlow project anywhere except production
    release ls         List the most recent tags for a TagFlow project
    repo           -s  Lookup and launch a DoodleScheduling repository
    itests             Build the command needed to run the web-integration-tests
    i18n           -i  Look for problems in the OneSky i18n files (React projects only)
    premium            Change a user's premium status
    jenkins            Launch the Jenkins job for the current repo:branch
    login          -l  Get a JWT token and monolith user data for a user
    trial          -t  Start a trial for a Doodle user
    version        -v  Prints the CLI version number
  
  Options
    If any of these options are set, the command will not prompt you to supply the
    information manually. 

    --email:            The email address to use
    --password:         The password to use
    --target:           The enviornment (staging, devbox, etc)
    --premium:          If set to 'true', make a premium subscription
    --subscriptionName: The subscription name (e.g., '25: Business 1 annual CHF')
    --subscriptionId:   The subscriptionId to use for commands that require it

  Examples
    $ doodle gh
    $ doodle pr
    $ doodle jira
    $ doodle daily
    $ doodle premium
    $ doodle trial --email=user@doodle-test.com

Create New Doodle Users

Want to automate the creation of new user accounts? Of course you do!

Example

Assuming you have gone through the initial setup, you just need to run either one of these commands:

$ doodle add user
$ doodle -a

Lookup Doodle Repositories

Launch an interactive search for DoodleScheduling repositories (with auto-complete)

$ doodle repo

Updating the List of Repositories

If you want to update the list of DoodleScheduling repositories:

  1. Clone the repo
  2. Change (cd) into the doodle-node-cli directory you just cloned
  3. Run node cli.js repo --update
  4. Optional Commit the updated data/repos.json list to a new PR to share the :heart:

:bulb: If you are using the CLI by linking via npm link or yarn link, then you can also run doodle repo --update

Release to Namespace

In order to deploy a repository to a namespace, you will need a PAT or Personal Access Token from Github. You can read about how to get one here. If you ran doodle init you were asked to supply a PAT. If you skipped the PAT in the setup steps, then you can either run doodle init again, or add your PAT manually to the ~/.doodlecli/config.json file.

Then, to deploy a TagFlow-enabled project, simply type:

$ doodle release

and follow the on-screen instructions.

Create a Keycloak Client for a New Enviornment

If your environment does not have a doodle-node-cli keycloak client, then you can easily create one by importing the file config/keycloak-client.json into your Keycloak environment.

  1. Login to the Keycloak UI in your environment
  2. Click on the Clients tab and then click the Create button
  3. Import the file (config/keycloak-client.json)['config/keycloak-client.json'] and click Save
  4. Browse to the Service Account Roles Tab, and in the Client Roles choose realm-management and make sure that manage-users is one of the assigned roles. Without this you can't create new users with the CLI.
  5. Click on the Credentials tab and copy the client Secret to the clipboard
  6. Save your client secret in the appropriate vault path as keycloakClientSecret:
$ vault write secret/doodle/<ENVIORONMENT>/doodle-node-cli/secrets keycloakClientSecret=<CLIENT_SECRET>

:bulb: Use this Vault Login Helper to easily switch between your vault enviornments. If you are trying to connect the doodle-node-cli to a new devbox, then you will want to be logged in to vault using the devbox vault address.

:bulb: Don't forget to open a PR that adds your new devbox to the DOODLE_ENVS constant in the constants.js file.

Development

  1. Clone the repo: git clone git@github.com:DoodleScheduling/doodle-node-cli.git
  2. Change into the directory: cd doodle-node-cli
  3. Install Dependencies: yarn install
  4. Link this project so you can use it "globally": yarn link

Now save your changes and run the commands normally. Since you are linking the project, the command doodle will pull from your local copy of the CLI and not the one installed globally.

:bulb: To "unlink" run $ yarn unlink in the doodle-node-cli root directory.

Publishing

This library is published to the registry using Tagflow.

Publish release candidate

git tag pub.1.0.0-rc.0
git push origin pub.1.0.0-rc.0

Publish release

git tag pub.1.0.0
git push origin pub.1.0.0

:heart: :rainbow: :hamburger: