How to transfer artifacts built on Jenkins to Backlog

As mentioned in the previous post , I love open source and its communities as well as other nulab developers. I’m an active member of Japan Jenkins User Group and here I would  like to introduce the Jenkins Backlog plugin that I’m personally maintaining.

Introduction

With this plugin enabled on your Jenkins, an issue key notation ( like BLG-1234 ) found in commit messages will be automatically converted to a link to an issue on Backlog, or you can login to Jenkins by Backlog user and password. There are some more features of this plugin which you can refer to for more details on the plugin page.

In this post, I will share a way to transfer artifacts built on Jenkins to Backlog.

Use case – generating HTML files by Sphinx

The following figure is an example workflow that illustrates how you can get HTML files generated from source text files committed to Backlog’s repository without accessing Jenkins. In this example, documentation generator Sphinx runs on Jenkins to convert text to HTML.

The detailed steps are below:

  1. Commit files from a local machine
  2. Checkout / update the committed files on Jenkins
  3. Generate HTML files by Sphinx
  4. Transfer the generated files to Backlog file sharing
  5. Look at the transferred HTML files in a web browser

The steps  from 2 to 4 are automatically done by Jenkins and my plugin and as you can see in the figure, you don’t have to access Jenkins to get artifacts from Jenkins.

The benefit of this architecture is that you can keep your Jenkins running in a private environment even when sharing its artifacts.

It doesn’t really matter if you use SaaS like CloudBees or you run your Jenkins in public environment. In my experience, most Jenkins users run their Jenkins in private environment with restricted access. In such a case, it’s not easy to share artifacts from Jenkins with those who cannot access Jenkins. My plugin solves this problem and makes it easy to share artifacts from Jenkins with everyone on the project because they can access Backlog without special settings.

Configuration of Jenkins

First, input Backlog project URL, user ID and password.

  

Then, add an action named ‘Publish Files to Backlog’ in ‘Post-build Actions’ section. Since Jenkins provides detailed help, I will only add complementary information in red balloons to the following capture.

Policy of saving artifacts

There are two policies when saving artifacts:

  • Save only latest artifacts
  • Save all version’s artifacts

If you choose the former policy, you should enable ‘Delete Remote directory before publish’ to be sure that the artifacts are generated with the latest build. If you choose the latter, you should enable ‘Remote directory is a date format’. In addition, you should set a date format like ‘yyyyMMdd ‘ or an environmental variable provided by Jenkins ‘${ BUILD_NUMBER}’.

Result

Once you’ve configured the settings, you can then proceed to transfer artifacts. The result is as shown below. As build number and date format are set, directories with each build are created.

In the directory, there are HTML files generated by Sphinx. You view the HTML contents on your web browser.


In this post I have adopted HTML as the example artifacts. You can of course use this configuration for other artifacts such as Android applications. If you have a use case to share, or any feedback or request on my plugin, feel free to drop them in the comment section below. 

Enjoy Jenkins!

Try Backlog for 30 days.

Join 800,000 developers running on Backlog. No credit card required.

Try It Free