Bash Scripting

Use the Onboardbase CLI in a bash script



You can authenticate the CLI with Environment variables.
Supported environment variables are:

  • ONBOARDBASE_TOKEN - A service token
  • ONBOARDBASE_PROJECT - an onboardbase project name
  • ONBOARDBASE_ENVIRONMENT - an environment in the specified project

Onboardbase CLI can be used in a bash environment without human interference.

Generate Service Tokens

To use Onboardbase in a Bash script, generate a service token from your Onboardbase account page.

Install Onboardbase CLI

Onboardbase CLI has an install script that detects the host environment and installs the right package for the environment.

At the moment, it supports a Linux environment.

(curl -Ls --tlsv1.2 --proto "=https" --retry 3 || wget -t 3 -qO- | sh -s --

Configure Authentication

Since no human interference is allowed, we would programmatically authenticate the CLI with a service token generated from the account page.

onboardbase config:set --token 'Service.***.***.****' --scope /

Fetch Secrets

We can run a build to fetch secrets and run a command against the secrets with the CLI authenticated.

In the command below, we set the project, the environment, and the passphrase to use to cache the secret securely. When the secrets are available, we run the env command to list all the environment variables on the host machine.

onboardbase run -c "env" --project "frontend-dx" -e "staging"

Final Bash Script

Below is a full script on how to use Onboardbase CLI in a bash environment

The first line installs the package, the second line sets the service token, and the final line builds the secret.

(curl -Ls --tlsv1.2 --proto "=https" --retry 3 || wget -t 3 -qO-
onboardbase config:set --token 'Service.***.***.****' --scope /
onboardbase run -c "env" --project "frontend-dx" -e "staging"

Creating and Running an Bash Script

Create a file named

touch ./

Copy the commands above into the file

echo "(curl -Ls --tlsv1.2 --proto \"=https\" --retry 3 || wget -t 3 -qO- | sh -- --
onboardbase config:set-token \"Service.***.***.****\" --scope /
onboardbase run -c \"env\" --project "frontend-dx" -e \"staging\"" > ./

Give the file executable permission with

sudo chmod +x ./

Run the file with