grace lint
Validate the syntax and structure of a grace.yml workflow file.
The grace lint command checks a grace.yml workflow definition file for correctness against Grace's schema and validation rules. It's an essential tool for catching configuration errors before attempting to deck or run a workflow.
lintperforms static analysis of yourgrace.ymland does not interact with z/OS or execute any part of the workflow.
Usage
Arguments
[workflow-file] (optional)
- The path to the Grace workflow file you want to validate.
- If omitted,
grace lintdefaults to looking for a file namedgrace.ymlin the current directory.
Flags
-h, --help
- Displays help information for the
lintcommand.
What it checks
grace lint performs a comprehensive set of validations, including but not limited to:
- YAML syntax: Ensures the file is valid YAML.
- Required fields: Checks for the presence of mandatory fields at global,
config,datasets, and individual jobs levels (e.g.,config.profile,datasets.jcl,job.name,job.type). - Data types: Verifies that field values conform to their expected data types (e.g.,
config.concurrencyis an integer). - Dataset naming conventions: Validates that DSNs specified in
datasets(and job-level overrides) adhere to z/OS naming rules (qualifier length, character set, number of qualifiers). - PDS member names: Ensures job.name and other fields used as PDS member names (like job.program for link-edit output) are valid.
- Job types: Verifies that job.type is a known and registered job handler type (e.g., compile, linkedit, execute, shell).
- Handler-specific validation: Each job handler performs its own validation for job-specific fields. For example:
shelljobs: Checks for thewithblock and that eitherscriptorinlineis provided.executejobs: Checks for a valid program field and that a load library is defined.compilejobs: Checks for necessary inputs/outputs.
- Input/output definitions:
- Ensures
name(DDName) andpath(virtual path) are present for each input/output. - Validates DDName format.
- Validates virtual path scheme (e.g.,
src://,zos://,zos-temp://,file://,local-temp://). - Checks for duplicate DDNames within a single job's inputs or outputs.
- Checks for conflicts where an output DDName is the same as an input DDName in the same job.
- Ensures
- Dependency resolution:
- Ensures that all jobs listed in a
depends_onarray exist. - Checks that a job does not depend on itself.
- Ensures that all jobs listed in a
- Dependency cycles: Detects circular dependencies between jobs (e.g., Job A depends on Job B, and Job B depends on Job A).
- Virtual path production:
- Ensures that
zos-temp://andlocal-temp://input paths are produced by an output of some job in the workflow. - Warns or errors if multiple jobs attempt to produce the exact same
zos-temp://orlocal-temp://virtual path.
- Ensures that
Output
If valid:
If invalid:
When to use
- Early and often: Run grace lint frequently as you develop your grace.yml file.
- Before
grace deck: Ensure your configuration is valid before attempting to sync your local workspace to your target z/OS environment. - Before
grace runorgrace submit: Catch errors before initiating actual job execution. - In CI/CD pipelines: Integrate
grace lintas an automated check to ensure workflow definitions merged into your codebase are valid.
By using grace lint, you can significantly reduce the time spent debugging configuration issues and gain confidence in your workflow definitions.