Skip to content
/ hammer Public

Wrapper CLI for interacting with OM, BOSH and others for PCF environments

License

Notifications You must be signed in to change notification settings

pivotal/hammer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

d51e495 · Nov 4, 2021
Nov 4, 2021
Jun 19, 2020
Nov 4, 2021
May 14, 2020
May 14, 2020
Nov 4, 2021
May 14, 2020
May 14, 2020
May 14, 2020
Jul 25, 2019
Aug 27, 2020
Aug 27, 2020
Jul 25, 2019
Nov 4, 2021
Jun 28, 2019
Nov 4, 2021
Jun 19, 2020
Jul 25, 2019
Jul 3, 2019
Jul 25, 2019
Sep 30, 2020
Nov 4, 2021
Nov 4, 2021
May 18, 2020
Mar 6, 2020

Repository files navigation

hammer - wrapper CLI for interacting with PCF environments

Test Status

Installation

The latest build of the hammer cli is available from the releases page. Download the tar for your platform, untar it, and move it to your $PATH.

Or using brew on macOS or Linux:

brew tap pivotal/hammer https://github.com/pivotal/hammer
brew install hammer

Alternatively you can build hammer from source if you have Go installed:

git clone git@github.com:pivotal/hammer.git && cd hammer && go install

You will also need to install, separately, any of the underlying cli tools that hammer will use in your workflow. hammer does not include cf, bosh, om, etc.

Config

In order to run the hammer tool against a given environment you need to have an environment config file in the following format:

{
  "name": "ENVIRONMENT-NAME",
  "ops_manager": {
    "url": "OPSMAN-URL",
    "client_id": "OPSMAN-CLIENT-ID",
    "client_secret": "OPSMAN-CLIENT-SECRET",
    "username": "OPSMAN-USERNAME",
    "password": "OPSMAN-PASSWORD"
  },
  "ops_manager_private_key": "OPSMAN-RSA-PRIVATE-KEY",
  "ops_manager_public_ip": "OPSMAN-PUBLIC-IP",
  "ops_manager_ssh_user": "OPSMAN-SSH-USER",
  "sys_domain": "PAS-SYSTEM-DOMAIN",
  "pks_api":  {
     "url": "PKS-API-URL"
  }
}

Or the equivalent in yaml:

name: ENVIRONMENT-NAME
ops_manager:
  client_id: OPSMAN-CLIENT-ID
  client_secret: OPSMAN-CLIENT-SECRET
  password: OPSMAN-PASSWORD
  url: OPSMAN-URL
  username: OPSMAN-USERNAME
ops_manager_private_key: OPSMAN-RSA-PRIVATE-KEY
ops_manager_public_ip: OPSMAN-PUBLIC-IP
ops_manager_ssh_user: OPSMAN-SSH-USER
pks_api:
  url: PKS-API-URL
sys_domain: PAS-SYSTEM-DOMAIN

This file can then be passed into the tool via hammer -t path-to-env-config <command>.

ops_manager_ssh_user is an optional field and if not set then hammer -t path-to-env-config ssh opsman will use ubuntu to ssh to the OpsManager VM, if users need to ssh via a different username they should set this as appropriate.

Only one set of ops_manager.client_id and ops_manager.client_secret or ops_manager.username and ops_manager.password need to be specified, if both sets are specified then in line with om the client details will be used.

NB: sys_domain and pks_api.url are only needed for using hammer cf-login and hammer pks-login respectively.

Development

Unit and integration tests can be run if you have Ginkgo installed:

ginkgo -r .

Linters can also be run using golangci-lint:

golangci-lint run

Or just run both with:

make test

Special thanks to @blgm for letting an internal tool he created serve as the basis for this tool.