2

How to get a direct short URL for the jenkins build output file.

My last successful build is located at this path.

https://jenkins.domain.com/job/Org_repo_folder/job/project/job/release/build_number/artifact/ApplicationModule/build/outputs/apk/release/AppName_version.apk

How do I access the file with a short URL or path?

Use case:

  1. Long url exposes the build path.
  2. Emails with long urls ends at spam folder.
  3. Build sharing with simple URLs
Arun Jose
  • 1,857
  • 1
  • 15
  • 24

1 Answers1

1

If you're looking for a Jenkins-internal solution, then you could use the userContent feature.

E.g., Jenkins serves data under $JENKINS_HOME/userContent/file.apk under the URL $JENKINS_URL/userContent/file.apk.

If you copy (or symlink) the data that you want to provide to $JENKINS_HOME/userContent/, then you can use the userContent URL as a short URL for that.

Alex O
  • 7,746
  • 2
  • 25
  • 38
  • Hello Alex, not internal. But to send the build (apk) as url. Right now, the latest release path as url is very long and the mail end up as spam. – Arun Jose Apr 12 '22 at 21:06
  • So, as I suggested, the userContent solution can be used to provide a shorter URL. – Alex O Apr 13 '22 at 12:02
  • Hi Alex, I confirm the userContent works can be used to reduce the url length. What I did is, I copied the output apk to the userContent folder and referred that by url. But this results in file duplication. Also I'm cleaning up the older files. – Arun Jose Apr 15 '22 at 05:40
  • No other way to get direct reference but with a short URL ? Much appreciated. Else I'll mark this as the answer! – Arun Jose Apr 15 '22 at 05:41
  • If you use a symlink (e.g. to the `lastSuccessfulBuild` artifacts path), then you don't have to copy/update the data in `userContent`, and there's no duplication either. I'm not aware of other options for providing a short URL with Jenkins. – Alex O Apr 29 '22 at 06:13