@zeus-ci/cli
v0.5.6
Published
CLI for https://zeus.ci
Downloads
3
Readme
The official command line utility for Zeus.
Table of Contents
Installation
The CLI comes as NPM package and can be installed via npm or yarn:
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:
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.
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.
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:
# 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.
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:
# 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.
# Linux
zeus completion >> ~/.bashrc
# macOS
zeus completion >> ~/.bash_profile
Development
# Install dependencies
yarn
# Run the bot
yarn start
# Run test watchers
yarn test:watch
We use prettier for auto-formatting and eslint as linter. Both tools can automatically fix a lot of issues for you. To invoke them, simply run:
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.