This week's book giveaways are in the Cloud and AI/ML forums.
We're giving away four copies each of Cloud Native Patterns and Natural Language Processing and have the authors on-line!
See this thread and this one for details.
Win a copy of Cloud Native PatternsE this week in the Cloud forum
or Natural Language Processing in the AI/ML forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

How to configure Jenkins to let it work with SVN, so that directory's/file's are checked out?

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

This year feb. I started working with Jenkins.  Now I want to deploy new versions from SVN.

I understand there two ways:
  • Push: initiative is at the side of SVN.
  • Pull: initiative is at Jenkins side by polling.


  • On this moment I prefer the Push method, but...


    Structure in SVN is:
    > Implementation
      > Data
         > Tool
            > tags
               >Toolname-<version number> #Location 1: This is a directory and for every new version a directory will be added with files.
                 > all kind of files

         > Tool
            > tags
               >Toolname-<version number> #Location 2: This is a directory and for every new version a directory will be added with files.
                 > all kind of files



    1. Push Method:
    I have found that at the SVN post-commit hook (at the repository/hook) has to be created like:


    This is the 'simple' script version. There is also a 'Robust' version but to explain how does this work it make no difference if we look to the simple version or the robust version I think

    I think at the Jenkins side I have to do:
    1. I have to create a freestyle job with "Source Code Management" see my screenshot "2019-05-03 08_20_36-Jenkins_job SVN.png"
    2. And do I have to create a "Remote Build trigger" see my screenshot "2019-05-03 08_28_06-Jenkins Build trigger.png"

    But my question are:
    1. What makes the connection between SVN and Jenkins?
       - I understand if something is committed were does that script point to the instance of Jenkins? At which part is the connection declared?
       - And were does that script make a kind of connection with that specific job? or is that ${UUID}
       - And my idea is that pos-commit hook need to placed at the location of the repository were we are interested in. This means that if somenthing in SVN is commited, but that has nothing todo were we are not interested, the script will not be executed. Or does it work different?
    2. What will trigger the Job? must I create a trigger "Trigger builds remotely"? If so, can I create any kind of token string? like my name? If I need this than I think I need also to fill that token at the SVN side or...?
    3. And do I have to create for every SVN location a new Job and than also for every SVN location a post-commit hook script? I think so, but I'm not sure


    2. Pull by Polling Method:
    First thing to is not difficult, create a "Poll scm schedule" for the Crontab.
    But than? What todo next?

    My questions about polling are:
    1. Now I have connection between Jenkins and SVN. I have the Cronjob running.
       - But how do I know if there is a new version?
       - How do I know which is the new version? Which directory is new and do I have to pick up from SVN
       - And what does it trigger the job? I mean ok, If I have found with Jenkins the latest version to check-out, what made that the job is triggered and the build is started and the directory's/files's are checked out?


    Or does any know a good tutorial were all this is explained? I have googled a lot and bought three books, I can't find the answers on these questions. I hope that someone can help me out with this or point me in direction so that I can solve it by myself.

    Thanks in advance.

    With regards,

    Nico
    2019-05-03-08_20_36-Jenkins_job-SVN.png
    [Thumbnail for 2019-05-03-08_20_36-Jenkins_job-SVN.png]
    2019-05-03-08_28_06-Jenkins-Build-trigger.png
    [Thumbnail for 2019-05-03-08_28_06-Jenkins-Build-trigger.png]
     
    Bartender
    Posts: 20924
    127
    Android Eclipse IDE Tomcat Server Redhat Java Linux
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    No need to scream!

    It would be more time than I can spare to get into all the details, but basically Jenkins is a lot like a webapp server. Actually, I think that it's literally a webapp with embedded Tomcat, but I haven't checked lately. So when Jenkins does a build, it normally runs the build script as a sub-process of Jenkins itself on the Jenkins machine. As for how it talks to version control systems like Subversion, it's because there's svn client software integrated into the Jenkins app. Also git, cvs, and quite a few others.

    Essentially, what you can do is setup a svn commit hook that sends a signal to Jenkins to kick off a build. Jenkins will then (given the right build setup) pull the freshly-committed code and run the build.

    Jenkins is very capable, but it's not intended to be the Ultimate Build System all by itself. So complex builds are generally done using a stand-alone builder like Maven or gradle, and in cases like that, the code pull is often part of the Maven/gradle build process rather than being done directly by Jenkins. They, too have VCS clients in them.
     
    Nico van de Kamp
    Greenhorn
    Posts: 3
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Hello Tim,

    Thanks for you're answer. I like to give info so that others know what I'm doing and mark my questions with red. But ok, maybe it is to much.

    Friday late I understand the clue or let say I think I know for now the clue. It is the last line in my code example:


    On most google site's what I found is this line not declared or explained! I was not aware what this was doing or the what the meaning of this line is. But in other example or a book what I have bought, I found this:


    So this line is I think doing were I was searching and looking for. Than I understand more or less how it can work.

    What still not understand is with POLLING, how do I know at Jenkins side, what is new commited in SVN and do I have to check out?

    With regards,

    Nico
     
    Tim Holloway
    Bartender
    Posts: 20924
    127
    Android Eclipse IDE Tomcat Server Redhat Java Linux
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Really, all the loud type is overkill. We can read the questions, even if it sometimes takes a few tries to get all the details right.

    Look here: https://dzone.com/articles/polling-subversion-jenkins

    And here: https://wiki.jenkins.io/display/JENKINS/Subversion+Plugin
     
    Don't get me started about those stupid light bulbs.
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!