How to concate two string on Swig? - swig-template

I am trying to concate a variable with another string but failed to do so. Till now i tried these things but failed.
{{name~' Leon'}} and {{name+' Leon'}}
remember i am trying to do it in swig not in twig.

Are you able to do it this way?
{{ name }} Leon

Related

Jenkins file can we use the IF statement

in Jenkins file one of the variable is having the comma separated values like below.
infra_services=[abc,def,xyz]
when I write the below code it was throwing an error.
if ("{$Infra_Services}".contains("xyz"))
then
echo "$Infra_Services"
fi
yes you can do if statements in a Jenkinsfile. However if you are using declarative pipeline you need to brace it with the step script.
Your issue comes from the fact you did not put any double quotes around "abc" and all the elements of your array
infra_services=[abc,def,xyz]
​
A second error will raise after you fix this. If infra_services is an array, to manipulate it you should not try to cast it as string. It should throw when you do "{$Infra_Services}"
here is a working example
​def Infra_Services = ["abc","def","xyz"]
if (Infra_Services.contains("xyz")) {
println "found"
}​​
My advice is to test your groovy before running it on jenkins, you will gain precious time. Here is a good online groovy console I use to test my code. running the groovy console from terminal is an alternative
https://groovyconsole.appspot.com/

Why Jenkins String parameter is null?

I have set one String parameter for Jenkins parametrized job
String: MOV
Default value: 5
But when I log output as echo: "${MOV}", that value is null.
I tried with single quotes, without any quotes, without dollar sign but every time my value is null.
Can anyone help me?
Try params.MOV:
echo "${params.MOV}"
https://jenkins.io/doc/book/pipeline/syntax/#parameters

Hyperledger Burrow: "could not create Burrow kernel: info.Moniker must be valid non-empty ASCII text without tabs, but got"

Hello fellow bugseekers,
I am trying to run a hyperledger burrow blockchain on a v-server.
Installation and setup went just fine, but every time I try to start the chain (burrow start --validator-address=50B1A9AB9B35B9E9565F4B881018380566702562) I get this Error:
could not create Burrow kernel: info.Moniker must be valid non-empty ASCII text without tabs, but got
It seems as tho the log is not complete, but there is nothing after "got", so I assume the info.Moiker is empty. Googeling didn't help. I would appreciate any input.
Thank you for your time in advance.
I had the same problem. info.Moniker is just a string value that represents a human readable name. This is related to the Tendermint consensus, which is used by the Hyperledger Burrow.
You can edit burrow.toml file and replace
Moniker = ""
with the following -
Moniker = "SomeName"
You can find a sample tendermint toml file HERE
BTW, this worked for me.

Jenkins pipeline jiraLinkIssues

I try to integrate jenkins and Jira throught pipeline script. I try to create connection between two jira issues
1)my script (tasks INL-6613 and INL-6614 have already created) :
jiraLinkIssues type: 'предыдущая', inwardKey: 'INL-6613', outwardKey: 'INL-6614', site: 'TEST_JIRA'
just like into this documentation (https://jenkinsci.github.io/jira-steps-plugin/steps/issuelink/jira_link_issues/)
2)Also I configured site: 'TEST_JIRA' and it working 100%
3)I can't create link such as into documentation because I haven't use ordinary types :
4)But I have this problem :
{"errorMessages":["Не найдено ни одного типа связи запроса с именем 'предыдущая'."],"errors":{}}
({"errorMessages":["Not found any type of link query named 'предыдущая'."], "errors":{}})
Help me please fix it
Have you tried?
URL encode, change "предыдушая" on "%D0%BF%D1%80%D0%B5%D0%B4%D1%8B%D0%B4%D1%83%D1%88%D0%B0%D1%8F"
use latin symbols instead of cyrillic
I decided this problem with using " jiraGetIssueLinkTypes " -pipeline command, so I have seen that 'предыдущая' was just rename of 'link' type.

URLTrigger plugin. Need examples for TXT-RegEx or XML-XPath

So, I try to use plugin https://wiki.jenkins-ci.org/display/JENKINS/URLTrigger+Plugin.
I want to trigger my Jenkins job when the text "Last build (#40), 17 hr ago" in the response of provided URL is changed (build number will be different after each build).
So I made following configurations:
1. Build trigger: Set [URLTrigger] - Poll with a URL.
2. Specified URL to another Jenkins: http://mydomain:8080/job/MasterJobDoNothing/
3. Set Inspect URL content option
4. Set Monitor the contents of a TEXT response
5. Set following regular expression: ^Last build[.]*
6. Set Schedule every minute: * * * * *
7. Trigger the job on another Jenkins
Actual result: My job wasn't triggered.
Then I tried to deal with XML/XPath and specify
8. Set Monitor the contents of an XML response
9. Set XPath: //*[#id="side-panel"] (also tried with one "/")
Actual result: the same.
Tell me please what I'm doing wrong? Please provide examples of RegEx or XPath if possible.
Thanks, Dima
I managed to trigger reliably with regex setting.
The regex pattern matches each line of the input.
No need to use ^ or $. it always match line start to line end.
This plugin compares the contents of the matched lines. It triggers if different.
This plugin compares the count of the matched lines. It triggers if the count is different.
This plugin uses matches() method of java.util.regex.Matcher. So the regex pattern should conform to it. (it's fairly normal regex)
As for your example,
Last build.*
may work.
Refs:
Reference of regex patten:
http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html
Reference of Matcher: http://docs.oracle.com/javase/7/docs/api/java/util/regex/Matcher.html#matches()
The regex trigger source code:
github.com/jenkinsci/urltrigger-plugin/blame/master/src/main/java/org/jenkinsci/plugins/urltrigger/content/TEXTContentType.java
I'd recommend to use the "RSS for all" link as a trigger URL instead, and /feed/entry[1] as the XPath expression for the XML response content nature.
PS: I was using PathEnq to debug the XPath expression.

Resources