DEV Community

Cover image for Live Preview your App in OneDev Pull Request

Live Preview your App in OneDev Pull Request

robinshine profile image Robin Shen ・2 min read

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:

Alt Text

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 Commands deploys current commit of the application to Heroku. The job is set to run automatically when pull request is opened or updated via job Triggers. And in Artifacts & Reports section, the markdown file containing deployed application link will be published as a pull request report

  2. Check build job Tear Down Live Preview, the Commands 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

Discussion (0)

Editor guide