Вопрос

Я настраиваю задание Jenkins для загрузки файлов из Subversion в SFTP. Опубликовать через SSH работает неплохо, но загружаетвсе файлы в каждой сборке.

Для некоторых проектов у нас есть тысячи файлов, и загрузка стоит более 1 часа, так что это не вариант.

Может ли кто-нибудь предложить способ загрузки только файлов, измененных в последней версии?

Это было полезно?

Решение

You can use Subversion Plugin to poll for SVN changes and run a job that does nothing in particular. Let's call it YourPollingJob. Then call Jenkins API via http like this:

http://[jenkins_server]/api/xml?depth=2&xpath=/hudson/job[name='YourPollingJob']/build[id='BUILD_ID']/changeSet

where BUILD_ID is the actual build id of the job you've just run (the usual format is something like 2012-02-21_16-15-49). Examine the result. Note that all the information about the files that have changed since the previous build is there - you just need to parse it out.

So now you can do the following: YourPollingJob will call another job - let's call it CopyJob - and pass to it its BUILD_ID as a parameter (via the Parameterized Trigger Plugin; make sure to call CopyJob as a post-build step, not as a build step). CopyJob will then query Jenkins via http (as above, the best way is to do it via wget), parse the results, and do the copy.

You can do it all in one job, but it's a bit more complicated and hard to debug.

Also, it is probably prudent to copy the whole repository once a day (nightly).

Другие советы

You could keep those files in a separate repository. It sounds like a distributed VCS like mercurial or git would be best for that in your case. You could either set it up in the workspace and add a build step to commit changed files and push the commit to the server where you want to publish it (which should work as long as you don't wipe out the workspace or build on several machines) or add additional steps to clone/pull the repo with the artifacts from the server you keep them on.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top