Merge lp://qastaging/~dooferlad/linaro-android-frontend/proxy_lava-job-info into lp://qastaging/linaro-android-frontend

Proposed by James Tunnicliffe
Status: Merged
Approved by: Paul Sokolovsky
Approved revision: 246
Merged at revision: 241
Proposed branch: lp://qastaging/~dooferlad/linaro-android-frontend/proxy_lava-job-info
Merge into: lp://qastaging/linaro-android-frontend
Diff against target: 124 lines (+74/-13)
3 files modified
android_build/frontend/api.py (+29/-0)
android_build/urls.py (+1/-0)
static/buildDetails.js (+44/-13)
To merge this branch: bzr merge lp://qastaging/~dooferlad/linaro-android-frontend/proxy_lava-job-info
Reviewer Review Type Date Requested Status
Paul Sokolovsky Approve
Review via email: mp+87971@code.qastaging.launchpad.net

Description of the change

Adds a proxy for lava-job-info files for the front end so results files will be loaded and parsed without being blocked by the license request web page.

django: Added proxy to the API. Checks to see if file is called lava-job-info so it can't just be used to proxy anything. Possibly should tie down a list of acceptable server names as well at some point.

JavaScript: Added a new URL to try to download lava-job-info from and push all requests through above proxy.

To post a comment you must log in.
Revision history for this message
James Tunnicliffe (dooferlad) wrote :

Updated: Rev 245 locks down the proxy so only snapshots.linaro.org will be proxied, and only lava-job-info files on it. Front end understands this and will only use the proxy to access snapshots.linaro.org.

245. By James Tunnicliffe

Locked down proxy so only snapshot.linaro.org is proxied. Front end will only use proxy for URLs with snapshots.linaro.org within them.

Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

I don't understand all the new_style_url/old_style_url gyrations. In particular, it sure looks as if both could go via the proxy, in which case both will succeed at the http level (/api/get-lava-job-info always returns http 200) and then its a race as to which response gets displayed.

The other bits look fine.

246. By James Tunnicliffe

Removed unncessarey mangling of old_style_url.
Protect against having two calls to receivedLavaJobInfo that contain parsable data.

Revision history for this message
James Tunnicliffe (dooferlad) wrote :

On 9 January 2012 22:24, Michael Hudson-Doyle
<email address hidden> wrote:
> I don't understand all the new_style_url/old_style_url gyrations.  In
> particular, it sure looks as if both could go via the proxy, in which
> case both will succeed at the http level (/api/get-lava-job-info always
> returns http 200) and then its a race as to which response gets displayed.

I did have both go via the proxy at one point, but it does leave the
proxy open to anyone wanting to proxy a file that they can call
lava-job-info. It seemed like restricting the domain to be proxied to
snapshots.linaro.org was reasonable.

I have got rid of the code that makes old_style_url always absolute,
since it has gone back to a non-proxied Y.io call.

The reason for there being two URLs and there being no protection
about which gets loaded is that old_style_url will only match jobs
that have jenkins native archiving enabled and my understanding is
that those jobs will be going away shortly and don't account for any
jobs with artefacts published to snapshots.linaro.org.

It is simple enough to stop receivedLavaJobInfo from modifying the
page twice if you think it is worth protecting against. I have checked
in this change to do so:

    function receivedLavaJobInfo (e, response) {
        if (response.response.match(/^Server error: 404$/))
        {
            return; // Nothing to parse
        }

        if (typeof receivedLavaJobInfo.got_info != "undefined")
        {
            alert("Two resutls files found. Please report this error
by submitting a bug report against" +
                  "
https://code.launchpad.net/~linaro-infrastructure/linaro-android-frontend/trunk")
            return;
        }

        receivedLavaJobInfo.got_info = true;

I don't think there is a right location to get lava-job-info from if
it is in more than one location, so this should be sufficient. I added
an alert because it would be nice to know if getting two files ever
happens.

--
James Tunnicliffe

Revision history for this message
Paul Sokolovsky (pfalcon) wrote :

Ok, looks good for v1.0. I'm sure we'd need more tweaks to it, but let's proceed with integration so we know we do the right tweaks.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches