qtag
Provides the ability to check for the existence of specific sources, keys and values from in QTAG-formatted comments. The source, key, and value to be searched are passed as parameters to the qtag function, and if the key is found within a qtag comment for the specified qtag source, and the value of that key matches the value passed, then the function returns TRUE
. All other cases return FALSE
.
QTAG(<source>, <key>, <value>) 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>
- Assuming the
<key>
is found within a QTag comment for the specified<source>
, this is the value we expect to find for that key (which will result in thisqtag()
call returningTRUE
This function is available for use in Sundeck pre- and post-hook conditions.
QTag Comment | Function Call | Returns |
---|---|---|
-- { "app":"sundeck", "job": "my_job" } | QTAG('sundeck', 'job', 'my_job') | TRUE |
-- { "app":"sundeck", "job": "my_job" } | QTAG('sundeck', 'job', 'other_job') | FALSE |
-- { "app":"sundeck", "job": "my_job" } | QTAG('sundeck', 'other_key', 'other_value') | FALSE |
-- { "app":"sundeck", "job": "my_job" } | QTAG('other_source', 'job', 'my_job') | FALSE |
The following are the pre-defined QTag source identifiers which are recognized by the qtag()
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!