Trouble with SVN post-commit and Jenkins

后端 未结 5 745
盖世英雄少女心
盖世英雄少女心 2021-01-05 06:07

I am trying to get CI going with Jenkins. To date, we have been performing two scheduled builds in our environment, but our dev staff wants to get CI working. I have follo

相关标签:
5条回答
  • 2021-01-05 06:29

    Please take a look at your URL. Since Jenkins is a web application running in a servlet container the following one must work:

    http(s)://server_name:server_port/application_name/subversion/${UUID}/notifyCommit?rev=$REV"

    The idea is to pass

    "subversion/${UUID}/notifyCommit?rev=$REV"

    to the right place.

    0 讨论(0)
  • 2021-01-05 06:34

    Did you check if you have SELinux enabled?

    I had the same problem and wrote a solution here https://stackoverflow.com/a/15408506/2169568

    The error I was getting was that it could not connect to the url (but when invoking it from commandline it did work).

    0 讨论(0)
  • 2021-01-05 06:36

    I have never liked how the SVN Plugin page is written. It is to easy to read it to say that you need to set up a Post Commit Hook in SVN to make things work. You Don't!

    We have about 10 builds on our Jenkins box. All of them are linked to SVN repositories, and all a triggered by changes in the SVN repository. None of them rely on having to use a Post Commit Hook in SVN.

    To do this, we have configured the builds to simply "Poll SCM" on a schedule. The "commit" builds use a schedule of "*/5 * * * *". This polls every 5 minutes. Our "daily" builds use a schedule of "1 1 * * *" so that the builds would kick off at 1:01 AM if there are any changes.

    0 讨论(0)
  • 2021-01-05 06:37

    Try increasing your timeout -- 2 seconds is like... Too low.

    This is what works for me:

    /usr/bin/wget --http-user=jenkins \
                  --http-passwd=passwordGoesHere \
                  --header "Content-Type:text/plain;charset=UTF-8" \
                  --post-data "`svnlook changed --revision $REV $REPOS`" \
                  --output-document "/var/log/svn/svn-notify-commit-post" \
                  --timeout=10 \
                  --read-timeout=10 \
                  --tries=2 \
                  "http://jenkins:8082/jenkins/subversion/${UUID}/notifyCommit?rev=$REV" \
                  >> /var/log/svn/svn-notify-commit-post.log 2>&1
    

    (Make sure you have a /var/log/svn directory owned by the proper user).

    Also, enable SCM polling and set a cron rule like */30 * * * *.

    0 讨论(0)
  • 2021-01-05 06:43

    In order to enable push mode in Jenkins, you should enable the Poll SCM build trigger in configuration page of your job. It tells Jenkins that it should build the job whenever SCM changes occur.

    Because you don't have to do any polling (you get the info from the hook) you can leave the field blank.

    0 讨论(0)
提交回复
热议问题