Skip to content

Tackle Provider

Hooks that interface with tackle's parser. Core to most tackle scripts.

Hooks

Type Description Return
block Hook for blocks of hooks. This is a special case where items are parsed like a normal context with the added benefit of maintaining a temporary_context so that items on the same level can be accessed in memory / rendered. Normally executed via a macro with an arrow. This the only hook the core parser is aware of as it is parsing. Union[dict, list]
debug Hook for debugging that prints the output data and pauses runtime. NoneType
exit Exit the parser with an exit code. NoneType
import Hook for importing external tackle providers. Does not actually execute the base tackle in the provider but makes the hooks defined in the hooks directory available to be called. Takes any type as an argument to build src and version import targets. NoneType
literal Literally return the input. Any
run_hook Hook to run other hooks dynamically. Any
tackle Hook for calling external tackle providers. dict
var Hook for rendering a variable based on an input. Only useful for rendering as otherwise you wouldn't need this hook at all. Does recursion when the value being rendered is still renderable - ie a template within a template. Any

Examples

debug

Hook to debug the context. Prints the context and holds the execution for user input.

d->: debug

tackle

Run other tackle providers / tackle files

compact_provider->: tackle robcxyz/tackle-provider
compact_file->: tackle path/to/tackle/file.yaml
expanded:
  ->: tackle
  input_string: robcxyz/tackle-provider
  checkout: dev  # Branch / version to checkout
  context_file: path/to/file.yaml  # Path to a file within a remote provider
  extra_context:  # Additional context to be brought in when running the tackle provider
    stuff: things

import

Import other tackle providers to allow use of other hooks. Typically run privately - ie _> to keep a clean context

compact_>: import robcxyz/tackle-provider
expanded:
  ->: tackle
  src: robcxyz/tackle-provider
  version: dev  # Branch / version to checkout

block

Run a block of tackle calls so that logic methods (ie if, for) can be run on a group of keys. Block hooks are common so there is a macro form of this hook (ie no explicit hook call).

stuff: things
macro_version->:
  if: stuff == 'things'
  stuff->: print other_things
  things->: print "{{ stuff }}" --if "{{ stuff == 'things' }}"

# Equivalent to
expanded:
  ->: block
  items:
    merge: true
    stuff->: print other_things
    things->: print "{{ stuff }}" --if "{{ stuff == 'things' }}"

var

Hook to render a variable. var hooks are common so there is a macro form of this hook (ie no explicit hook call).

stuff: things
macro_version->: "{{stuff}}"  # Any hook call that starts with `{{` is considered a var hook
compact->: var "{{stuff}}"
expanded:
  ->: var
  input: "{{stuff}}"
  # input's are rendered recursively so this flag only does one level of rendering
  # Useful when the input is itself a template and you don't want it to be rendered
  no_recursion: true

provider_docs

Extract metadata about the provider

example:
  type: provider_docs
  chdir: ".."
  provider: docs