fh-dev-tools

2.16.5 • Public • Published

fh-dev-tools

FeedHenry Development Tools

Install

npm install fh-dev-tools -g

Some commands require the fhcap-cli dev tool to be installed. A version of the fhcap-cli gem is bundled inside of the node module, you should see output similar to the following during the npm install:

  ###################   Install fhcap-cli   ###################

   gem install /usr/local/lib/node_modules/fh-dev-tools/fhcap/pkg/*.gem --local

  #############################################################

Run the outputed command to install a compatible version of the fhcap-cli gem:

gem install /usr/local/lib/node_modules/fh-dev-tools/fhcap/pkg/*.gem --local

More info on fhcap-cli usage and requirements can be found here

Usage

See Available Commands

fh

e.g.

Usage: fh <command> [options] [--debug] [--noprompt]

Commands:
  setup           Setup this tool
  start           [Dev] Start the development work of an issue
  review          [Dev] Create/update pull requests to review the development
                  work
  builds          [Dev] Show latest successful builds associated with a ticket
  deploy          [Dev] (Depreciated) Deploy builds associated with a ticket via
                  fhcap
  merge           [Dev] Merge all the pull requests associated with the ticket
  finish          [Dev] Merge all the pull requests associated with the ticket
                  and resolve the ticket
  contrib         [Dev] List contributors of a component
  templates       [Dev] Templates operations
  sdks            [Dev] SDKs operations
  start-release   [Release] Start the release - create the release branches
  release         [Release] Perform the steps required for a release
  finish-release  [Release] Finish the release
  tag-release     [Release] Tags components for a release. Done as part of
                  finish-release, but can be run separately
  tag-repository  [Util] Used to tag single repository on github. Usefull for
                  bash scripts.
  changelog       [Release] Generate release changelog
  components      [Release] Generate release components versions
  release-notes   [Release] Generate release notes for a version
  deploy-notes    [Release] Generate deploy notes for a version
  versions        [Release] Show all release versions
  release-email   [Release] Send the release email
  report          [Util] Generate weekly JIRA report
  artifact-check  [Util] Generate nsp report for components
  pw              [Util] Lookup a component password e.g. mysql, mongo
  qe-status       [QE] Generate weekly QE status from status emails and JIRA
  test-release    [QE] Assign testers to a release and kick-off testing process
  clone           [Util] Clone all RHMAP components into user working directory.
  fork            [Util] Fork all platform components on github
  list-changes    [Util] Lists changed components for version
  tag-diff        [Util] Lists changed components for 2 different branches/tags
  outdated        [Util] List latest builds for a base branch (e.g. master or
                  FH-v3.x.x) and compares these against fhcap, so you can find
                  "latest" builds which are missing from fhcap
  nagios-check    [Util] Query nagios server for state of services

Options:
  --debug     Show debug level logging
  --noprompt  Skip all the prompts
  --version   Show version number                                      [boolean]

Setup

fh setup

Then answer the questions.

About Github token

During setup, this tool will ask for your Github access token for sending pull requests. This will ensure things work even if you are using two factor authentication.

About Email Setup

During setup, this tool will ask for your Gmail user name and App Password for sending out emails. You should not use your Gmail account's user password here.

If you choose not to set the password, the tool will print out the email content to the console so you can compose the email using other tools. However, the email content will be in Markdown and you may need other tools to support editing emails in Markdown (e.g. You can try Markdown Here). But there is no way to support Mail.app at the moment.

A note about repo setup

By default, this tool will assume there are 2 remotes setup for each component repo:

  • origin - the forked component repo in your own GH account
  • upstream - the original component repo in then fheng organisation account

Many of the commands allows you to override the base branch. See each command's help information for more details.

Commands for dev flow

Start working on a JIRA ticket

fh start -t [JIRA Ticket]

This command will:

  • Get the JIRA ticket details, figure out what components will be changed
  • Creating the new branch in each of the affected component
  • Update the ticket status to 'coding in progress'

Creating PRs for buils and code reviews

fh review -t [JIRA Ticket]

This command will:

  • Get the JIRA ticket details, figure out what components are changed
  • Check if a rebase is required before creating the PR
  • Check if the same PR is already created for those components
  • Create the PR for each component
  • Update the ticket status to 'pull request sent' and add the links of the pull requests

Deploy to PPA

fh deploy -t [JIRA Ticket] -c [Staging Cluster e.g. ppa3 or ppa4]

This command will:

  • Get all the component builds associated with the JIRA ticket
  • Update the component cookbooks in FHCAP
  • Start the deployment to the specified PPA cluster if user agrees

Finish with the JIRA ticket

fh finish -t [JIRA Ticket]

This command will:

  • Get all the PRs associated with the JIRA ticket
  • Try to merge each PR
    • Will check if rebasing is required
    • Prompt user for squashing commits
    • Push to both origin and upstream
    • Delete the merged branches automatically
  • Resolve the JIRA ticket

Assign testers to the release

fh test-release -r <release-version1> [-r <release-version2>] [-b <build1> -b <build2> ...] [-t <tester-id1:tester-assignment1> ...]

This command will:

  • Get all issues marked as Resolved, Ready For QA or Verified for given release(s) and given build(s)
  • Will check all issues that are Ready For QA and do not have a Tester assigned or their tester was not enumerated on command line and randomly assign tester
  • Provides an email to be sent to mobile-qa-list@redhat.com

How testers are identified?

  • If no tester(s) are provided, all QE team is evenly split for issues to be verified
  • If you provide a tester, you must specify his/her assignment after colon. It can be any number and it will represent relative part to total sum of assignments provided on command line

Working with templates & sdks

There are 2 commands for working with templates and sdks, fh templates & fh sdks

Each templates sub-command supports filtering the affected templates by:

  • template id (-i) e.g. hello_world_mbaas_instance
  • repo name (-r) e.g. helloworld-cloud
  • template type (-t) e.g. cloud_nodejs

Each sdks sub-command supports filtering the affected sdk by:

  • sdk id (-i) e.g. android
  • repo name (-r) e.g. fh-js-sdk

Multiple filters are supported in a single command. Multiple filter values are supported too via a comma separated list e.g. -i android,ios

Examples:

Show template info for the native Android client template

fh templates show -i client_native_android

Clone all templates locally

fh templates clone

Clone the Aerogear Push Service & Hello World hybrid App

fh templates clone -r aerogear-service,helloworld-app

Check the git status of all cloud_nodejs templates

fh templates run -t cloud_nodejs -- git status

Update the fh-mbaas-api version of all cloud_nodejs templates

fh templates run -t cloud_nodejs -- json -I -f package.json \
-c 'this.dependencies["fh-mbaas-api"]="^5.0.0"'

Update template-config/global.json so all cloud_nodejs app templates use their v4.0 branch

fh templates -t cloud_nodejs update -- repoBranch=refs/head/v4.0

Update template-config/global.json so the Push Notifications Mobile Client app is in the 'Push' category and using the 'push' icon

fh templates -i push_app update -- category=Push icon=icon-push

Clone all sdks locally

fh sdks clone

Pull down the latest changes for all sdks

fh sdks run -- git checkout master
fh sdks run -- git fetch origin
fh sdks run -- git pull origin master

Check the current version of the js sdk

# using the repo name
fh sdks run -r fh-js-sdk -- json -f package.json version

# using the sdk id
fh sdks run -i js -- json -f package.json version

Check the current version of the mbaas sdk

# using the repo name
fh sdks run -r fh-mbaas-api -- json -f package.json version

# using the sdk id
fh sdks run -i mbaas -- json -f package.json version

Check the current version of the ios sdk

# using the repo name
fh sdks run -i fh-ios-sdk -- cat VERSION.txt

# using the sdk id
fh sdks run -i ios -- cat VERSION.txt

Check the current version of the dotnet sdk

# using the repo name
fh sdks run -i fh-dotnet-sdk -- cat VERSION.txt

# using the sdk id
fh sdks run -i dotnet -- cat VERSION.txt

Tag templates

fh templates run -- git tag release-3.6.0-rc2
fh templates run -- git push --tags

Create a Pull Request for all node.js templates (Use of the -s sleep option is important to avoid getting throttled by github)

fh templates -t cloud_nodejs -s 5000 run -- hub pull-request -b master -m "Doing some updates"

Checking tools

Checking artifacts with NSP tooling

fh artifact-check -l COMPONENT_VERSIONS.json

  • Will check all the components for libraries with known security problems

    • crawls through all of the tar.gz files
    • collects all of the npm-shrinkwrap.json files
    • sends each of the shrinkwrap to https://nodesecurity.io/
    • writes report as a xunit.xml
  • You can add a --generate flag to this command to generate Jira Tickets for found NSP's (mbaas components only, so must use --mbaas also).

  • Specify the jira project name using --projectName.

  • Specify the jira id name using --projectId.

  • Specify the vulnerability level to create issues for using --level Options[minor, major, critical].

Readme

Keywords

none

Package Sidebar

Install

npm i fh-dev-tools

Weekly Downloads

1

Version

2.16.5

License

MIT

Unpacked Size

367 kB

Total Files

112

Last publish

Collaborators

  • david-martin
  • feedhenry-dev
  • grdryn
  • jasonmadigan
  • kpiwko
  • omatskiv
  • weileylee
  • wtrocki