Last Reviewed: 2023-06-08
Authenticate Terminus in a Bitbucket CI Pipeline
Learn how to authenticate Terminus in a Bitbucket CI pipeline without receiving errors.
This section provides information on how to to authenticate Terminus in a Bitbucket CI pipeline without receiving errors and avoiding authentication rate limits.
Caching Authentication for Bitbucket Pipelines
You can use the example script in this section for a full start-to-finish Terminus authentication in Bitbucket. This pipeline does the following:
- Uses the
ubuntu:latestDocker image. - Performs
git cloneto checkout the code from the repository. - Updates the system and installs necessary tools like PHP, curl, perl, sudo, and Git.
- Determines the latest release of Terminus from the GitHub API and stores it in the
TERMINUS_RELEASEvariable. - Creates a directory for Terminus, downloads it into that directory, makes it executable, and then creates a symbolic link to it in
/usr/local/binso that you can run it from anywhere. - Exports the
TERMINUS_TOKENenvironment variable (assuming that you've already set it in your pipeline settings) and uses it to authenticate Terminus. - Checks that Terminus is authenticated with
terminus auth:whoami. - Defines a cache for the
$HOME/.terminusdirectory. The pipeline system will save and restore the cache for subsequent runs.
Information:
Note
Before you use this script:
- Ensure that you have defined
TERMINUS_TOKENin Bitbucket Pipeline's Environment Variables. - Replace
${TERMINUS_TOKEN}in the script below with the machine token provided by Terminus. - Add the machine token provided by Terminus to your environment variables in the Bitbucket pipeline settings.