You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What happened:
Upon creating a routing template in an Alertmanager integration, the template evaluates to True or False depending on payload, yet I cannot save it due to a 'Regular expression is incorrect' error. Here is the template:
{%setallowed_clusters = ["lab", "dev", "stage"] -%}{%- setallowed_namespaces = ["argocd", "cert-manager", "dex", "ingress-controller", "kube-system", "logging", "loki", "longhorn-system", "monitoring", "openebs-system"] -%}
{{ true if payload.commonLabels.cluster in allowed_clusters and (payload.commonLabels.namespace in allowed_namespaces or payload.commonLabels.namespace | regex_match(".*-operator")) else false }}
What did you expect to happen:
Since the template correctly evaluates to True of False, it should contain no errors and I must be able to save it
How do we reproduce it?
Open Grafana OnCall and create an Alertmanager integration with the aforementioned routing template
Click the 'Save' button
A 'Regular expression is incorrect' will be displayed
Grafana OnCall Version
v1.4.3
Product Area
Alert Flow & Configuration
Grafana OnCall Platform?
Kubernetes
User's Browser?
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:125.0) Gecko/20100101 Firefox/125.0
Anything else to add?
No response
The text was updated successfully, but these errors were encountered:
After prodding at the expression some more, I have found out that the error is caused by hyphens in variable values (cert-manager, kube-system, etc.). Putting those in a regex_match function works, but why can't I have them as strings?
…4357)
# What this PR does
When editing a jinja route template the filtering_term_type was not
being provided so it was being validated as regex instead. This adds the
missing flag so that the route will use the correct validation. The
reason this was not being hit in the past is most jinja templates were
still passing regex validation.
## Which issue(s) this PR closes
Closes#4259
<!--
*Note*: if you have more than one GitHub issue that this PR closes, be
sure to preface
each issue link with a [closing
keyword](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/using-keywords-in-issues-and-pull-requests#linking-a-pull-request-to-an-issue).
This ensures that the issue(s) are auto-closed once the PR has been
merged.
-->
## Checklist
- [ ] Unit, integration, and e2e (if applicable) tests updated
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
show up in the autogenerated release notes.
What went wrong?
What happened:
Upon creating a routing template in an Alertmanager integration, the template evaluates to True or False depending on payload, yet I cannot save it due to a 'Regular expression is incorrect' error. Here is the template:
What did you expect to happen:
Since the template correctly evaluates to True of False, it should contain no errors and I must be able to save it
How do we reproduce it?
Grafana OnCall Version
v1.4.3
Product Area
Alert Flow & Configuration
Grafana OnCall Platform?
Kubernetes
User's Browser?
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:125.0) Gecko/20100101 Firefox/125.0
Anything else to add?
No response
The text was updated successfully, but these errors were encountered: