Robin Shen
2 min readMar 18, 2021

Live Preview your App in OneDev Pull Request

OneDev is a self-hosted DevOps platform with issue tracking, git repository management and built-in CI/CD capabilities. In the latest 4.2.1 version, it is possible to set up pull request to launch live preview of your application and tear it down after pull request is closed.

For demonstration purpose, I set up a Heroku starter application in OneDev, when a pull request is created, the application will be deployed to Heroku, and a link of the deployment will be displayed for reviewers to check like below:

When there are new commits made into the pull request, the application will be re-deployed to reflect current change. After pull request is merged or discarded, the deployment will be removed from Heroku to save resource.

Now let’s check how to achieve this:

  1. Check build job Set Up Live Preview, the deploy step deploys current commit of the application to Heroku, and generates a markdown file containing deployed application link. This file then gets published via step publish pull request markdown report. The job is set to run automatically when pull request is opened or updated via job triggers.
  2. Check build job Tear Down Live Preview, the undeploy step deletes the deployed application if it exists. The job is set to run automatically when pull request is merged or discarded via job triggers.
  3. Navigate into menu Setting/Build Setting/Job Secrets of the project, define job secret named heroku_email to hold Heroku account email, and heroku_api_key to hold Heroku api key

That is it. Thanks for reading!

This tutorial contains image designed by freepik

Robin Shen
Robin Shen

Written by Robin Shen

DevOps enthusiast. OneDev maintainer.

No responses yet