Closed izenk closed 1 year ago
You pipeline does:
sh 'echo "DEBUG: !!!!!!!!!!"'
And you supply build log:
01:34:39 [Pipeline] echo
01:34:39 class java.lang.String
01:34:39 [Pipeline] echo
01:34:39 ["test_sentry_to_jira"]
So hard to say exactly what you are doing here.
The build log states:
Contributing variables:
customer = ["test_sentry_to_jira"]
customer_0 = test_sentry_to_jira
I would suggest:
customer_0
variable.@tomasbjerre Ye, I copied build log from another build. Just see "Contributing variables" section. What do you mean under "Change the JSONPath to not match a branch, but an leaf. Not a list, just a single element."
Im using customer_0 right now, but it's just workaround, not fix.
This is not the place to ask about jsonpath. I would suggest trying this Stackoverflow and/or fiddle with an online evaluator like https://jsonpath.com/ . You will see the result of your jsonpath is a list.
@tomasbjerre I checked with https://jsonpath.com/ for two variables: Both are shown as list
But plugin returns one as simple string, and other one as string with square brackets
15:23:22 customer var type: class java.lang.String
15:23:22 [Pipeline] echo
15:23:22 customer var value: ["test_sentry_to_jira"]
15:23:22 [Pipeline] echo
15:23:22 test_var type: class java.lang.String
15:23:22 [Pipeline] echo
15:23:22 test_var value: test_sentry_to_jira_issue
Here is trigger config
triggers {
GenericTrigger(
genericVariables: [
[
key: 'sentry_issue_str',
value: '$',
defaultValue: '',
expressionType: 'JSONPath',
regexpFilter: ''
],
[
key: 'customer',
value: '$.event.tags[?(@[0] == "customer")][1]',
defaultValue: '',
expressionType: 'JSONPath',
regexpFilter: ''
],
[
key: 'test_var',
value: '$.project',
defaultValue: '',
expressionType: 'JSONPath',
regexpFilter: ''
],
],
causeString: 'Test sentry to jira issue',
printContributedVariables: true,
printPostContent: true,
regexpFilterExpression: '',
regexpFilterText: '',
shouldNotFlattern: false,
silentResponse: true,
token: 'testsentrytojiratoken',
tokenCredentialId: ''
)
}
Pipeline
Job log
Plugin returns it as string with brackets, while I expect just a simple value "test_sentry_to_jira":