publish over ssh: send only commit scripts

80 views
Skip to first unread message

Ismaila Baradji

unread,
Dec 16, 2015, 3:46:43 PM12/16/15
to Jenkins Users
Hi,
I am trying to configure my job to send only commit files.
I have tryed with run ssh and after publish over ssh but no one is not working.
any idea?

Baptiste Mathus

unread,
Dec 17, 2015, 7:19:42 AM12/17/15
to jenkins...@googlegroups.com
Hi,
What is "commit files"? Do you mean something like "the files that were touched by the last commit" ?

If so, then it should be pretty easy to introduce a shell step for example that would call something along


Then copy those files in a directory, and configure publish over ssh to push all the files of that dir.

My 2 cents.

Cheers

--
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/f1dbe378-8d59-40ff-985c-291a7f1af188%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Baptiste <Batmat> MATHUS - http://batmat.net
Sauvez un arbre,
Mangez un castor !

Ismaila Baradji

unread,
Dec 17, 2015, 2:09:20 PM12/17/15
to Jenkins Users, m...@batmat.net
hi Batmat,
thanks for your help.
I create a shell execute commande and add: $ git diff-tree --no-commit-id --name-only -r GIT_COMMIT

but how to copy theses files and how to put in the publish over ssh parameters such as Source files, Remove prefix ?
I read the documentation https://wiki.jenkins-ci.org/display/JENKINS/Publish+Over+SSH+Plugin, but I don't know how to do?

thanks

Baptiste Mathus

unread,
Dec 17, 2015, 5:14:40 PM12/17/15
to jenkins...@googlegroups.com
How about something like:

rm -rf transitdir
mkdir transitdir
cp $(git diff-tree --no-commit-id --name-only -r HEAD) transitdir

Then configure publish over ssh to copy every files of that "transitdir" directory.

Does that help?

Ismaila Baradji

unread,
Dec 18, 2015, 10:02:38 AM12/18/15
to Jenkins Users, m...@batmat.net
Hi, thanks very much, this help me a lot,
but it works only if there are no delete files between the commit files.
this is my jenkins log

rm -rf target_dir
+ mkdir target_dir
+ git diff-tree --no-commit-id --name-only -r HEAD
+ cp -r --parents puro/error_log puro/tmp/test/tes2/testfile.php target_dir
cp: cannot stat `puro/error_log': No such file or directory
Build step 'Execute shell' marked build as failure
SSH: Current build result is [FAILURE], not going to run.
Finished: FAILURE

-----------
when I displayed the delete files, I have
jenkins@vm-dev01:~/workspace/pmc$ git diff-tree --no-commit-id --name-status --diff-filter=D -r HEAD
D puro/error_log

and to push only added or modified files, I can do
rm -rf target_dir
mkdir target_dir
cp -r --parents $(git diff-tree --no-commit-id --name-status --diff-filter=ACMRTUXB -r $GIT_COMMIT) target_dir

but for the deleted files, I don't know how to do.
do you have any solution to delete files in the remote directory ?


Baptiste Mathus

unread,
Dec 18, 2015, 10:11:30 AM12/18/15
to jenkins...@googlegroups.com
Try with 
cp $(git diff-tree --no-commit-id --name-only --diff-filter=ACMRTU -r HEAD) transitdir

See also 
$ git help diff-tree
Reply all
Reply to author
Forward
0 new messages