qtag_matches
If a query contains one or more valid QTAG-formatted comments, this function allows regular-expression matching of values
for specific QTag source
s (publishers) and key
s. 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
.
QTAG_MATCHES(<source>, <key>, <value_regexp>) RETURNS BOOLEAN
<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>
.
This function is available for use in Sundeck pre- and post-hook conditions.
QTag Comment | Function Call | Returns |
---|---|---|
-- {\"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 |
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!