Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CLI install instruction and script #15

Merged
merged 2 commits into from
May 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
# toolkit

[![e2e](https://github.com/fluxcd/toolkit/workflows/e2e/badge.svg)](https://github.com/fluxcd/toolkit/actions)
[![report](https://goreportcard.com/badge/github.com/fluxcd/toolkit)](https://goreportcard.com/report/github.com/fluxcd/toolkit)
[![license](https://img.shields.io/github/license/fluxcd/toolkit.svg)](https://github.com/fluxcd/toolkit/blob/master/LICENSE)
[![release](https://img.shields.io/github/release/fluxcd/toolkit/all.svg)](https://github.com/fluxcd/toolkit/releases)

Experimental toolkit for assembling CD pipelines the GitOps way.

![overview](docs/diagrams/tk-overview.png)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯


Components:
* [Toolkit CLI](docs/cmd/tk.md)
* [Source Controller](https://github.com/fluxcd/source-controller)
* [Kustomize Controller](https://github.com/fluxcd/kustomize-controller)

To install the toolkit CLI, follow the [instructions](install/README.md).
Binary file added docs/diagrams/tk-overview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 37 additions & 0 deletions install/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# TK CLI Installation

Binaries for macOS and Linux AMD64 are available for download on the
[release page](https://github.com/fluxcd/toolkit/releases).

To install the latest release run:

```bash
curl -s https://raw.githubusercontent.com/fluxcd/toolkit/master/install/tk.sh | sudo bash
```

The install script does the following:
* attempts to detect your OS
* downloads and unpacks the release tar file in a temporary directory
* copies the tk binary to `/usr/local/bin`
* removes the temporary directory

## Build from source

Clone the repository:

```bash
git clone https://github.com/fluxcd/toolkit
cd toolkit
```

Build the tk binary (requires go >= 1.14):

```bash
make build
```

Run the binary:

```bash
./bin/tk -h
```
51 changes: 51 additions & 0 deletions install/tk.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/usr/bin/env bash

set -e

DEFAULT_BIN_DIR="/usr/local/bin"
BIN_DIR=${1:-"$DEFAULT_BIN_DIR"}

opsys=""
if [[ "$OSTYPE" == linux* ]]; then
opsys=linux
elif [[ "$OSTYPE" == darwin* ]]; then
opsys=darwin
fi

if [[ "$opsys" == "" ]]; then
echo "OS $OSTYPE not supported"
exit 1
fi

if [[ ! -x "$(command -v curl)" ]]; then
echo "curl not found"
exit 1
fi

tmpDir=`mktemp -d`
if [[ ! "$tmpDir" || ! -d "$tmpDir" ]]; then
echo "could not create temp dir"
exit 1
fi

function cleanup {
rm -rf "$tmpDir"
}

trap cleanup EXIT

pushd $tmpDir >& /dev/null

curl -s https://api.github.com/repos/fluxcd/toolkit/releases/latest |\
grep browser_download |\
grep $opsys |\
cut -d '"' -f 4 |\
xargs curl -sL -o tk.tar.gz

tar xzf ./tk.tar.gz

mv ./tk $BIN_DIR

popd >& /dev/null

echo "$(tk --version) installed"