# @zeus-ci/cli

> CLI for https://zeus.ci

Latest version **0.5.6** (published 2019-11-08) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @zeus-ci/cli
pnpm add @zeus-ci/cli
yarn add @zeus-ci/cli
bun add @zeus-ci/cli
```

Provides the command `zeus`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.5.6 |
| Published | 2019-11-08 |
| First published | 2017-11-14 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=4.5.0 |
| Dependencies | 9 |
| Unpacked size | 51.2 KB |
| Known vulnerabilities | 0 (+4 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 5 |
| Maintainers | benvinegar, jauer, sentry-bot |

## Links

- npm: https://www.npmjs.com/package/@zeus-ci/cli
- Repository: https://github.com/getsentry/zeus-cli
- Homepage: https://github.com/getsentry/zeus-cli#readme
- Issues: https://github.com/getsentry/zeus-cli/issues
- npm.io page: https://npm.io/package/@zeus-ci/cli

## Dependencies (9)

- [yargs](https://npm.io/package/yargs.md) ~12.0.4
- [dotenv](https://npm.io/package/dotenv.md) ~5.0.1
- [winston](https://npm.io/package/winston.md) ~2.4.2
- [form-data](https://npm.io/package/form-data.md) ~2.3.2
- [node-fetch](https://npm.io/package/node-fetch.md) ~2.1.2
- [whatwg-url](https://npm.io/package/whatwg-url.md) ~5.0.0
- [@zeus-ci/sdk](https://npm.io/package/@zeus-ci/sdk.md) 0.1.8
- [promise-retry](https://npm.io/package/promise-retry.md) ~1.1.1
- [require-directory](https://npm.io/package/require-directory.md) ~2.1.1

## Recent versions

- 0.5.6 (latest) — 2019-11-08
- 0.5.5 — 2019-10-29
- 0.5.4 — 2019-02-21
- 0.5.3 — 2019-01-28
- 0.5.2 — 2018-08-30
- 0.5.0 — 2018-06-08
- 0.4.5 — 2018-05-15
- 0.4.4 — 2018-01-16
- 0.4.3 — 2017-12-09
- 0.4.2 — 2017-12-04
- 0.4.1 — 2017-11-30
- 0.4.0 — 2017-11-27
- 0.3.3 — 2017-11-15
- 0.3.2 — 2017-11-15
- 0.3.1 — 2017-11-15
- … 1 more at https://npm.io/package/@zeus-ci/cli/versions

## README

<p align="center">
    <img src="https://user-images.githubusercontent.com/1433023/32629198-3c6f225e-c54d-11e7-96db-99fd22709a1b.png" width="271">
</p>

<h1>Zeus Command Line Interface</h1>

[![Travis](https://img.shields.io/travis/getsentry/zeus-cli.svg)](https://travis-ci.org/getsentry/zeus-cli)
[![GitHub release](https://img.shields.io/github/release/getsentry/zeus-cli.svg)](https://github.com/getsentry/zeus-cli/releases/latest)
[![npm version](https://img.shields.io/npm/v/@zeus-ci/cli.svg)](https://www.npmjs.com/package/@zeus-ci/cli)
[![license](https://img.shields.io/github/license/getsentry/zeus-cli.svg)](https://github.com/getsentry/zeus-cli/blob/master/LICENSE)

The official command line utility for [Zeus](https://github.com/getsentry/zeus).

## Table of Contents <!-- omit in toc -->

- [Installation](#installation)
- [Usage](#usage)
  - [Supported CI Systems](#supported-ci-systems)
  - [Updating Jobs](#updating-jobs)
  - [Uploading Artifacts](#uploading-artifacts)
  - [Bash Completion](#bash-completion)
- [Development](#development)

## Installation

The CLI comes as NPM package and can be installed via npm or yarn:

```bash
npm install -g @zeus-ci/cli
yarn global add @zeus-ci/cli
```

## Usage

The CLI offers a set of commands to interact with the Zeus server. Besides
specific parameters and options for each command, there is a range of common
options:

```text
zeus <command>

Commands:
  zeus job <command>     Manipulate jobs                            [aliases: j]
  zeus upload <file...>  Upload build artifacts                     [aliases: u]
  zeus completion        generate bash completion script

Options:
  --url          Fully qualified URL to the Zeus server                 [string]
  --token        Token for authorized access to Zeus                    [string]
  -v, --version  Show version number                                   [boolean]
  -h, --help     Show help                                             [boolean]
```

The `--url` parameter defaults to `https://zeus.ci`. If you are running a
self-hosted version of Zeus, set this parameter to the fully qualified URL that
the server is listening to. The value can also be provided via the `ZEUS_URL`
environment variable. The command line option always takes precedence over the
environment.

Most commands use the legacy `ZEUS_HOOK_BASE` environment
variable. This requires a hook to be configured in the environment. In
future versions, this will be replaced with the default authorization tokens.

The CLI also supports reading environment variables from a `.env` file located
in the current working directory. Note that command line parameters always
override the environment.

```sh
ZEUS_URL=https://zeus.ci
ZEUS_TOKEN=zeus-u-xxxxxxxx
```

### Supported CI Systems

In some environments, the CLI is able to infer parameters like build or job
numbers and commit hashes for you. In this case, you can omit the respective
parameters. These systems are:

- Travis CI
- AppVeyor
- Buildkite
- CircleCI
- Microsoft Azure Pipelines

### Updating Jobs

Create new or update existing jobs in Zeus, providing a job ID and the
corresponding build ID. If the provided build does not exist, it will be
created. On supported CI systems, the job and build id are automatically
inferred from the environment.

**Note:** if the corresponding build does not exist, you must provide `--ref`
attribute, otherwise Zeus will fail to create the build.

```text
zeus job update

Add/update a job

Options:
  --url, -u            Custom URL                                       [string]
  --token              Token for authorized access to Zeus              [string]
  --job, -j            Job id                                [number] [required]
  --build, -b          Build id                              [number] [required]
  --ref, -r            Commit hash                                      [string]
  --build-label, -B    Custom build label                               [string]
  --job-label, -J      Custom job label                                 [string]
  --status, -s         Job execution status
                               [string] [choices: "pending", "passed", "failed"]
```

**Examples:**

```sh
# Create job 234 in build number 123
zeus job update --job=234 --build=123 --ref=0123456

# Update job's label and url
zeus job update --job=234 --build=123 --url='https://travis-ci.org/org/repo/jobs/123' --label='New job'

# Set job's status to 'passed'
zeus job update --job=234 --build=123 --status=passed

# On supported CI systems one can omit build, job, and commit IDs
zeus job update --status=passed
# ...will have the same effect as this, if run on Travis:
zeus job update --status=passed -b "$TRAVIS_BUILD_ID" -j "$TRAVIS_JOB_ID" -r "$TRAVIS_COMMIT"
```

### Uploading Artifacts

Upload a build artifact for processing or storage. The artifact is attached to a
build and job. On supported CI systems, the build and job ids are automatically
inferred from the environment.

Optionally, you can specify a mime type to classify the artifact with `--type`.
This is used to hint Zeus how the artifact should be processed. By default, the
mime type is inferred from the file name.

```text
zeus upload <file...>

Positionals:
  file  Path to the artifact                    [array] [required] [default: []]

Options:
  --url          Fully qualified URL to the Zeus server                 [string]
  --token        Token for authorized access to Zeus                    [string]
  -t, --type     Mime type of the file to upload                        [string]
  -n, --name     Artifact name to use in place of the filename          [string]
  -j, --job      Unique id of the job in CI                             [string]
  -b, --build    Unique id of the build in CI                           [string]
```

**Examples:**

```sh
# On a supported build server
zeus upload coverage.xml

# With explicit mime type
zeus upload -t 'text/xml+coverage' coverage.xml

# Multiple files
zeus upload -t 'application/javascript' build/**/*.js

# On a custom build server
zeus upload -b $MY_BUILD_ID -j $MY_JOB_ID -t 'text/xml+coverage' coverage.xml
```

### Bash Completion

Output a script to generate command line completion suggestions.

```sh
# Linux
zeus completion >> ~/.bashrc

# macOS
zeus completion >> ~/.bash_profile
```

## Development

```sh
# Install dependencies
yarn

# Run the bot
yarn start

# Run test watchers
yarn test:watch
```

We use [prettier](https://prettier.io/) for auto-formatting and
[eslint](https://eslint.org/) as linter. Both tools can automatically fix a lot
of issues for you. To invoke them, simply run:

```sh
yarn fix
```

It is highly recommended to use VSCode and install the suggested extensions.
They will configure your IDE to match the coding style, invoke auto formatters
every time you save and run tests in the background for you. No need to run the
watchers manually.

---
_Source: https://npm.io/package/@zeus-ci/cli · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
