Skip to main content

Custom runner

A custom runner enables you to validate your code by running builds, tests, and benchmarks on a preferred virtual machine.

Whilst validation commands can be executed on the runners available by default it is preferable to use a custom runner because there are a limited number of default runners available, and it is likely the default runners will not have the dependencies your project requires to be built and run.

Download the custom runner

Download the zip file from the downloads page and extract it to the directory of your choice somewhere on your local machine.

Configure environment variables

Navigate into your extracted Artemis custom runner directory.

cd artemis-tools

Update .env.credentials with your Artemis username, password, and runner name which is a short string to help you identify your runner i.e. <your name - your project>

nano .env.credentials

.env.credentials

ARTEMIS_USERNAME="<your artemis email address>"
ARTEMIS_PASSWORD="<your artemis password>"
ARTEMIS_RUNNER_NAME="<your runner name>"
ARTEMIS_ENVIRONMENT="production"

Install the custom runner

The remainder of this page directs you through the process of setting up a custom runner.

Create virtual environment

Create a virtual environment with Python 3.11 inside the extracted custom runner directory:

python3.11 -m venv .venv
source .venv/bin/activate

Install wheels

Install the Python dependencies for the runner from the wheels directory via the below pip command:

pip install --find-links wheels/ artemis-runner
Updating wheels

If you need to upgrade an existing custom runner you can update the wheels in an existing environment by running the following:

pip install --upgrade --force-reinstall --find-links wheels/ artemis-runner

Run the runner

artemis-runner --runner-name <your runner name>
Environments

The runner defaults to the production environment. If using the dev or staging environment, pass the --environment command line argument to program. For example, to use the staging environment:

artemis-runner --environment=staging --runner-name <your runner name>

All valid values can be inspected using artemis-runner --help

Connecting to On-premises deployments

You will require additional configuration in order to connect to an on-premises deployment:

  1. create a .env.custom with the required variables
  2. Set the environment flag to custom when starting the runner i.e.
artemis-runner --environment=custom --runner-name xxx

These are the required entries in .env.custom file. You will need to fill in the host, client id and client secret.

#########  THANOS  ###########
THANOS_CLIENT_ID=
THANOS_CLIENT_SECRET=
THANOS_GRANT_TYPE=password
THANOS_HOST=
THANOS_PORT=443
THANOS_POSTFIX=/turintech-thanos/api
THANOS_HTTPS=True
THANOS_READ_TIMEOUT=120

######### THOR ###########
THOR_HTTPS=True
THOR_HOST=
THOR_PORT=443
THOR_POSTFIX=/turintech-thor/api
THOR_READ_TIMEOUT=120

######### FALCON ###########
FALCON_HTTPS=True
FALCON_HOST=
FALCON_PORT=443
FALCON_POSTFIX=/turintech-falcon/api
FALCON_READ_TIMEOUT=120

######### VISION ###########
VISION_HTTPS=True
VISION_HOST=
VISION_PORT=443
VISION_POSTFIX=/turintech-vision/api
VISION_READ_TIMEOUT=120

######### LOKI ##########
LOKI_HTTPS=True
LOKI_HOST=
LOKI_PORT=443
LOKI_POSTFIX=/turintech-loki
LOKI_READ_TIMEOUT=120
LOKI_CONNECT_TIMEOUT=10

SSL Verification Configuration

You can configure SSL certificate verification by setting the ARTEMIS_SSL_VERIFY environment variable:

export ARTEMIS_SSL_VERIFY=true  # Use system CA certificates
export ARTEMIS_SSL_VERIFY=false # Disable SSL verification (not recommended for production)
export ARTEMIS_SSL_VERIFY=/path/to/your/ca/certificates.pem # Use custom CA certificates
Invalid Certificates

If you set this value to true and don't have valid CA certificates installed, you might encounter errors like:

[WARNING] 16:55:43,612 [client] (ThanosClient) Connection error, retrying: HTTPSConnectionPool(host='dev.artemis.turintech.ai', port=443): Max retries exceeded with url: /turintech-thanos/api/auth/login (Caused by SSLError(SSLCertVerificationError(1, "[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: Hostname mismatch, certificate is not valid for 'dev.artemis.turintech.ai'. (_ssl.c:1006)")))

In this case, you'll need to forcibly close the runner and either install proper CA certificates or use one of the other options.

warning

All microservices used by the custom runner must have HTTPS settings active for proper secure communication. Ensure that any services your runner interacts with are properly configured for HTTPS. For example, make sure to set THANOS_HTTPS=true and similar environment variables for other services.

Next steps

Now you have configured your custom runner you should set commands to run builds, tests, and benchmarks on your runner via the Build Settings page in the Artemis web console.