Command-line usage
Worker configuration files can be validated or converted from the command line, using the worker-validator
tool available after installing the Python package.
Conversion
Workers that were configured using the previous .arkindex.yml
format can be converted to the new format with the convert
subcommand:
worker-validator convert [PATH]
An optional path to a .arkindex.yml
file may be specified. If it is omitted, the file in the current directory will be used.
The converter will create an arkindex/
directory alongside the .arkindex.yml
file, and create one YAML file per worker named after its slug, then remove the .arkindex.yml
.
Each worker conversion may show warnings or errors. Should an error occur, no YAML file is saved. Should any warning occur, it will be printed to stderr and the conversion will continue while skipping part of the configuration or using a placeholder value.
The .arkindex.yml
will be removed only if the conversion took place without causing any warnings or errors.
Validation
Files in the new worker configuration format may be validated with the validate
subcommand:
worker-validator validate PATH [PATH …]
You may specify one or more paths to the configuration files to validate. All validation errors for all of the listed files will be printed, and the command will fail if any error occurred with any file.
pre-commit hook
Worker configuration validation can be performed automatically within a Git repository through a pre-commit hook:
repos:
- repo: https://gitlab.teklia.com/arkindex/workers/configuration
rev: 0.2.0
hooks:
- id: validate-worker-configuration
This hook will look for any YAML files within the arkindex
directory at the root of the repository and validate them.