Developers and teams are happiest when they release higher quality updates more often. And most importantly, so are your customers. Great tooling plays an important part in helping everyone reach this happy place.
We are excited to announce the release of the Replicated Platform CLI.
This touch of tooling helps teams iterate and release new versions of their on-prem software quicker, with less button pressing in our UI, as well as being a great inclusion in their continuous delivery process.
The Platform CLI is focused on simplifying two key interactions with Replicated; developing a new release, and promoting a release from development to beta to GA.
And while the CLI is perfect for local development, its power shines when plugging it into your favorite CI/CD platform, allowing you to automate your releases every time a new Docker image is pushed to your registry of choice.
On a Mac, installation is as simple as:
$ brew install replicatedhq/replicated/cli
For Linux, you can use the install script to fetch the latest release and extract it to /usr/local/bin
:
$ curl -o install.sh -sSL https://raw.githubusercontent.com/replicatedhq/replicated/master/install.sh
sudo bash ./install.sh
Now you’re ready to try out a few commands.
Every command requires your application slug and your API token. You may wish to set the REPLICATED_APP
and REPLICATED_API_TOKEN
environment variables to avoid having to pass them as flag parameters.
You can find the application slug in the URL. For example, the application name in the URL https://vendor.replicated.com/apps/myamazingapp/releases
is myamazingapp
.
To create an API token, you can go to the Teams & Tokens page and create a new API token with Read and Write permissions.
$ replicated channels ls --app my_app --token 39ae133bb503f532858b0171ddacc524a5e5e
ID NAME DESCRIPTION RELEASE_SEQUENCE
00a9939b49076c80f4f1b016d6cb002b Stable General Availability 120
027ef7d78925222f9eeeea37dbc9d761 Unstable Beta 125
042050f9b25963a00cf345e5c5e13670 Dev Latest Builds 130
or
$ export REPLICATED_APP=my_app
$ export REPLICATED_API_TOKEN=39ae133bb503f532858b0171ddacc524a5e5e
$ replicated channels ls
ID NAME DESCRIPTION RELEASE_SEQUENCE
00a9939b49076c80f4f1b016d6cb002b Stable General Availability 120
027ef7d78925222f9eeeea37dbc9d761 Unstable Beta 125
042050f9b25963a00cf345e5c5e13670 Dev Latest Builds 130
Once you have everything installed, you can now use your favorite text editor, if it be Atom, or Visual Studio Code, or one of the many other great editiors, and push your changes to Replicated:
$ replicated release create --promote Unstable --yaml "$(< replicated.yaml)"
This command uploads your release config to Replicated, and then promotes it to your development channel (Unstable
), all in one command!
Creating a new release for every tagged build is a common use of the Replicated Platform CLI.
Assume the applications Replicated config is checked in to git (replicated.yaml
) and you have configured Travis CI or CircleCI with your REPLICATED_APP
and REPLICATED_API_TOKEN
environment variables.
You can then add a release.sh
script to your project like this:
#!/bin/bash
# Create a new release from replicated.yaml and promote the Unstable channel to use it.
# Aborts if version tag is empty.
set -e
VERSION=$1
INSTALL_SCRIPT=https://raw.githubusercontent.com/replicatedhq/replicated/master/install.sh
if [ -z "$VERSION" ]; then
echo "No version; skipping replicated release"
exit
fi
unstable_channel_id() {
replicated channel ls | grep Unstable | awk '{print $1}'
}
new_sequence() {
replicated release create --yaml "$(< replicated.yaml)" | grep 'SEQUENCE:' | grep -Eo '[0-9]+'
}
# install replicated
curl -sSL "$INSTALL_SCRIPT" > install.sh
sudo bash ./install.sh
replicated release promote $(new_sequence) $(unstable_channel_id) --version "$VERSION"
# Channel ee9d99e87b4a5acc2863f68cb2a0c390 successfully promoted to release 15
Now you can automate tagged releases in Travis CI or CircleCI:
# .travis.yml
deploy:
provider: script
script: ./release.sh "$TRAVIS_TAG"
# circle.yml
deployment:
tag:
tag: /v.*/
owner: replicatedcom
commands:
- ./release.sh "$CIRCLE_TAG"
We’ve heard some great feedback from our beta users, and we would love to hear how you and your team use the Replicated Platform CLI.
If you have any ideas or requests on possible additions and improvements, you can send us a Pull Request or can get in touch with us at [email protected].
Happy Building,
The Replicated Team