Agent configuration file syntax

The agent-config.yml file configures how flows execute in CI/CD for your project. Place the file at .gitlab/duo/agent-config.yml in your project repository.

For more information about usage, see Configure flow execution.

The configuration file is read-only from the project’s default branch. Files committed to other branches are ignored, even when a flow runs from those branches.

Supported keys

KeyTypeDescription
imagestringDocker image to use for flow execution. Minimum 1 character, maximum 512 characters.
setup_scriptstring or array of stringsShell commands to run before the flow starts.
network_policyobjectNetwork access rules for the execution environment. For more information, see Configure a network policy.
network_policy.allowed_domainsarray of stringsDomains the flow can access. Maximum 1000 entries.
network_policy.denied_domainsarray of stringsDomains the flow cannot access. Maximum 1000 entries.
network_policy.include_recommended_allowedbooleanInclude GitLab recommended allowed domains. Default: false.
network_policy.allow_all_unix_socketsbooleanAllow all Unix socket connections. Default: false.
cacheobjectFiles and directories to preserve between flow runs. For more information, see Configure caching.
cache.pathsstring or array of stringsPaths to cache. Required for caching to take effect.
cache.keystring or objectCache key. If omitted, a default key is used.
cache.key.filesarray of stringsFiles used to generate a SHA-based cache key. Maximum 2 files.
cache.key.prefixstringPrefix combined with the file SHA to form the cache key. Requires files.

Complete example

The following example uses all available configuration options:

# Custom Docker image
image: python:3.11

# Setup script to run before the flow
setup_script:
  - apt-get update && apt-get install -y build-essential
  - pip install --upgrade pip
  - pip install -r requirements.txt

# Cache configuration
cache:
  key:
    files:
      - requirements.txt
      - Pipfile.lock
    prefix: python-deps
  paths:
    - .cache/pip
    - venv/

# Network configuration
network_policy:
  include_recommended_allowed: true
  allow_all_unix_sockets: true
  allowed_domains:
    - my-own-site.com
  denied_domains:
    - malicious.com