Test property doesn't exist so, according to the doc:
- https://jenkins.io/doc/pipeline/steps/git/#git-git
-- branch is a string therefore you need to quote it otherwise it seems 
it's recognised as a property 

You can also try with the* generic scm step*, explained also in the same 
page

Cheers

On Monday, 23 January 2017 17:37:01 UTC, Sharan Basappa wrote:
>
> Hi,
>
> I am trying to create pipeline script such that it only a certain branches 
> following a naming style are built.
> However, pipeline bails out when I use the wildcard.
>
> The code snippet is below:
>
> stage 'build'
>
> node {
>
> git url: 'git@hd1:testing', branch: test*
>
> sh "pwd"
>
> sh "cat simple.csh"
>
> sh "echo $PATH"
>
> sh "csh simple.csh"
>
> echo("end of pipeline")
>
> }
>
>
> I see the following output from the above script:
>
>
>
> Started by user User
>
>
> [Pipeline] stage (build)
>
>
> Using the ‘stage’ step without a block argument is deprecated
>
>
> Entering stage build
>
>
> Proceeding
>
>
> [Pipeline] node
>
>
> Running on master in /var/lib/jenkins/workspace/test_build_3
>
>
> [Pipeline] {
>
>
> [Pipeline] }
>
>
> [Pipeline] // node
>
>
> [Pipeline] End of Pipeline
>
>
> groovy.lang.MissingPropertyException: No such property: test for class: 
> WorkflowScript
>
>
>         at 
> org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:53)
>
>
>         at 
> org.codehaus.groovy.runtime.ScriptBytecodeAdapter.getProperty(ScriptBytecodeAdapter.java:458)
>
>
>         at 
> com.cloudbees.groovy.cps.sandbox.DefaultInvoker.getProperty(DefaultInvoker.java:33)
>
>
>         at 
> com.cloudbees.groovy.cps.impl.PropertyAccessBlock.rawGet(PropertyAccessBlock.java:20)
>
>
>         at WorkflowScript.run(WorkflowScript:6)
>
>
>         at ___cps.transform___(Native Method)
>
>
>         at 
> com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.get(PropertyishBlock.java:74)
>
>
>         at 
> com.cloudbees.groovy.cps.LValueBlock$GetAdapter.receive(LValueBlock.java:30)
>
>
>         at 
> com.cloudbees.groovy.cps.impl.PropertyishBlock$ContinuationImpl.fixName(PropertyishBlock.java:66)
>
>
>         at sun.reflect.GeneratedMethodAccessor725.invoke(Unknown Source)
>
>
>         at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>
>
>         at java.lang.reflect.Method.invoke(Method.java:606)
>
>
>         at 
> com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
>
>
>         at 
> com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21)
>
>
>         at com.cloudbees.groovy.cps.Next.step(Next.java:58)
>
>
>         at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:154)
>
>
>         at 
> org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:163)
>
>
>         at 
> org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:328)
>
>
>         at 
> org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$100(CpsThreadGroup.java:80)
>
>
>         at 
> org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:240)
>
>
>         at 
> org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:228)
>
>
>         at 
> org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:63)
>
>
>         at java.util.concurrent.FutureTask.run(FutureTask.java:262)
>
>
>         at 
> hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:112)
>
>
>         at 
> jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
>
>
>         at 
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
>
>
>         at java.util.concurrent.FutureTask.run(FutureTask.java:262)
>
>
>         at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>
>
>         at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>
>
>         at java.lang.Thread.run(Thread.java:744)
>
>
> Finished: FAILURE
>
>
> However, when I modify the script as follows:
>
>
> stage 'build'
>
>
> node {
>
> git url: 'git@hd1:testing', branch: test*
>
> sh "pwd"
>
> sh "cat simple.csh"
>
> sh "echo $PATH"
>
> sh "csh simple.csh"
>
> echo("end of pipeline")
>
> }
>
>
> the code executes properly and I get the following output:
>
> Started by user User
>
> [Pipeline] stage (build)
>
> Using the ‘stage’ step without a block argument is deprecated
>
> Entering stage build
>
> Proceeding
>
> [Pipeline] node
>
> Running on master in /var/lib/jenkins/workspace/test_build_3
>
> [Pipeline] {
>
> [Pipeline] git
>
>  > git rev-parse --is-inside-work-tree # timeout=10
>
> Fetching changes from the remote Git repository
>
>  > git config remote.origin.url git@hd1:testing # timeout=10
>
> Fetching upstream changes from git@hd1:testing
>
>  > git --version # timeout=10
>
>  > git fetch --tags --progress git@hd1:testing 
> +refs/heads/*:refs/remotes/origin/*
>
>  > git rev-parse refs/remotes/origin/test^{commit} # timeout=10
>
>  > git rev-parse refs/remotes/origin/origin/test^{commit} # timeout=10
>
> Checking out Revision 264dc398372cba41c026568bd764d2656ebfc511 
> (refs/remotes/origin/test)
>
>  > git config core.sparsecheckout # timeout=10
>
>  > git checkout -f 264dc398372cba41c026568bd764d2656ebfc511
>
>  > git branch -a -v --no-abbrev # timeout=10
>
>  > git branch -D test # timeout=10
>
>  > git checkout -b test 264dc398372cba41c026568bd764d2656ebfc511
>
>  > git rev-list 264dc398372cba41c026568bd764d2656ebfc511 # timeout=10
>
> [Pipeline] sh
>
> [test_build_3] Running shell script
>
> + pwd
>
> /var/lib/jenkins/workspace/test_build_3
>
> [Pipeline] sh
>
> [test_build_3] Running shell script
>
> + cat simple.csh
>
> #!/bin/csh
>
> echo "welcome to jenkins from test branch"
>
> [Pipeline] sh
>
> [test_build_3] Running shell script
>
> + echo /sbin:/usr/sbin:/bin:/usr/bin
>
> /sbin:/usr/sbin:/bin:/usr/bin
>
> [Pipeline] sh
>
> [test_build_3] Running shell script
>
> + csh simple.csh
>
> welcome to jenkins from test branch
>
> [Pipeline] echo
>
> end of pipeline
>
> [Pipeline] }
>
> [Pipeline] // node
>
> [Pipeline] End of Pipeline
>
> Finished: SUCCESS
>
>
> I need some help to figure this out why it fails when I try to use 
> wildcard.
>
> Note that, I also tried different ways of specifying the test branch - 
> "test*"
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/0e640162-9b35-4251-98ff-0b305f7d5126%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to