HTTP Request Not Sent

Issue #1 resolved
Adam Boltz created an issue

I may not be using this as intended -- I'll be the first to admit that I didn't follow the directions provided -- but it seems like something this tool should be able to do. The difference is that the instructions ask for me to use a user-specific API-token, but our Jenkins is set up such that all it needs to do is request a URL without authenticating. For example, I can navigate to this URL in my browser and it triggers a build.

So I put this URL in the URL field of this plug-in's config, left Use Authentication unchecked, and Username/Password blank. But when I make commits, nothing happens -- no build kicked off and nothing in the Stash logs. I tried dropping the http:// from the URL and it did produce an error: catalina.out:656:java.net.MalformedURLException: no protocol: 1.2.3.4/rest/of/path. So, it does appear to be trying then -- there's just no trace of an attempt when I include the http://.

Is this usage not supported or is there something I might try?

Comments (6)

  1. Alexander Renteln
    • changed status to open

    Hi Adam,

    your intended usage should work fine. Here is the snipet from the code:

    if ( use_auth == true ) {
                        // build the auth string
                        String authString = user + ":" + pass;
                        String authStringEnc = new String(Base64.encodeBase64(authString.getBytes()));
                        connection.setRequestProperty("Authorization", "Basic " + authStringEnc);
                                    }
    

    So I am just adding the basic auth to the http header if the authentication option is checked.

    Never the less, I will look into it and will provide you with some more debug output (amoungst others the http response). That might help you.

    Not promissing anything but I think I will get to it tomorrow. :-)

    Cheers,

    Alex

  2. Alexander Renteln

    Hi Adam,

    I added some logging for you and also uploaded a new version of the plugin to the marketplace. Here you can see the commit with the changes.

    If errors occur they should go directly into the logfile. To enable more output, you have to adjust the log level in the file ./stash/webapp/WEB-INF/classes/logback.xml by adding the following:

    <!-- Turn on maximum logging for HttpGetPostReceiveHook plugin -->
    <logger name="de.aeffle.stash.plugin.hook.HttpGetPostReceiveHook" level="DEBUG"/>
    

    Hopefully this can help you fix your problem. (I also fixed a null pointer exception which had to do with autounboxing of a Boolean.)

    Let me know how it goes,

    Alex

  3. Log in to comment