Radix CLI
Purpose
Radix CLI is an application to execute commands for getting information, creating a Radix application or pipeline jobs, setting values of secrets, start and stop Radis components and other operations, described below. The Radix CLI, available for multiple platforms, it can be downloaded from the GitHub repository.
Use
Radix CLI can be installed and run from your local PC, as a Docker container, or in CI workflows, like GitHub actions.
Commands can be executed towards all Radix cluster, either by setting the --context
flag when executing a command, or by configuring the default context. platform
is used if no context is specified.
Set the default context:
rx set context --context playground
Check the current context:
rx get context
Run on a local PC
Install Radix CLI locally by following the installation instructions in the Radix CLI GitHub repository.
To start working with Radix CLI you must first login:
rx login
After successful login, you can start executing commands.
To clean up the login data, logout from the Radix:
rx logout
Radix CLI uses Radix API to execute operations. An option verbose
can be used to get more details about requests and responses to and from the Radix CLI:
rx create pipeline-job deploy -a your-app-name -e dev --verbose
Run in CI workflow
Custom continuous integration tool like Jenkins or GitHub Action can use Radix CLI.
If you are using GitHub Workflows, you can use the equinor/radix-github-actions to easily install and authenticate rx
in your current workflow:
permissions: # set required permissions (https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs)
id-token: write # Required to authenticate with Azure Entra ID
contents: read
jobs:
deploy:
name: deploy
runs-on: ubuntu-latest
steps:
- name: Install RX and authenticate
uses: equinor/radix-github-actions@v2
with:
azure_client_id: "00000000-0000-0000-0000-000000000000" # App Registration Application ID or Managed Identity Client ID
# azure_client_secret: "some super secret password" # Optional: App Registration Client Secret
- run: rx version # Run any rx command
More details can be found in guidelines and examples:
- Guideline to run "Deploy Only" pipeline job
- Example of using GitHub action to create a Radix deploy pipeline job
- Migration guide from radix-github-actions v1 to v2
Commands
To find out which commands are available - run rx
and add one of commands in the list "Available Commands":
create
, delete
, get
, etc.
Run the rx
with one of commands and add another command from the list "Available Commands". Example: rx get
, which you can use with addition commands application
, context
, etc.: rx get platform
. This way all available sub-commands and options can be found without documentation.
Scope can be specified for most commands:
- Radix cluster - all applications, available to the logged-in user on selected cluster ("context")
- Radix application
- environment of a Radix application
- component of a Radix application environment
Examples
Register application
- Register (create) a new Radix application.
Deploy key
will be returned as a response - it can be put to the repository's "Deploy keys" to give the Radix access to an internal or a private repository.rx create application --application your-application-name --repository https://github.com/your-repository --config-branch main --ad-groups abcdef-1234-5678-9aaa-abcdefgf --shared-secret someSecretPhrase12345 --configuration-item "YOUR PROJECT CONFIG ITEM" --context playground
Deploy pipeline job
- Create a new "deploy only" pipeline job. An optional argument
--follow
(-f
) allows to watch the log of the jobrx create pipeline-job deploy --application your-app-name --environment dev --follow
rx create pipeline-job deploy -a your-app-name -e dev -f
An option job
of commands create
, get logs
is replaced with pipeline-job
. It will be supported for backward compatibility.
- Create a new "deploy only" pipeline job with specified image tags. When
radixconfig.yaml
containsimage
option with dynamic imageTagName, thisimageTagName
can be altered in the Radix CLIcreate pipeline-job deploy
command optionimage-tag-name
. This option will override values defined in theradixconfig.yaml
and can be defined for multiple components in the command.image-tag-name
, provided as an option in the commandrx create pipeline-job deploy
is shown in the Radix pipeline orchestration job log. Component names that does not exist within the Radix application environment will be ignored.rx create pipeline-job deploy --application your-app-name --environment dev --image-tag-name web-app=stable-123 --image-tag-name api=1.22.0
rx create pipeline-job deploy -a your-app-name -e dev -t web-app=stable-123 -t api=1.22.0 - Specify
commitID
to provide reference to a corresponding commit in the Radix console.rx create pipeline-job deploy --application your-app-name --environment dev --commitID 019e0d411de667dff6952852e03b4a38b0a689c3
- Specify
component
to deploy when only specific component need to be deployed. Multiple components can be specified. Other components, if exist in the environment, will not be re-deployed, keeping theircommitID
andgitTag
, environment variables, secrets, etc., their replicas will not be restarted.rx create pipeline-job deploy --application your-app-name --environment dev --component web-app
rx create pipeline-job deploy -a your-app-name -e dev --component web-app --component api-server --commitID 019e0d411de667dff6952852e03b4a38b0a689c3
Build and deploy pipeline job
-
Create a new "build and deploy" pipeline job
# build latest commit of main branch
rx create pipeline-job build-deploy -a your-app-name --branch main
# build a specific commit in the main branch
rx create pipeline-job build-deploy -a your-app-name --branch main --commitID e98ce2247a466c19bf7ab23527bd6331a23e27d3
# build a specific tag
rx create pipeline-job build-deploy -a your-app-name --tag v1.5.0Argument
--branch
defines a GitHub branch to build. Builds environments where fromType is set tobranch
or not configured.Argument
--tag
defines a GitHub tag to build. Builds environments where fromType is set totag
or not configured.--branch
and--tag
cannot be used together.Optional argument
--commitID=<long commit hash>
defines a specific git commit to build for the branch specified in--branch
. If ommitted, Radix will use the latest commit for the branch.Optional argument
--use-build-cache=true|false
can override the radixconfig option useBuildCacheOptional argument
--refresh-build-cache=true
refreshes the build cache. Read more about refreshing the build cache.