Using preview environments

CloudBees Jenkins X Distribution adds a unique tier in the typical software deployment scenario called the preview environment, where developers can demonstrate new or fixed functionality for their software projects prior to production deployment to end users.

The traditional software deployment environment

In software development terms, environments are integrated software and procedures that aid in the deployment of software. Typically, a development environment includes the tools needed for coding, testing, and deploying a software project. Most development environments are comprised of three tiers:

  • Development, where a software project is modified with new features or fixed for security or functional fixes. Code is stored in local or remote repositories managed by a revision control software, such as Git. This tier can also include a testing tier, but often the testing is integrated into both development and staging tiers prior to production.

  • Staging is a tier that approximates the typical environment that an end user might encounter when running a software project in its final deployment platform. Staging is typically used for testing beta or release-candidate software prior to final (or general availability) release, but can also be used for providing limited availability demos for prospective or existing end users who are keen on seeing the software project and its relevant features in usable form.

  • Production tier is the final tier where end users can interact with the software project in its final, usable form, with some confidence that the software and features they use has been tested by developers in the two previous tiers.

The preview environment

CloudBees Jenkins X Distribution allows users to test and validate changes to code in a specialized fourth tier called a preview environment, which is a temporary tier where quick testing, feedback and limited availability demos for a wider user base can be done before changes are merged to master for production deployment. This gives developers the ability to receive faster feedback for their changes.

When a preview environment is up and running CloudBees Jenkins X Distribution will submit a comment to a Pull Request with a link to a temporary build of the project so that development members or invited end users can demo the preview.

Using preview environments any pull request can have a preview version built and deployed, including libraries that feed into a downstream deployable application. This means development team members can perform code reviews, run unit or cross-functional behavior-driven development (BDD) tests, and grow consensus as to when a new feature can be deployed to production.

It is recommend to get early feedback on changes to applications before the changes are merged into production.

Generating a preview

In a typical CloudBees Jenkins X Distribution development scenario, users make changes to an application that has been imported or created via one of the various supported methods, such as Quickstarts, Build packs, Spring Boot applications.

When the developer makes the change to their branch, with the ultimate goal of merging those branch changes into the master branch for deployment to production, they save their changes from within their integrated development environment (IDE) and commit it to the source repository, such as GitHub. The process to generate a preview environment is typically like committing code in a traditional development environment:

  1. A developer makes a branch to their local cloned source repository to create a new feature:

    git branch acme-feature1
  2. The developer makes changes to the source code in their branch and adds the affected files to the commit queue:

    git add index.html server.js
  3. The developer commits the files adding a comment about what has changed:

    git commit -m "nifty new image added to the index file"
  4. The developer runs git push to send the code back to the remote repository and create a pull request:

    git push origin acme-feature1

    The program displays a link to a pull request. The developer can right-click and choose Open URL to see the GitHub page in their browser.

  5. CloudBees Jenkins X Distribution creates a preview environment in the PR for the application changes and displays a link to evaluate the new feature:

    Preview environment

  6. Meanwhile, the development bot created during the installation process sends a notification email to you as well as the designated repository approver that a PR is ready for review. During the approval process, the approver can click on the preview application with the code changes for testing and validation.

  7. When the approver confirms the code and functionality changes, they can approve the with a simple comment that merges the code changes back to the master branch and initiate a production build with the new feature:

  8. The code is merged to the master branch, and the release is pushed to staging/production or a release created and available from the GitHub staging environment in the Releases tab.

The preview environment is created whenever a change is made to the repository, allowing any relevant user to validate or evaluate features, bugfixes, or security hotfix.

Finding previews

Any previews available across all developers for a repository can be accessed by running jx get previews, which presents a table that shows the PR URL, the namespace associated with the PR, and the preview environment URL:




If you have any questions or feedback on the CloudBees Jenkins X Distribution documentation, send them to

Copyright © 2010-2020 CloudBees, Inc.Online version published by CloudBees, Inc. under the Creative Commons Attribution-ShareAlike 4.0 license.CloudBees and CloudBees DevOptics are registered trademarks and CloudBees Core, CloudBees Flow, CloudBees Flow Deploy, CloudBees Flow DevOps Insight, CloudBees Flow DevOps Foresight, CloudBees Flow Release, CloudBees Accelerator, CloudBees Accelerator ElectricInsight, CloudBees Accelerator Electric Make, CloudBees CodeShip, CloudBees Jenkins Enterprise, CloudBees Jenkins Platform, CloudBees Jenkins Operations Center, and DEV@cloud are trademarks of CloudBees, Inc. Most CloudBees products are commonly referred to by their short names — Accelerator, Automation Platform, Flow, Deploy, Foresight, Release, Insight, and eMake — throughout various types of CloudBees product-specific documentation. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Jenkins is a registered trademark of the non-profit Software in the Public Interest organization. Used with permission. See here for more info about the Jenkins project. The registered trademark Jenkins® is used pursuant to a sublicense from the Jenkins project and Software in the Public Interest, Inc. Read more at Apache, Apache Ant, Apache Maven, Ant and Maven are trademarks of The Apache Software Foundation. Used with permission. No endorsement by The Apache Software Foundation is implied by the use of these marks.Other names may be trademarks of their respective owners. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this content, and CloudBees was aware of a trademark claim, the designations have been printed in caps or initial caps. While every precaution has been taken in the preparation of this content, the publisher and authors assume no responsibility for errors or omissions, or for damages resulting from the use of the information contained herein.