jx-preview
is a small command line tool for creating Preview Environments in Jenkins X
The jx preview create command will create a new Preview environment, by default in its own unique namespace called jx-$owner-$repo-pr-$number
using a helmfile located by default in the preview/helmfile.yaml
directory.
New projects created with Jenkins X 3.x already have the preview/helmfile.yaml
included. If your repository does not include this file it will be added into git in the Pull Request as an extra commit.
Creating a new preview environment creates a Preview custom resource for each Pull Request on each repository so that we can track the resources and cleanly remove them when you run jx preview destroy pr jx preview gc
For reference see the Preview.Spec documentation
If you are using Jenkins X 3.x then its already included by default so there's nothing to install.
If you are not using Jenkins X 3.x then you need to install the jx3/jx-preview
chart to:
- install the Preview custom resource used to track the Preview environments
- setups a
CronJob
to garbage collectPreview
environments when the Pull Requests have been closed or merged
To install the jx3/jx-preview
chart using helm 3.x try the following::
- Add jx3 helm charts repo
helm repo add jx3 https://storage.googleapis.com/jenkinsxio/charts
helm repo update
- Install (or upgrade)
# This will install jx-preview in the jx namespace (with a jx-preview release name)
helm upgrade --install jx-preview --namespace jx jx3/jx-preview
To uninstall the chart, simply delete the release.
# This will uninstall jx-preview in the jx-preview namespace (assuming a jx-preview release name)
# Helm v3
helm uninstall jx-preview --namespace jx
See the jx-preview command reference