Skip to content

kubeshop/setup-testkube

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

Testkube Logo

Welcome to Testkube - Your friendly cloud-native testing framework for Kubernetes

Website | Documentation | Twitter | Discord | Blog


Setup Testkube CLI with GitHub Actions

"Setup Testkube CLI" is a GitHub Action for managing your Testkube installation.

Use it to install Testkube CLI to manage your resources, run tests and test suites, or anything else.

Table of content

  1. Usage
    1. Testkube Pro
    2. Self-hosted instance
    3. Examples
      1. Run a test on AWS EKS
      2. Run a test on the Pro instance
  2. Inputs
    1. Common
    2. Kubernetes (kubectl)
    3. Pro and Enterprise

Usage

To use the action in your GitHub workflow, use kubeshop/setup-testkube@v1 action. The configuration options are described in the Inputs section, and may vary depending on the Testkube solution you are using (Pro or self-hosted) and your needs.

Testkube Pro

To use this GitHub Action for the Testkube Pro, you need to create API token.

Then, pass the organization and environment IDs for the test, along with the token and other parameters specific for your use case:

uses: kubeshop/setup-testkube@v1
with:
  # Instance
  organization: tkcorg_0123456789abcdef
  environment: tkcenv_fedcba9876543210
  token: tkcapi_0123456789abcdef0123456789abcd

It will be probably unsafe to keep directly in the workflow's YAML configuration, so you may want to use Github's secrets instead.

uses: kubeshop/setup-testkube@v1
with:
  # Instance
  organization: ${{ secrets.TkOrganization }}
  environment: ${{ secrets.TkEnvironment }}
  token: ${{ secrets.TkToken }}

Self-hosted instance

To connect to the self-hosted instance, you need to have kubectl configured for accessing your Kubernetes cluster, and simply passing optional namespace, if the Testkube is not deployed in the default testkube namespace, i.e.:

uses: kubeshop/setup-testkube@v1
with:
  namespace: custom-testkube

Examples

Run a test on AWS EKS

steps:
  # Set up Kubectl (AWS EKS)
  - uses: aws-actions/configure-aws-credentials@v4
    with:
      aws-access-key-id: ${{ secrets.AwsAccessKeyId }}
      aws-secret-access-key: ${{ secrets.AwsSecretAccessKey }}
      aws-region: ${{ secrets.AwsRegion }}
  - run: |
      aws eks update-kubeconfig --name ${{ secrets.EksClusterName }} --region ${{ secrets.AwsRegion }}

  # Setup Testkube
  - uses: kubeshop/setup-testkube@v1

  # Use CLI with a shell script
  - run: |
      testkube run test some-test-name -f

Run a test on the Pro instance

steps:
  # Setup Testkube
  - uses: kubeshop/setup-testkube@v1
    with:
      organization: ${{ secrets.TkOrganization }}
      environment: ${{ secrets.TkEnvironment }}
      token: ${{ secrets.TkToken }}

  # Use CLI with a shell script
  - run: |
      testkube run test some-test-name -f

Inputs

Besides common inputs, there are some different for kubectl and Pro connection.

Common

Required Name Description
channel Distribution channel to install the latest application from - one of stable or beta (default: stable)
version Static Testkube CLI version to force its installation instead of the latest

Kubernetes (kubectl)

Required Name Description
namespace Set namespace where Testkube is deployed to (default: testkube)

Pro and Enterprise

Required Name Description
organization The organization ID from Testkube Pro or Enterprise - it starts with tkc_org, you may find it i.e. in the dashboard's URL
environment The environment ID from Testkube Pro or Enterprise - it starts with tkc_env, you may find it i.e. in the dashboard's URL
token API token that has at least a permission to run specific test or test suite. You may read more about creating API token in Testkube Pro or Enterprise
url URL of the Testkube Enterprise instance, if applicable
urlApiSubdomain API subdomain the Testkube Enterprise URL, if necessary
urlUiSubdomain Dashboard subdomain the Testkube Enterprise URL, if necessary
urlLogsSubdomain Logs Server subdomain the Testkube Enterprise URL, if necessary