Creating quickstarts for CloudBees Jenkins X Distribution
CloudBees Jenkins X Distribution allows users to create applications using pre-configured templates in their preferred programming language without the need to implement every setting and parameter themselves.
Users can create new applications from a supported list of CloudBees Jenkins X Distribution quickstart
applications via the jx create quickstart
command.
$ jx create quickstart
The jx create quickstart
process
The interactive command-line interface (CLI) guides the user through the creation of a sample application quickstart supported by CloudBees Jenkins X Distribution.
-
The CLI asks if you want to use your github user (if available) to create your quickstart git repository.
-
The CLI asks for an organization to use to create the quickstart, which you can choose from the list available.
-
The CLI asks for a project name for your quickstart application.
-
The CLI lists a number of quickstarts for you to choose from. For CloudBees Jenkins X Distribution, the following quickstarts are supported:
-
golang-http
- A simple HTTP application written in Go. -
jenkins-cwp-quickstart
- A quickstart for creating custom web application archive (WAR) applications. -
jenkins-quickstart
- A quickstart for creating customer Docker images, useful for customizing the list of plugins to install by default in the image. -
node-http
- an HTTP service written with Node.js runtime environment. -
node-http-watch-pipeline-activity
- A Node.js HTTP service that logs thePipelineActivities
custom resource definition, which stores pipeline stages for GitOps promotion. -
spring-boot-http-gradle
- A RESTful web service quickstart with a Spring Boot Actuator using Gradle, a build automation tool. -
spring-boot-rest-prometheus
- A quickstart with a Spring Boot REST application designed to report Kubernetes metrics to the Prometheus monitoring tool. -
spring-boot-rest-prometheus
- A quickstart with a Java 11 compatible Spring Boot REST application designed to report Kubernetes metrics to the Prometheus monitoring tool. -
spring-boot-watch-pipeline-activity
- A Spring Boot HTTP service that logs thePipelineActivities
custom resource definition, which stores pipeline stages for GitOps promotion.
-
The quickstart
creation process
Once you have created and configured your quickstart, the remaining development environment is automatically created:
-
Creates a new application from the quickstart in a sub directory
-
Adds your source code into a
git
repository -
Creates a remote
git
repository on a service such as GitHub -
Pushes your code to the remote
git
service -
Adds default configuration files for building your application:
-
Dockerfile
to incorporate your application into a docker image on Kubernetes. -
jenkins-x.yml
to define the Jenkins X Pipeline and the CI/CD process for your application. -
A Helm chart to create the resources for running your application inside Kubernetes.
-
-
Registers a webhook on the remote
git
repository to your team’s Jenkins environment -
Adds the git repository to your teams Jenkins environment
-
Triggers the first pipeline
How do quickstarts work?
The source of these quickstarts is maintained in the jenkins-quickstarts GitHub organization.
When you create a quickstart the program finds the Jenkins X build packs to match the right pack for your project using the source code language and picks the most suitable match.
When you use jx create
, jx install
or jx init
the
Jenkins X build
packs are cloned into your ~/.jx/draft/packs
directory.
Depending on your CloudBees Jenkins X Distribution installation type (Serverless Jenkins vs. Static Master Jenkins), you can view all the languages supported via build packs on your machine using the following commands:
For Serverless Jenkins:
ls -al ~/.jx/draft/packs/github.com/jenkins-x-buildpacks/jenkins-x-kubernetes/packs
For Static Master Jenkins:
ls -al ~/.jx/draft/packs/github.com/jenkins-x-buildpacks/jenkins-x-classic/packs
Then when you create a quickstart, or use either jx create spring
or jx import
, the
Jenkins X build
packs perform various checks and downloads appropriate development files:
-
Find the right language pack from the current supported list.
-
The language pack is then used to create default files if they don’t already exist:
-
Dockerfile
to package the application as a docker image -
jenkins-x.yml
to define the Jenkins X Pipeline and the CI/CD process for your application. -
Helm Charts to deploy the application on Kubernetes and to implement a preview environment to ease validation and code review.
-
Customizing a quickstart
You can configure at a team level the quickstarts which are presented to you in
the jx create quickstart
command. These settings are stored in the
Environment Custom Resource in Kubernetes.
To add the location of a set of quickstarts you can use the
jx create quickstartlocation
or the abbreviated jx create qsloc
command:
$ jx create quickstartlocation --url https://gitserver.example.com --owner my-quickstarts
If you omit the --url
argument the command assumes a
GitHub repository. Note that both public and private
repositories are supported.
You can have your own shared private quickstarts to reuse within your organization.
You can also specify --includes
or --excludes
patterns to filter the names
of the repositories where matches anything and
foo
matches anything
starting with foo
. For example, you could include the languages and technologies
your organization supports and exclude anything else.
You can then view the current quickstart locations for your team via the
jx get quickstartlocations
(or jx get qsloc
) command:
$ jx get quickstartlocations
You can delete a Git organization using the jx delete quickstartlocation
command.
If you have any questions or feedback on the CloudBees Jenkins X Distribution documentation, send them to jx-feedback@cloudbees.com.