How should the SVN webhook be called and with what parameters to trigger a build

mmiller's Avatar

mmiller

03 Feb, 2015 10:15 PM

I am trying to call the SVN webhook from Assembla to trigger a build on commit. How should it be called? I can't find any documentation on this.

Http Method - Should it be GET or POST (or something else)
Content Type - application/xml or application/json?
Content - what needs to be in the body to trigger the build

  1. Support Staff 1 Posted by Feodor Fitsner on 03 Feb, 2015 10:46 PM

    Feodor Fitsner's Avatar

    In general, it expects POST with the following application/json payload: https://gist.github.com/FeodorFitsner/575d8dd7722cf44908c5

    But I'm not sure if Assembla sends in this format. If they allow post receive server-side hooks you can build a script to push such payload. We have sample hooks for both Git and Mercurial, but not for Subversion: https://github.com/appveyor/webhooks

    Alternatively, you can just call webhook with POST and empty payload to trigger build of last commit.

  2. 2 Posted by mmiller on 03 Feb, 2015 10:58 PM

    mmiller's Avatar

    I tried calling the webhook with an empty post request and the result is a 500 error:

    POST https://ci.appveyor.com/api/subversion/webhook?id=mywebhook HTTP/1.1

    User-Agent: Fiddler

    Host: ci.appveyor.com

    Content-Length: 0

     

     

    HTTP/1.1 500 Internal Server Error

    Cache-Control: no-cache

    Pragma: no-cache

    Content-Type: application/json; charset=utf-8

    Expires: -1

    Server: Microsoft-IIS/8.5

    X-AspNet-Version: 4.0.30319

    X-Powered-By: ASP.NET

    Date: Tue, 03 Feb 2015 22:48:09 GMT

    Content-Length: 67

     

    {"message":"Object reference not set to an instance of an object."}

     

    I also tried with payload specified in your Github post and got a 500 error as well.

  3. Support Staff 3 Posted by Feodor Fitsner on 03 Feb, 2015 11:03 PM

    Feodor Fitsner's Avatar

    Remove Content-type: application/json when sending empty POST request.

  4. Support Staff 4 Posted by Feodor Fitsner on 03 Feb, 2015 11:05 PM

    Feodor Fitsner's Avatar

    In the second case it gives error because YAML in "config" field is invalid. Try sending this one:

    {
       "commit": {
          "id":"5",
          "author":{
             "name":"Author Name",
             "email":"[email blocked]"
          },
          "timestamp":"2015-01-15T21:08:38-08:00",
          "message":"commit message"
       },
       "repository":{
          "name":"repo_name",
          "url":"repo_url"
       },
       "config":null
    }
    
  5. 5 Posted by mmiller on 03 Feb, 2015 11:17 PM

    mmiller's Avatar

    I am not including a content type header – the raw request / response is below:

     

    POST https://ci.appveyor.com/api/subversion/webhook?id=lqrs7ig1bau940an HTTP/1.1

    Host: ci.appveyor.com

    Content-Length: 0

     

    --RESPONSE--

     

    HTTP/1.1 500 Internal Server Error

    Cache-Control: no-cache

    Pragma: no-cache

    Content-Type: application/json; charset=utf-8

    Expires: -1

    Server: Microsoft-IIS/8.5

    X-AspNet-Version: 4.0.30319

    X-Powered-By: ASP.NET

    Date: Tue, 03 Feb 2015 23:15:27 GMT

    Content-Length: 67

     

    {"message":"Object reference not set to an instance of an object."}

     

    I tried it with the JSON content you included – raw request / response below:

     

    POST https://ci.appveyor.com/api/subversion/webhook?id=myid HTTP/1.1

    Host: ci.appveyor.com

    Content-Length: 322

    Content-type: application/json

     

     

    {

       "commit": {

          "id":"5",

          "author":{

             "name":"Author Name",

             "email":"[email blocked]"

          },

          "timestamp":"2015-01-15T21:08:38-08:00",

          "message":"commit message"

       },

       "repository":{

          "name":"repo_name",

          "url":"repo_url"

       },

       "config":null

    }

     

    -- RESPONSE --

    HTTP/1.1 500 Internal Server Error

    Cache-Control: no-cache

    Pragma: no-cache

    Content-Type: application/json; charset=utf-8

    Expires: -1

    Server: Microsoft-IIS/8.5

    X-AspNet-Version: 4.0.30319

    X-Powered-By: ASP.NET

    Date: Tue, 03 Feb 2015 23:14:23 GMT

    Content-Length: 49

     

    {"message":"Build version 1.0.6 already exists."}

     

    I tried it with no content and content type header and the got the same thing:

     

    POST https://ci.appveyor.com/api/subversion/webhook?id=myid HTTP/1.1

    Host: ci.appveyor.com

    Content-Length: 2

    Content-type: application/json

     

    {}

     

    -- RESPONSE --

    HTTP/1.1 500 Internal Server Error

    Cache-Control: no-cache

    Pragma: no-cache

    Content-Type: application/json; charset=utf-8

    Expires: -1

    Server: Microsoft-IIS/8.5

    X-AspNet-Version: 4.0.30319

    X-Powered-By: ASP.NET

    Date: Tue, 03 Feb 2015 23:12:53 GMT

    Content-Length: 49

     

    {"message":"Build version 1.0.6 already exists."}

     

    Thanks for all the help and quick responses.

  6. 6 Posted by mmiller on 03 Feb, 2015 11:18 PM

    mmiller's Avatar

    Actually I think something else is wrong because I get the same error message when I try to build thru the console:

     

    Build version 1.0.6 already exists.

  7. 7 Posted by mmiller on 03 Feb, 2015 11:20 PM

    mmiller's Avatar

    Actually I see what happened – I saved the configuration during the middle of build. I think including the content type header and an empty json body works to trigger the build.

  8. Support Staff 8 Posted by Feodor Fitsner on 03 Feb, 2015 11:21 PM

    Feodor Fitsner's Avatar

    Right. Open "General" tab of project setting and increment build number.

    Must be racing condition glitch - will be working to fix that.

  9. Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 01:53 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

 

01 Oct, 2024 04:27 PM
26 Sep, 2024 03:49 PM
26 Sep, 2024 09:02 AM
25 Sep, 2024 07:07 PM
24 Sep, 2024 08:39 PM
24 Sep, 2024 06:47 AM