Documentation
Toggle Dark/Light/Auto modeToggle Dark/Light/Auto modeToggle Dark/Light/Auto modeBack to homepage

qtag_matches

If a query contains one or more valid QTAG-formatted comments, this function allows regular-expression matching of values for specific QTag sources (publishers) and keys. If the specified QTag source and key are found, then the key’s value is evaluated against the regular expression, and if matched the function returns TRUE. All other cases return FALSE.

Syntax

QTAG_MATCHES(<source>, <key>, <value_regexp>) RETURNS BOOLEAN

Arguments

<source>
The identifer of the publisher of the QTag comment (per the list below of pre-defined QTag sources); if the <source> string does not match one of these pre-defined strings, then the value passed is used to string-match the first portion of the QTag comment (between the initial -- and the first { which denotes the beginning of the JSON object.
<key>
The object key we want to search for within the QTag comment object
<value_regexp>
A regular expression used to match the value found for the <source> and <key>.

Usage Notes

This function is available for use in Sundeck pre- and post-hook conditions.

Examples

QTag CommentFunction CallReturns
-- {\"app\":\"dbt\"}QTAG_MATCHES('dbt', 'app', 'd.*')TRUE
-- Sigma Σ {"kind":"San Francisco"}QTAG_MATCHES('sigma', 'kind', 'San* [fF].*')TRUE
-- Sigma Σ {"kind":"San Francisco"}QTAG_MATCHES('sigma', 'kind', 'san.*')FALSE

Pre-defined QTag Sources

The following are the pre-defined QTag <source> identifiers which are recognized by the qtag_matches() function:

  • dbt
  • hex
  • mode
  • sigma
  • sundeck

JSON comments written by these tools have a vendor-specific format, and QTag recognizes and decodes these. Note that additional vendor-specific formats are being added continuously by the community, so check back often!