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*"
git url: 'git@hd1:testing', branch: "test*"
git url: 'git@hd1:testing', branch: test*
git url: 'git@hd1:testing', branch: 'test*'
In all the 3 cases, Jenkins exits with error. I looked into the log again and this is what I see:
Caused by: hudson.plugins.git.GitException: Command "git checkout -b test* 264dc398372cba41c026568bd764d2656ebfc511" returned status code 128:
stdout:
stderr: fatal: git checkout: we do not like 'test*' as a branch name.
You can’t use the simple git pipeline command if you want to be fancy
You should use the form where you can specify more options like configuring Git SCM:
checkout scm: [$class: 'GitSCM', branches: [[name: '*/test*']], userRemoteConfigs: [[url: 'git@hd1:testing']]]
--
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-use...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/41830d01-040f-477c-a0b3-4f8db4c3ae0d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
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-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/03968e1f-0b02-486d-85a8-a830c0b1509c%40googlegroups.com.
HI Sharan,
I sent this already:
You can’t use the simple git pipeline command if you want to be fancy
You should use the form where you can specify more options like configuring Git SCM:
checkout scm: [$class: 'GitSCM', branches: [[name: '*/test*']], userRemoteConfigs: [[url: 'git@hd1:testing']]]
From:
<jenkins...@googlegroups.com> on behalf of Sharan Basappa <sharan....@gmail.com>
Reply-To: "jenkins...@googlegroups.com" <jenkins...@googlegroups.com>
Date: Thursday, January 26, 2017 at 4:03 AM
To: Jenkins Users <jenkins...@googlegroups.com>
Subject: Re: Pipeline: wildcard for branch name
Hi David,
--
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/beb3ca75-1597-416c-99da-858d1880dd6d%40googlegroups.com.