Hello,
I'm working on a plugin that archives multiple artifacts (directories of
html and content) on each build. I have this part working without any big
problems.
However, I'm struggling a bit with the code to expose these artifacts in
the Jenkins UI. What I want to do is to use DirectoryBrowserSupport to
render the artifact html, and this works fine when I do it from a static
URL path that is appended on to my Action's URL; e.g.: /myplugin/artifact.
The problem is that, since I have multiple artifacts per build, the URL
needs to contain an extra token to identify which artifact we're retrieving:
/myplugin/artifacts/ARTIFACT_ID
I've implemented a "doArtifacts" method that can successfully map these
kinds of request to the appropriate paths for the artifacts on disk, but
when I try to use DirectoryBrowserSupport in this context, it breaks
because the extra token "ARTIFACT_ID" is still included in the value of
"request.getRestOfPath()", so DirectoryBrowserSupport is looking for paths
that begin with that prefix inside of the directory I've specified on disk,
and those paths don't exist.
I'm working around this for now with some gross code that looks like this:
RequestImpl reqImpl = (RequestImpl)request;
reqImpl.tokens.next();
Which allows me to advance the token index inside of the request object
before I construct my DirectoryBrowserSupport. This works perfectly, but
I'm obviously stepping outside of the bounds of the supported API here and
worry that it could break in a future release.
Anyone have any suggestions on a cleaner way to solve this? Pointer to
relevant source code in an existing plugin would be just fine too!
Thanks!
Chris
--
You received this message because you are subscribed to the Google Groups
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.