Sign inSign up

cortexapp/cli

By cortexapp

•Updated 2 days ago

Command Line Interface for the Cortex internal developer portal.

Image
0

4.3K

cortexapp/cli repository overview

⁠What is Cortex?

Cortex is the internal developer portal that cuts noise for developers with paved paths to production. Catalog, score, and drive action to improve software.

For more information, please visit https://cortex.io⁠.

a small image

⁠How to use this image

This image packages the standalone python Cortex CLI⁠ available at https://pypi.org⁠. To see a list of possible commands:

$ docker run cortexapp/cli

usage: cortex CLI [-h] [-c CONFIG] [-d] [-n] [-t] [-v]
                  {audit-logs,backup,catalog,custom-data,custom-events,dependencies,deploys,discovery-audit,docs,gitops-logs,groups,integrations,ip-allowlist,on-call,packages,plugins,queries,resource-definitions,scorecards,teams-hierarchies,teams}
                  ...

Cortex command line interface

positional arguments:
  {audit-logs,backup,catalog,custom-data,custom-events,dependencies,deploys,discovery-audit,docs,gitops-logs,groups,integrations,ip-allowlist,on-call,packages,plugins,queries,resource-definitions,scorecards,teams-hierarchies,teams}
                        sub-command help
    audit-logs          audit log commands
    backup              import/export commands
    catalog             catalog commands
    custom-data         custom_data actions
    custom-events       custom events actions
    dependencies        dependencies commands
    deploys             deploys commands
    discovery-audit     Discovery Audit commands
    docs                OpenAPI doc commands
    gitops-logs         Gitops logs commands
    groups              groups commands
    integrations        integrations sub-commands
    ip-allowlist        IP Allowlist information
    on-call             get on-call information
    packages            commands to create and modify packages
    plugins             commands to create and access plugins
    queries             run CQL queries
    resource-definitions
                        resource definitions
    scorecards          scorecards API requests
    teams-hierarchies   commands to create and modify team hierarchies
    teams               commands to create and modify teams

options:
  -h, --help            show this help message and exit
  -c CONFIG, --config CONFIG
                        Config location, default = ~/.cortex/config
  -d, --debug           Writes request debug information as JSON to stderr
  -n, --noObfuscate     Do not obfuscate bearer token when debugging
  -t , --tenant         tenant name defined in ~/.cortex/config, defaults to 'default'
  -v, --version         show program's version number and exit

⁠Using the cortex CLI with your API key

The Cortex CLI requires an API key⁠ to interact with the Cortex API.

Basic usage is:

docker run -e CORTEX_API_KEY=<your API key> cortexapp/cli <cortex subcommand> <additional parameters>

Example command to retrieve a YAML descriptor for a service

$ docker run -e CORTEX_API_KEY=myApiKey cortexapp/cli:latest catalog descriptor -y -t test-service
openapi: 3.0.1
info:
  title: Test Service
  x-cortex-tag: test-service
  x-cortex-type: service
  x-cortex-owners:
  - type: EMAIL
    email: [email protected]
  x-cortex-custom-metadata:
    foo: bar

If your Cortex instance is not using a cloud instance at https://app.getcortexapp.com you will also need to define CORTEX_BASE_URL that points to the root of your Cortex instance, ie

$ docker run -e CORTEX_BASE_URL=https://cortex.mycompany.com -e CORTEX_API_KEY=myApiKey cortexapp/cli:latest catalog descriptor -y -t test-service
openapi: 3.0.1
info:
  title: Test Service
  x-cortex-tag: test-service
  x-cortex-type: service
  x-cortex-owners:
  - type: EMAIL
    email: [email protected]
  x-cortex-custom-metadata:
    foo: bar

⁠Running CLI commands interactively in the container

Override the entrypoint for the image to start a cortexapp/cli container and then run the cortex command interactively.

$ docker run -it -e CORTEX_API_KEY=myApiKey --entrypoint bash cortexapp/cli

cortex@c449a66b81d8:~$ cortex catalog descriptor -y -t test-service

openapi: 3.0.1
info:
  title: Test Service
  x-cortex-tag: test-service
  x-cortex-type: service
  x-cortex-owners:
  - type: EMAIL
    email: [email protected]
  x-cortex-custom-metadata:
    foo: bar

⁠Documentation

Refer to https://github.com/cortexapps/cli/blob/main/README.rst⁠ for documentation on using the Cortex CLI.

Tag summary

Content type

Image

Digest

sha256:55864c19a…

Size

90.3 MB

Last updated

2 days ago

docker pull cortexapp/cli