Folks,

At this point, I am so confused.

My Jenkins file is kept at the root of Git directory. I am doing this in 
branches where I want to do Jenkins build.
I am using multibranch pipeline plug-in to define the build on Jenkins 
server.

As I am doing only mock set-up for now, the pipeline job is very simple and 
looks as follows. Can someone explain where I am going wrong?
The log below clearly reports that it is checking out test3 branch. So, I 
expect repository to be checked out correctly.

node {

stage 'build'

sh "pwd"

sh "ls ${workspace}@script"

sh "echo $PATH"

sh "cat  ${workspace}@script/simple.csh"

sh "csh  ${workspace}@script/simple.csh"

 

stage 'merge'

sh 'git stash'

sh 'git checkout master'

sh 'git merge test3'

sh 'git commit -am "Merged test3 branch to master"'

sh "git push origin master"

}

The script executes all the way till "git stash" and at this point, it 
reports error.
I have attached the entire log. 

Branch indexing
> git rev-parse --is-inside-work-tree # timeout=10
Setting origin to git@hd1:testing
> git config remote.origin.url git@hd1:testing # timeout=10
Fetching origin...
Fetching upstream changes from origin
> git --version # timeout=10
> git fetch --tags --progress origin +refs/heads/*:refs/remotes/origin/*
Seen branch in repository origin/master
Seen branch in repository origin/test
Seen branch in repository origin/test1
Seen branch in repository origin/test2
Seen branch in repository origin/test3
Seen branch in repository origin/test4
Seen branch in repository origin/testx
Seen 7 remote branches
> 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/*
Checking out Revision f5eabd27c25242cc35d0b597537c3a3bcec8f54f (test3)
> git config core.sparsecheckout # timeout=10
> git checkout -f f5eabd27c25242cc35d0b597537c3a3bcec8f54f
> git rev-list 18552ecf03f27679cb0d88f28c096d5c7ec33d99 # timeout=10
[Pipeline] node Running on master in 
/var/lib/jenkins/workspace/an_example_test3-26UQSYQ445FSBP4QRKEWLPQCJH545MLQVD6B552CIGPOXLZO4G5A
[Pipeline] { [Pipeline] stage (build) Using the ‘stage’ step without a 
block argument is deprecated
Entering stage build
Proceeding
[Pipeline] sh 
[an_example_test3-26UQSYQ445FSBP4QRKEWLPQCJH545MLQVD6B552CIGPOXLZO4G5A] 
Running shell script
+ pwd
/var/lib/jenkins/workspace/an_example_test3-26UQSYQ445FSBP4QRKEWLPQCJH545MLQVD6B552CIGPOXLZO4G5A
[Pipeline] sh 
[an_example_test3-26UQSYQ445FSBP4QRKEWLPQCJH545MLQVD6B552CIGPOXLZO4G5A] 
Running shell script
+ ls 
/var/lib/jenkins/workspace/an_example_test3-26UQSYQ445FSBP4QRKEWLPQCJH545MLQVD6B552CIGPOXLZO4G5A@script
avalon_asrts.sv
binding.sv
dir1
Jenkinsfile
Just_Checking
simple.csh
source.csh
tb_avalon_asrts.sv
[Pipeline] sh 
[an_example_test3-26UQSYQ445FSBP4QRKEWLPQCJH545MLQVD6B552CIGPOXLZO4G5A] 
Running shell script
+ echo /sbin:/usr/sbin:/bin:/usr/bin
/sbin:/usr/sbin:/bin:/usr/bin
[Pipeline] sh 
[an_example_test3-26UQSYQ445FSBP4QRKEWLPQCJH545MLQVD6B552CIGPOXLZO4G5A] 
Running shell script
+ cat 
/var/lib/jenkins/workspace/an_example_test3-26UQSYQ445FSBP4QRKEWLPQCJH545MLQVD6B552CIGPOXLZO4G5A@script/simple.csh
#!/bin/csh -f -e -x
echo "welcome to Jenkins from test2 branch"
\rm -f t
echo "junk" > t
exit 0
[Pipeline] sh 
[an_example_test3-26UQSYQ445FSBP4QRKEWLPQCJH545MLQVD6B552CIGPOXLZO4G5A] 
Running shell script
+ csh 
/var/lib/jenkins/workspace/an_example_test3-26UQSYQ445FSBP4QRKEWLPQCJH545MLQVD6B552CIGPOXLZO4G5A@script/simple.csh
welcome to Jenkins from test2 branch
[Pipeline] stage (merge) Using the ‘stage’ step without a block argument is 
deprecated
Entering stage merge
Proceeding
[Pipeline] sh 
[an_example_test3-26UQSYQ445FSBP4QRKEWLPQCJH545MLQVD6B552CIGPOXLZO4G5A] 
Running shell script
+ git stash
fatal: Not a git repository (or any of the parent directories): .git
[Pipeline] } [Pipeline] // node [Pipeline] End of Pipeline ERROR: script 
returned exit code 128
*Finished* <http://stacktrace.jenkins-ci.org/search?query=Finished>: FAILURE


On Tuesday, 7 February 2017 23:45:06 UTC+5:30, Sharan Basappa wrote:

> Hi All,
>
> I am having some trouble executing basic shell commands (highlighted in 
> red). I cant figure out the issue. Need some help. This is what I get:
>
> Branch indexing
>
> > git rev-parse --is-inside-work-tree # timeout=10
>
> Setting origin to git@hd1:testing
>
> > git config remote.origin.url git@hd1:testing # timeout=10
>
> Fetching origin...
>
> Fetching upstream changes from origin
>
> > git --version # timeout=10
>
> > git fetch --tags --progress origin +refs/heads/*:refs/remotes/origin/*
>
> Seen branch in repository origin/master
>
> Seen branch in repository origin/test
>
> Seen branch in repository origin/test1
>
> Seen branch in repository origin/testx
>
> Seen 4 remote branches
>
> > 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/*
>
> Checking out Revision eb966a50720c888113925000ad9179c79b1c187b (test1)
>
> > git config core.sparsecheckout # timeout=10
>
> > git checkout -f eb966a50720c888113925000ad9179c79b1c187b
>
> > git rev-list eb966a50720c888113925000ad9179c79b1c187b # timeout=10
>
> [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/an_example_test1-24PKZ6E7JM3ZFPAWUPX5ZXTQQLVB7HDDUSAFFRMP6IX3XZERQFTA
>
> [Pipeline] {
>
> [Pipeline] sh
>
> [an_example_test1-24PKZ6E7JM3ZFPAWUPX5ZXTQQLVB7HDDUSAFFRMP6IX3XZERQFTA] 
> Running shell script
>
> + pwd
>
>
> /var/lib/jenkins/workspace/an_example_test1-24PKZ6E7JM3ZFPAWUPX5ZXTQQLVB7HDDUSAFFRMP6IX3XZERQFTA
>
> [Pipeline] sh
>
> [an_example_test1-24PKZ6E7JM3ZFPAWUPX5ZXTQQLVB7HDDUSAFFRMP6IX3XZERQFTA] 
> Running shell script
>
> + cat simple.csh
>
> *cat: simple.csh: No such file or directory*
>
> [Pipeline] }
>
> [Pipeline] // node
>
> [Pipeline] End of Pipeline
>
> ERROR: script returned exit code 1
>
> Finished: FAILURE
>
>  
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/53e2ac27-56e2-489d-b091-fa9e1980e1bc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to