{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "title": "atomic-reactor server-side configuration",
    "type": [
        "object",
        "null"
    ],
    "properties": {
        "version": {
            "type": "integer"
        },
        "clusters": {
            "description": "Clusters grouped by platform name",
            "type": "object",
            "patternProperties": {
                "^[a-zA-Z0-9_]*$": {
                    "description": "List of clusters for this platform",
                    "type": "array",
                    "items": {
                        "properties": {
                            "name": {
                                "description": "osbs-client instance name for this cluster",
                                "type": "string"
                            },
                            "max_concurrent_builds": {
                                "description": "Maximum number of active builds",
                                "type": "integer",
                                "minimum": 0
                            },
                            "enabled": {
                                "description": "Whether this cluster should be used",
                                "type": "boolean",
                                "default": true
                            }
                        },
                        "additionalProperties": false,
                        "required": [
                            "name",
                            "max_concurrent_builds"
                        ]
                    }
                }
            },
            "additionalProperties": false
        },
        "clusters_client_config_dir": {
            "description": "Path to directory with osbs.conf for communicating with workers",
            "type": "string"
        },
        "koji": {
            "description": "Koji instance",
            "type": "object",
            "properties": {
                "hub_url": {
                    "description": "Koji hub's xmlrpc url",
                    "type": "string"
                },
                "root_url": {
                    "description": "Koji's root storage url",
                    "type": "string"
                },
                "auth": {
                    "description": "Authentication information",
                    "type": "object",
                    "anyOf": [
                        {
                            "properties": {
                                "proxyuser": {
                                    "$ref": "#/definitions/proxyuser"
                                },
                                "ssl_certs_dir": {
                                    "description": "Path to directory with cert and ca files",
                                    "type": "string"
                                }
                            },
                            "additionalProperties": false,
                            "required": [
                                "ssl_certs_dir"
                            ]
                        },
                        {
                            "properties": {
                                "proxyuser": {
                                    "$ref": "#/definitions/proxyuser"
                                },
                                "krb_cache_path": {
                                    "description": "Path to kerberos credential cache file",
                                    "type": "string"
                                },
                                "krb_principal": {
                                    "description": "Kerberos principal",
                                    "type": "string"
                                },
                                "krb_keytab_path": {
                                    "description": "Location of Kerberos keytab, e.g. FILE:<absolute_path>",
                                    "type": "string"
                                }
                            },
                            "additionalProperties": false,
                            "required": [
                                "krb_principal",
                                "krb_keytab_path"
                            ]
                        },
                        {
                            "properties": {
                                "proxyuser": {
                                    "$ref": "#/definitions/proxyuser"
                                }
                            },
                            "additionalProperties": false
                        }
                    ]
                },
                "use_fast_upload": {
                    "description": "Use Koji's fast upload API",
                    "type": "boolean",
                    "default": true
                },
                "reserve_build": {
                    "description": "Reserve build id and NVR through Content Generator API. If set, requires koji > 1.17.0",
                    "type": "boolean",
                    "default": false
                },
                "insecure_download": {
                    "description": "Download data from koji insecurely",
                    "type": "boolean",
                    "default": false
                },
                "delegate_task": {
                    "description": "Autorebuild will create new intermediate task, instead of using original task",
                    "type": "boolean",
                    "default": true
                },
                "delegated_task_priority": {
                    "description": "When delegate_build is enabled, delegated task will use this koji task priority, if not set it will use default koji priority",
                    "type": "integer"
                },
                "task_annotations_whitelist": {
                    "description": "Annotations to be included in the build_annotations.json task output file. If empty or not described, the file will not be generated",
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                }
            },
            "additionalProperties": false,
            "required": [
                "hub_url",
                "root_url",
                "auth"
            ]
        },
        "pulp": {
            "description": "Pulp registry instance (deprecated)",
            "type": "object",
            "properties": {
                "name": {
                    "description": "Pulp registry name, specified in /etc/dockpulp.conf",
                    "type": "string"
                },
                "loglevel": {
                    "description": "Log level",
                    "type": "string"
                },
                "auth": {
                    "description": "Authentication information",
                    "type": "object",
                    "anyOf": [
                        {
                            "properties": {
                                "ssl_certs_dir": {
                                    "description": "Path to directory with pulp.cer and pulp.key files",
                                    "type": "string"
                                }
                            },
                            "required": [
                                "ssl_certs_dir"
                            ],
                            "additionalProperties": false
                        },
                        {
                            "properties": {
                                "username": {
                                    "description": "Pulp username",
                                    "type": "string"
                                },
                                "password": {
                                    "description": "Pulp password",
                                    "type": "string"
                                }
                            },
                            "required": [
                                "username",
                                "password"
                            ],
                            "additionalProperties": false
                        }
                    ]
                }
            },
            "additionalProperties": false,
            "required": [
                "name",
                "auth"
            ]
        },
        "odcs": {
            "description": "OnDemand Compose Service (ODCS) instance",
            "type": "object",
            "properties": {
                "api_url": {
                    "description": "ODCS api url, including api version",
                    "type": "string"
                },
                "insecure": {
                    "description": "Don't check SSL certificate for api_url",
                    "type": "boolean"
                },
                "auth": {
                    "description": "Authentication information",
                    "type": "object",
                    "anyOf": [
                        {
                            "properties": {
                                "ssl_certs_dir": {
                                    "description": "Path to directory with cert file",
                                    "type": "string"
                                }
                            },
                            "additionalProperties": false,
                            "required": [
                                "ssl_certs_dir"
                            ]
                        },
                        {
                            "properties": {
                                "openidc_dir": {
                                    "description": "Path to directory with token file",
                                    "type": "string"
                                }
                            },
                            "additionalProperties": false,
                            "required": [
                                "openidc_dir"
                            ]
                        }
                    ]
                },
                "signing_intents": {
                    "description": "List of signing intents",
                    "type": "array",
                    "items": {
                        "properties": {
                            "name": {
                                "description": "signing intent name",
                                "type": "string"
                            },
                            "keys": {
                                "description": "signing intent keys",
                                "type": "array",
                                "items": {
                                    "type": "string"
                                }
                            },
                            "deprecated_keys": {
                                "description": "deprecated signing intent keys",
                                "type": "array",
                                "items": {
                                    "type": "string"
                                }
                            }
                        },
                        "additionalProperties": false,
                        "required": [
                            "name",
                            "keys"
                        ]
                    }
                },
                "default_signing_intent": {
                    "description": "Default signing intent",
                    "type": "string"
                },
                "timeout": {
                    "description": "How long in seconds to wait for requested compose to complete. Defaults to 3600",
                    "type": "integer"
                }
            },
            "additionalProperties": false,
            "required": [
                "api_url",
                "auth",
                "signing_intents",
                "default_signing_intent"
            ]
        },
        "omps": {
            "description": "Integration with OMPS service for pushing operators manifests to appregistry",
            "type": [
                "object",
                "null"
            ],
            "properties": {
                "omps_url": {
                    "description": "URL of OMPS REST API",
                    "type": "string"
                },
                "omps_namespace": {
                    "description": "Namespace (organization) where manifest will be pushed",
                    "type": "string"
                },
                "omps_secret_dir": {
                    "description": "Path to dir with secrets",
                    "type": "string"
                },
                "appregistry_url": {
                    "description": "URL for appregistry where operator manifests are stored",
                    "type": "string"
                },
                "koji_insecure": {
                    "description": "Download data from koji insecurely (default: false)",
                    "type": "boolean"
                },
                "insecure": {
                    "description": "Connect to OMPS service insecurely (default: false)",
                    "type": "boolean"
                }
            },
            "additionalProperties": false,
            "required": [
                "omps_url",
                "omps_namespace",
                "omps_secret_dir",
                "appregistry_url"
            ]
        },
        "smtp": {
            "description": "SMTP notifications",
            "type": "object",
            "properties": {
                "host": {
                    "description": "SMTP host server name",
                    "type": "string"
                },
                "from_address": {
                    "description": "From email address in notification email",
                    "type": "string"
                },
                "additional_addresses": {
                    "description": "Email addresses to always send notification email",
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "error_addresses": {
                    "description": "Email addresses to send notifications if no other email address can be resolved",
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "domain": {
                    "description": "Domain used when constructing email addresses",
                    "type": "string"
                },
                "send_to_submitter": {
                    "description": "Send email notification to Koji task submitter",
                    "type": "boolean"
                },
                "send_to_pkg_owner": {
                    "description": "Send email notification to Koji package owner",
                    "type": "boolean"
                }
            },
            "additionalProperties": false,
            "required": [
                "host",
                "from_address"
            ]
        },
        "cachito": {
            "description": "Cachito instance",
            "type": "object",
            "properties": {
                "api_url": {
                    "description": "Cachito API url",
                    "type": "string"
                },
                "insecure": {
                    "description": "Don't check SSL certificate for api_url",
                    "type": "boolean"
                },
                "unknown_user": {
                    "description": "User to set in cachito request user param in case koji user is not found",
                    "type": "string",
                    "default": "unknown_user"
                },
                "auth": {
                    "description": "Authentication information",
                    "type": "object",
                    "properties": {
                        "ssl_certs_dir": {
                            "description": "Path to directory with cert file",
                            "type": "string"
                        }
                    },
                    "additionalProperties": false
                },
                "timeout": {
                    "description": "How long in seconds to wait for a Cachito request completes",
                    "type": "integer",
                    "default": 3600
                }
            },
            "additionalProperties": false,
            "required": [
                "api_url",
                "auth"
            ]
        },
        "arrangement_version": {
            "description": "Arrangement version",
            "type": "integer"
        },
        "artifacts_allowed_domains": {
            "description": "Domains allowed to use when fetching artifacts by url, if not specified no restrictions will be applied",
            "type": "array",
            "items": {
                "type": "string"
            }
        },
        "yum_repo_allowed_domains": {
            "description": "Domains allowed when fetching yum repo files. If not specified, no restrictions will be applied. The restriction does not apply to scratch builds",
            "type": "array",
            "items": {
                "type": "string"
            }
        },
        "image_labels": {
            "description": "Labels to be applied to container image",
            "type": "object",
            "patternProperties": {
                "^[\\w\\.-]+$": {
                    "type": "string"
                }
            },
            "additionalProperties": false
        },
        "image_label_info_url_format": {
            "description": "URL format (with {label}-style substitution) for 'info' label",
            "type": "string"
        },
        "image_equal_labels": {
            "description": "Labels that are expected to be equal in value",
            "type": "array",
            "items": {
                "type": "array",
                "items": {
                    "type": "string"
                }
            }
        },
        "openshift": {
            "description": "OpenShift instance running build",
            "type": "object",
            "properties": {
                "url": {
                    "description": "OpenShift url",
                    "type": "string"
                },
                "insecure": {
                    "description": "Don't check SSL certificate for url",
                    "type": "boolean"
                },
                "build_json_dir": {
                    "description": "Path to directory containing Json files templates for osbs-client lib",
                    "type": "string"
                },
                "auth": {
                    "description": "Authentication information",
                    "type": "object",
                    "anyOf": [
                        {
                            "properties": {
                                "enable": {
                                    "$ref": "#/definitions/enable"
                                },
                                "krb_cache_path": {
                                    "description": "Path to kerberos credential cache file",
                                    "type": "string"
                                },
                                "krb_principal": {
                                    "description": "Kerberos principal",
                                    "type": "string"
                                },
                                "krb_keytab_path": {
                                    "description": "Location of Kerberos keytab, e.g. FILE:<absolute_path>",
                                    "type": "string"
                                }
                            },
                            "additionalProperties": false,
                            "required": [
                                "krb_principal",
                                "krb_keytab_path"
                            ]
                        },
                        {
                            "properties": {
                                "enable": {
                                    "$ref": "#/definitions/enable"
                                },
                                "ssl_certs_dir": {
                                    "description": "Path to directory with cert, key and ca files",
                                    "type": "string"
                                }
                            },
                            "additionalProperties": false,
                            "required": [
                                "ssl_certs_dir"
                            ]
                        },
                        {
                            "properties": {
                                "enable": {
                                    "$ref": "#/definitions/enable"
                                }
                            },
                            "additionalProperties": false
                        }
                    ]
                }
            },
            "additionalProperties": false,
            "required": [
                "url"
            ]
        },
        "group_manifests": {
            "description": "Create manifest list, or image index, in container registry",
            "type": "boolean"
        },
        "platform_descriptors": {
            "description": "Definition of supported platforms",
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "platform": {
                        "type": "string"
                    },
                    "architecture": {
                        "type": "string"
                    }
                },
                "additionalProperties": false
            }
        },
        "prefer_schema1_digest": {
            "description": "schema 1 as preferred digest",
            "type": "boolean"
        },
        "content_versions": {
            "description": "Produce container image of given version",
            "type": "array",
            "items": {
                "type": "string",
                "enum": [
                    "v2"
                ]
            }
        },
        "registries_organization": {
            "$ref": "#/definitions/organization"
        },
        "registries": {
            "description": "Container registries to output images",
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "url": {
                        "description": "Registry URI including version",
                        "type": "string"
                    },
                    "insecure": {
                        "description": "Don't check SSL certificate for url",
                        "type": "boolean"
                    },
                    "auth": {
                        "$ref": "#/definitions/registry_auth"
                    },
                    "expected_media_types": {
                        "$ref": "#/definitions/media_types"
                    }
                },
                "additionalProperties": false,
                "required": [
                    "url"
                ]
            }
        },
        "yum_proxy": {
            "description": "Proxy to access yum repositories",
            "type": "string"
        },
        "skip_koji_check_for_base_image": {
            "description": "Allow base image without a related koji build (insecure) when there are no NVR labels set on the base image. If the NVR labels are set on the base image, the check is performed regardless",
            "type": "boolean"
        },
        "deep_manifest_list_inspection": {
            "description": "If manifest list digest check fails, inspect the manifest list contents",
            "type": "boolean",
            "default": true
        },
        "fail_on_digest_mismatch": {
            "description": "Raise an error and stop build when a manifest list digest check fails",
            "type": "boolean",
            "default": true
        },
        "hide_files": {
            "description": "Hide files during build for each stage",
            "type": "object",
            "properties": {
                "tmpdir": {
                    "description": "Temporary location, where files will be hidden",
                    "type": "string",
                    "minLength": 1
                },
                "files": {
                    "description": "List of files to hide",
                    "type": "array",
                    "items": {
                        "type": "string",
                        "minLength": 1
                    },
                    "minItems": 1,
                    "_uniqueItems": true
                }
            },
            "additionalProperties": false,
            "required": [
                "tmpdir",
                "files"
            ]
        },
        "source_registry": {
            "description": "Default container registry to use for pulling images",
            "$ref": "#/definitions/source_registry"
        },
        "pull_registries": {
            "description": "Other container registries that may be used for pulling images",
            "type": "array",
            "items": {
                "description": "Any container registry other than the default one",
                "$ref": "#/definitions/source_registry"
            }
        },
        "sources_command": {
            "description": "Command to retrieve artifacts in lookaside cache",
            "type": "string"
        },
        "required_secrets": {
            "description": "List of OpenShift secrets required by this configuration",
            "type": "array",
            "items": {
                "type": "string"
            }
        },
        "worker_token_secrets": {
            "description": "List of OpenShift secrets for worker clusters authentication",
            "type": "array",
            "items": {
                "type": "string"
            }
        },
        "build_image_override": {
            "description": "Specify different build_image image for platforms",
            "type": "object",
            "additionalProperties": {
                "type": "string"
            }
        },
        "default_image_build_method": {
            "description": "Specify different default buildstep plugin for worker builds",
            "enum": [
                "docker_api",
                "imagebuilder",
                "buildah_bud"
            ]
        },
        "buildstep_alias": {
            "description": "Aliases for buildstep plugins",
            "type": "object",
            "patternProperties": {
                "^[\\w_]+$": {
                    "type": "string",
                    "enum": [
                        "docker_api",
                        "imagebuilder"
                    ]
                }
            },
            "additionalProperties": false
        },
        "flatpak": {
            "description": "Flatpak specific properties",
            "type": "object",
            "properties": {
                "base_image": {
                    "description": "host image used to install packages when creating a Flatpak",
                    "type": "string"
                },
                "metadata": {
                    "description": "how to store Flatpak metadata in the image",
                    "type": "string",
                    "enum": [
                        "annotations",
                        "labels",
                        "both"
                    ]
                }
            },
            "additionalProperties": false
        },
        "package_comparison_exceptions": {
            "description": "List of packages that are not compared across architectures",
            "type": "array",
            "items": {
                "type": "string"
            }
        },
        "source_container": {
            "description": "Properties relating to source containers",
            "type": "object",
            "properties": {
                "limit_media_types": {
                    "description": "Do not report any media types other than these",
                    "allOf": [
                        {
                            "$ref": "#/definitions/media_types"
                        }
                    ]
                },
                "denylist_srpms": {
                    "description": "Don't include srpms specified in denylist json with key",
                    "type": "object",
                    "properties": {
                        "denylist_url": {
                            "description": "Url with denylist json file",
                            "type": "string"
                        },
                        "denylist_key": {
                            "description": "Key in denylist json file, with denylist sources as list (with SRPM names)",
                            "type": "string"
                        }
                    },
                    "required": [
                        "denylist_url",
                        "denylist_key"
                    ]
                }
            },
            "additionalProperties": false
        },
        "operator_manifests": {
            "description": "Configuration for operator manifest bundle builds",
            "type": "object",
            "properties": {
                "allowed_registries": {
                    "description": "Registries allowed to appear in pullspecs, use null to allow all",
                    "type": [
                        "array",
                        "null"
                    ],
                    "items": {
                        "type": "string"
                    },
                    "minItems": 1,
                    "examples": [
                        null,
                        [
                            "registry.fedoraproject.org",
                            "quay.io"
                        ]
                    ]
                },
                "repo_replacements": {
                    "description": "Replacements for repos found in pullspecs, configured per registry",
                    "type": "array",
                    "items": {
                        "type": "object",
                        "properties": {
                            "registry": {
                                "type": "string"
                            },
                            "package_mappings_url": {
                                "description": "URL of file containing repo replacement mappings",
                                "type": "string",
                                "pattern": "^http(s?)://.*$"
                            }
                        },
                        "required": [
                            "registry",
                            "package_mappings_url"
                        ],
                        "additionalProperties": false
                    }
                },
                "registry_post_replace": {
                    "description": "After looking up image digest, replace original registries",
                    "type": "array",
                    "items": {
                        "type": "object",
                        "properties": {
                            "old": {
                                "description": "Original registry",
                                "type": "string"
                            },
                            "new": {
                                "description": "Replacement registry",
                                "type": "string"
                            }
                        },
                        "required": [
                            "old",
                            "new"
                        ],
                        "additionalProperties": false
                    }
                }
            },
            "required": [
                "allowed_registries"
            ],
            "additionalProperties": false
        },
        "build_env_vars": {
            "description": "Variables to propagate to build environment",
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "name": {
                        "description": "Name of environment variable",
                        "type": "string"
                    },
                    "value": {
                        "description": "Value of environment variable",
                        "type": "string"
                    }
                },
                "additionalProperties": false,
                "required": [
                    "name",
                    "value"
                ]
            }
        },
        "image_size_limit": {
            "description": "Define maximum uncompressed image size in bytes for binary image checked before push",
            "type": "object",
            "properties": {
                "binary_image": {
                    "description": "Maximum size of binary images. Set to 0 or omit to skip the check",
                    "type": "integer",
                    "minimum": 0
                }
            },
            "additionalProperties": false
        }
    },
    "definitions": {
        "enable": {
            "description": "Enable authentication",
            "type": "boolean"
        },
        "proxyuser": {
            "description": "Login as different user",
            "type": "string"
        },
        "organization": {
            "description": "Registry organization",
            "type": "string"
        },
        "media_types": {
            "description": "Media types to be found in registry",
            "type": "array",
            "items": {
                "type": "string",
                "enum": [
                    "application/json",
                    "application/vnd.docker.distribution.manifest.v1+json",
                    "application/vnd.docker.distribution.manifest.v2+json",
                    "application/vnd.docker.distribution.manifest.list.v2+json",
                    "application/vnd.oci.image.manifest.v1+json",
                    "application/vnd.oci.image.index.v1+json"
                ]
            }
        },
        "registry_auth": {
            "description": "Registry authentication information",
            "type": "object",
            "properties": {
                "cfg_path": {
                    "description": "Path to directory containing .dockercfg for registry auth",
                    "type": "string"
                }
            },
            "additionalProperties": false,
            "required": [
                "cfg_path"
            ]
        },
        "source_registry": {
            "type": "object",
            "properties": {
                "url": {
                    "description": "Registry url",
                    "type": "string"
                },
                "insecure": {
                    "description": "Don't check SSL certificate for url",
                    "type": "boolean"
                },
                "auth": {
                    "$ref": "#/definitions/registry_auth"
                }
            },
            "additionalProperties": false,
            "required": [
                "url"
            ]
        }
    },
    "required": [
        "version",
        "koji"
    ]
}