The CodeScene CLI is a command-line tool which performs the same checks as the PR integration, but locally - on non-committed, staged changes or between select branches.
The installation procedure for the CLI tool differs depending on whether it's for the cloud or on-prem version.
Cloud Installation
Linux, macOS and Windows (if WSL)
The install script will download the binary, move it to ~/.local/bin
and make it executable. If ~/.local/bin
is not in the user’s PATH
, it will be added.
It works if your shell is one of: bash, zsh or fish
curl https://downloads.codescene.io/enterprise/cli/install-codescene-cli.sh | sh
Windows (powershell)
The powershell script downloads the windows binary, moves it to $env:USERPROFILE\AppData\Local\Programs\CodeScene
and makes it executable.
Invoke-WebRequest -Uri 'https://downloads.codescene.io/enterprise/cli/install-codescene-cli.ps1' -OutFile install-codescene-cli.ps1
.\install-codescene-cli.ps1
Note, on non-server editions of Windows, the script execution policy is set to Restricted by default, and script execution is disabled. It can be enabled with:
Set-ExecutionPolicy RemoteSigned
This allows for the execution of trusted scripts downloaded from the internet, and all local scripts. In our case the script is considered a local file.
MANUAL INSTALLATION
The binaries are also available for manual installation. Just download the binary for you platform and make it executable.
Platform specific notes
-
MacOS binaries are not signed, thus you have to manually move them out of quarantine using
xattr -dr com.apple.quarantine <binary>
. -
Windows users might have to set the script execution policy manually as mentioned above:
Set-ExecutionPolicy RemoteSigned
CLIENT SETUP
The CLI tool requires an access token for licensing. You need to have your CodeScene administrator set up a token on the projects configuration page. Then set your environment variables as follows:
export CS_ACCESS_TOKEN=<your-access-token>
Or in windows:
$env:CS_ACCESS_TOKEN = '<your-access-token>'
On-Prem Installation
Linux, macOS and Windows (if WSL)
The install script will download the binary, move it to ~/.local/bin
and make it executable. If ~/.local/bin
is not in the user’s PATH
, it will be added.
It works if your shell is one of: bash, zsh or fish
curl https://downloads.codescene.io/enterprise/cli/install-codescene-cli.sh | sh
Windows (powershell)
The powershell script downloads the windows binary, moves it to $env:USERPROFILE\AppData\Local\Programs\CodeScene
and makes it executable.
Invoke-WebRequest -Uri 'https://downloads.codescene.io/enterprise/cli/install-codescene-cli.ps1' -OutFile install-codescene-cli.ps1
.\install-codescene-cli.ps1
Set-ExecutionPolicy RemoteSigned
This allows for the execution of trusted scripts downloaded from the internet, and all local scripts. In our case the script is considered a local file.
MANUAL INSTALLATION
The binaries are also available for manual installation. Just download the binary for you platform and make it executable.
Platform specific notes
-
MacOS binaries are not signed, thus you have to manually move them out of quarantine using
xattr -dr com.apple.quarantine <binary>
. -
Windows users might have to set the script execution policy manually as mentioned above:
Set-ExecutionPolicy RemoteSigned
CLIENT SETUP
The CLI tool requires a user with a Technical role - see Users and Roles. You need to have your CodeScene administrator set up a user with a Technical role. Then set your environment variables as follows:
export CS_ONPREM_API_URL=<https://your.codescene.com/api/v2>
export CS_USERNAME=<your-username>
export CS_PASSWORD=<your-password>
Or in windows:
$env:CS_ONPREM_API_URL = '<https://your.codescene.com/api/v2>'
$env:CS_USERNAME = '<your-username>'
$env:CS_PASSWORD = '<your-password>'