added command line utility docs

This commit is contained in:
Brad Rydzewski 2015-10-25 15:18:16 -07:00
parent 3dd218b211
commit 3c8c330656
10 changed files with 191 additions and 0 deletions

View file

@ -24,6 +24,7 @@ gen_static:
mkdir -p static/docs_gen/api static/docs_gen/build
mkdir -p static/docs_gen/api static/docs_gen/plugin
mkdir -p static/docs_gen/api static/docs_gen/setup
mkdir -p static/docs_gen/api static/docs_gen/cli
go generate github.com/drone/drone/static
gen_template:

4
docs/cli/README.md Normal file
View file

@ -0,0 +1,4 @@
* [Install](index.md)
* [Local Builds](builds.md)
* [Encrypt Secrets](secrets.md)
* [Add Machines](machines.md)

35
docs/cli/builds.md Normal file
View file

@ -0,0 +1,35 @@
# Local Builds
The `exec` command lets you run a build on your personal machine (ie your laptop). It does not involve the Drone server in any way. This is very useful for local testing and troubleshooting.
## Instructions
The `drone exec` command should be executed from the root of your repository, where the `.drone.yml` file is located:
```
cd octocat/hello-world
drone exec
```
This only executes a `build` step. It does not execute `clone`, `publish`, `deploy`, or `notify` steps, nor will it decrypt your `.drone.sec` file.
## Arguments
The `exec` command accepts the following arguments:
* `DOCKER_HOST` - docker deamon address. defaults to `unix:///var/run/docker.sock`
* `DOCKER_TLS_VERIFY` - docker daemon supports tlsverify
* `DOCKER_CERT_PATH` - docker certificate directory
## Boot2Docker
You may use the `drone exec` command with boot2docker as long as your code exists within your `$HOME` directory. This is because boot2docker mounts your home directory into the virtualbox instance giving the Docker daemon access to your local files.
## Known Issues
Attempting to cancel (`ctrl+C`) a running build will leave behind orphan containers. This is a known issue and we are planning a fix.
## Limitations
You cannot use `drone exec` with a remote Docker instance. Your local codebase is shared via a volume with the Docker daemon, which is not possible when communicating with a remote Docker host on a different machine.

50
docs/cli/index.md Normal file
View file

@ -0,0 +1,50 @@
# Install
> This is an early preview of the command line utility. Contributors wanted.
Drone provides a simple command line utility that allows you interact with the Drone server from the command line. This section describes the setup and installation process.
## System Requirements
This tool requires Docker 1.6 or higher. If you are using Windows or Mac we recommend installing the [Docker Toolbox](https://www.docker.com/docker-toolbox).
## Linux
Download and install the x64 linux binary:
```
curl http://downloads.drone.io/drone-cli/drone_linux_amd64.tar.gz | tar zx
sudo install -t /usr/local/bin drone
```
## OSX
Download and install using Homebrew:
```
brew tap drone/drone
brew install drone
```
Or manually download and install the binary:
```
curl http://downloads.drone.io/drone-cli/drone_darwin_amd64.tar.gz | tar zx
sudo cp drone /usr/local/bin
```
## Setup
In order to communicate with the Drone server you must provide the server url:
```
export DRONE_SERVER=<http://>
```
In order to authorize communications you must also provide your access token:
```
export DRONE_SERVER=<token>
```
You can retrieve your access token from the user profile screen in Drone.

46
docs/cli/machines.md Normal file
View file

@ -0,0 +1,46 @@
# Machine Management
The `drone node create` command lets your register new remote servers with Drone. This command should be used in conjunction with [docker-machine](https://github.com/docker/machine). Note that you can alternatively register and manage servers in the UI.
## Environment Variables
The `drone node create` command expects the following environment variables:
* `DOCKER_HOST` - docker deamon address
* `DOCKER_TLS_VERIFY` - docker daemon supports tlsverify
* `DOCKER_CERT_PATH` - docker certificate directory
## Instructions
Create or configure a new server using `docker-machine`:
```
docker-machine create \
--digitalocean-size 2gb \
--driver digitalocean \
--digitalocean-access-token <token> \
my-drone-worker
```
This writes setup instructions to the console:
```
export DOCKER_TLS_VERIFY="1"
export DOCKER_HOST="tcp://123.456.789.10:2376"
export DOCKER_CERT_PATH="/home/octocat/.docker/machine/machines/my-drone-worker"
export DOCKER_MACHINE_NAME="my-drone-worker"
# Run this command to configure your shell:
# eval "$(docker-machine env my-drone-worker)"
```
Run the following command (from the above output) to configure your shell:
```
eval "$(docker-machine env my-drone-worker)"
```
Register the newly created or configured machine with Drone. Once registered, Drone will immediately begin sending builds to the server.
```
drone node create
```

3
docs/cli/overview.md Normal file
View file

@ -0,0 +1,3 @@
# Overview
> Coming Soon

45
docs/cli/secrets.md Normal file
View file

@ -0,0 +1,45 @@
# Encrypt Secrets
The `secure` command lets your create a signed and encrypted `.drone.sec` file. The `.drone.sec` file is decrypted at runtime and will inject your secrets into your `.drone.yml` file.
## Usage
Create a plaintext `.drone.sec.yml` file that contains your secret variables:
```
environment:
- PASSWORD=foo
```
Encrypt and generate the `.drone.sec` file:
```
drone secure --repo octocat/hello-world
```
Commit the encrypted `.drone.sec` file to your repository.
Note the `drone secure` command will automatically calculate the shasum of your yaml file and store in the `.drone.sec` file. This prevent secrets from being injected into the build if the Yaml changes.
## Arguments
The `secure` command accepts the following arguments:
* `--in` secrets in plain text yaml. defaults to `.drone.sec.yml`
* `--out` encrypted secret file. defaults to `.drone.sec`
* `--yaml` location of your `.drone.yml` file. defaults to `.drone.yml`
* `--repo` name of your repository **required**
## Shared Secrets
You cannot re-use the same `.drone.sec` for multiple repositories. You can, however, use the same plaintext secret file for multiple repositories.
```
cd octocat/hello-world
drone secure --in $HOME/.drone.sec.yml --repo octocat/hello-world
cd octocat/Spoon-Knife
drone secure --in $HOME/.drone.sec.yml --repo octocat/Spoon-Knife
```

View file

@ -11,6 +11,7 @@ import (
//go:generate go run ../contrib/generate-docs.go -input ../docs/build/README.md -name Builds -template ../template/amber/docs.amber -output docs_gen/build/
//go:generate go run ../contrib/generate-docs.go -input ../docs/plugin/README.md -name Plugins -template ../template/amber/docs.amber -output docs_gen/plugin/
//go:generate go run ../contrib/generate-docs.go -input ../docs/setup/README.md -name Install -template ../template/amber/docs.amber -output docs_gen/setup/
//go:generate go run ../contrib/generate-docs.go -input ../docs/cli/README.md -name CLI -template ../template/amber/docs.amber -output docs_gen/cli/
//go:generate sassc --style compact styles/style.sass styles_gen/style.css
//go:generate go-bindata-assetfs -ignore "\\.go" -pkg static -o static_gen.go ./...

View file

@ -19,6 +19,10 @@ block header
a[class="nav-link"][href="../plugin/"]
.active ? Site.Name == "Plugins"
| Plugins
li.nav-item
a[class="nav-link"][href="../cli/"]
.active ? Site.Name == "CLI"
| CLI
li.nav-item
a.nav-link[href="../api/"] API Reference

View file

@ -13,6 +13,8 @@ block header
a.nav-link[href="../build/"] Builds
li.nav-item
a.nav-link[href="../plugin/"] Plugins
li.nav-item
a.nav-link[href="../cli/"] CLI
li.nav-item
a.nav-link.active[href="#"] API Reference