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.
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.
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.
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:
A developer makes a branch to their local cloned source repository to create a new feature:
git branch acme-feature1
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
The developer commits the files adding a comment about what has changed:
git commit -m "nifty new image added to the index file"
The developer runs
git pushto 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.
CloudBees Jenkins X Distribution creates a preview environment in the PR for the application changes and displays a link to evaluate the new feature:
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.
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:
The code is merged to the
masterbranch, and the release is pushed to staging/production or a release created and available from the GitHub staging environment in the
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.
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:
PULL REQUEST https://github.com/acmecorp/acmeproj/pull/7 NAMESPACE acme-acmecorp-acmeproj-pr-7 APPLICATION http://acmeproj.acme-acmecorp-acmeproj-pr-126.96.36.199.150.nip.io
If you have any questions or feedback on the CloudBees Jenkins X Distribution documentation, send them to firstname.lastname@example.org.