Cloudsmith Command-Line Interface (CLI)
Project description
The Cloudsmith Command Line Interface (CLI) is a Py2/Py3 text-based interface to the API. This allows users, machines and other services to access and integrate smoothly with Cloudsmith without requiring explicit plugins or tools. Be awesome. Automate Everything.
The following (slightly out of date) GIF demonstrates a small slice of the CLI - View the full video on YouTube:
You can also read our blog article that introduced the first version of the CLI and the Cloudsmith RESTful API.
Changelog
Please see the changelog for the list of changes by version. The currently version is displayed in the PyPi badge at the top.
Features
The CLI currently supports the following commands (and sub-commands):
check: Check the status/version of the service.
delete: Delete a package from a repository.
docs: Launch the help website in your browser.
help: Display the help message and exit.
list: List distributions, packages and repos.
distros: List available distributions.
packages: List packages for a repository.
repos: List repositories for a namespace (owner).
push: Push/upload a new package to a repository.
deb: Push/upload a new Deb package upstream.
maven: Push/upload a new Maven package upstream.
python: Push/upload a new Python package upstream.
raw: Push/upload a new Raw package upstream.
rpm: Push/upload a new Rpm package upstream.
ruby: Push/upload a new Ruby package upstream.
vagrant: Push/upload a new Vagrant package upstream.
status: Get the synchronisation status for a package.
token: Retrieve your API authentication token/key.
whoami: Retrieve your current authentication status.
Installation
You can install the latest CLI application from:
The simplest way is to use pip, such as:
pip install cloudsmith-cli
Or you can get the latest pre-release version from Cloudsmith:
pip install cloudsmith-cli --extra-index-url=https://dl.cloudsmith.io/public/cloudsmith/cli/python/index/
Configuration
There are two configuration files used by the CLI:
config.ini: For non-credentials configuration.
credentials.ini: For credentials (authentication) configuration.
By default, the CLI will look for these in the following locations:
The current working directory.
A directory called cloudsmith in the OS-defined application directory. For example:
Linux: $HOME/.config/cloudsmith
Windows: C:\Users\YourName\AppData\cloudsmith
Both configuration files use the simple INI format, such as:
[default] api_key=1234567890abcdef1234567890abcdef
Non-Credentials (config.ini)
See the default example in GitHub:
You can specify the following configuration options:
api_host: The API host to connect to.
api_proxy: The API proxy to connect through.
api_user_agent: The user agent to use for requests.
Credentials (credentials.ini)
See the default example in GitHub:
You can specify the following configuration options:
api_key: The API key for authenticating with the API.
Examples
Note: All of the examples in this section are uploading to the lskillen user and the test repository. Please replace these with your own user/org and repository names.
Get your API key/token
You can retrieve your API token using the cloudsmith token command:
cloudsmith token Login: you@example.com Password: Repeat for confirmation:
The resulting output looks something like:
Retrieving API token for 'you@example.com' ... OK Your API token is: 1234567890abcdef1234567890abcdef
You can then put this into your credentials.ini, use it as an environment variable CLOUDSMITH_API_KEY=your_key_here or pass it to the CLI using the -k your_key_here flag.
Upload a Debian Package
Assuming you have a package filename libxml2-2.9.4-2.x86_64.deb, representing libxml 2.9.4, for the Ubuntu 16.04 distribution (which has a cloudsmith identifier of ubuntu/xenial):
cloudsmith push deb lskillen/test/ubuntu/xenial libxml2-2.9.4-2.x86_64.deb
Upload a RedHat Package
Assuming you have a package filename libxml2-2.9.4-2.el5.x86_64.rpm, representing libxml 2.9.4, for the RedHat Enterprise 5.0 distribution (which has a cloudsmith identifier of el/5):
cloudsmith push rpm lskillen/test/el/5 libxml2-2.9.4-2.el5.x86_64.rpm
Upload a Python Package
Assuming you have a package filename boto3-1.4.4.py2.p3-none-any.whl, representing boto3 1.4.4, for Python 2/3:
cloudsmith push python lskillen/test boto3-1.4.4.py2.p3-none-any.whl
Upload a Ruby Package
Assuming you have a package filename safe_yaml-1.0.4.gem, representing safe_yaml 1.0.4, for Ruby 2.3+:
cloudsmith push ruby lskillen/test safe_yaml-1.0.4.gem
Upload a Maven Package
Assuming you have a package filename validation-api-1.0.0.GA.jar, representing validation-api 1.0.0, for Maven/Java:
cloudsmith push maven lskillen/test validation-api-1.0.0.GA.jar --pom-file=validation-api-1.0.0.GA.pom
Upload a Raw Package
Assuming you have a package filename assets.zip, representing packaged assets:
cloudsmith push raw lskillen/test assets.zip
Upload a Vagrant Package
Assuming you have a package filename awesome.box, representing a Vagrant image for the Awesome OS (fictional, probably):
cloudsmith push vagrant lskillen/test awesome.box
Upload multiple Debian Packages
You can also upload multiple packages in one go (all of the same distribution):
cloudsmith push deb lskillen/test/ubuntu/xenial libxml2-2.9.1-2.x86_64.deb libxml2-2.9.2-2.x86_64.deb libxml2-2.9.3-2.x86_64.deb
Contributing
Yes! Please do contribute, this is why we love open source. Please see CONTRIBUTING for contribution guidelines when making code changes or raising issues for bug reports, ideas, discussions and/or questions (i.e. help required).
License
Copyright 2017 Cloudsmith Ltd
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License.
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
EOF
This quality product was brought to you by Cloudsmith and the fine folks who have contributed.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
File details
Details for the file cloudsmith_cli-0.2.2-py2.py3-none-any.whl
.
File metadata
- Download URL: cloudsmith_cli-0.2.2-py2.py3-none-any.whl
- Upload date:
- Size: 39.9 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 07bcc1582eb711ac00001e47b42f0b69ab5e6efd64c78b2d39f78df0361af166 |
|
MD5 | 3f4dd5edaa9697469addc121823194d7 |
|
BLAKE2b-256 | 16256f23903160ba53907eb03a88bd885b328d8b2af8b3aecf3c6d14f4544a4c |