README

JX

JX is a command line tool for installing and using Jenkins X.

CII Best Practices GoDoc Docs Docker Pulls Downloads GoReport Apache Reviewed by Hound Build Status Slack Status

Installing

Check out how to install jx.

Getting Started

Please check out the Getting Started Guide on how to:

Then what to do next when you have Jenkins X installed.

Welcome to the Jenkins X Community

We value respect and inclusiveness and follow the CDF Code of Conduct in all interactions.

We’d love to talk with you about Jenkins X and are happy to help if you have any questions.

Find out more about our bi-weekly office hours, where we discuss all things Jenkins X, and other events here.

Getting Help

To find out the available commands type:

jx

Or to get help on a specific command, say, create then type:

jx help create

You can also browse the jx command reference documentation.

Reference

Opening Consoles

To open a console for foo:

jx open foo

If you do not know the name:

jx open

Tail logs

To tail the logs of anything running on Kubernetes (jenkins or your own applications) type.

jx logs

Which prompts you for the deployment to log then tails the logs of the newest pod for an app.

You can filter the list of deployments via:

jx logs -f cheese

Then if there's only one deployment with a name that contains cheese then it'll tail the logs of the latest pod or will prompt you to choose the exact deployment to use.

Remote shells

You can open a remote shell inside any pods container via the rsh command:

jx rsh

Or to open a shell inside a pod named foo:

jx rsh foo

Pass -c to specify the container name. e.g. to open a shell in a maven build pod:

jx rsh -c maven maven

Importing or Creating apps

To import an application from the current directory:

jx import

Or to create a new Spring Boot application from scratch:

jx create spring

e.g. to create a new WebMVC and Spring Boot Actuator microservice try this:

jx create spring -d web -d actuator

Or to create a new project from scratch:

jx create project

Starting builds

To start a pipeline using a specific name try:

jx start pipeline myorg/myrepo

Or to pick the pipeline to start:

jx start pipeline

If you know part of the name of the pipeline to run you can filter the list via:

jx start pipeline -f thingy

You can start and tail the build log via:

jx start pipeline -t

Viewing Apps and Environments

To view environments for a team:

jx get env

To view the application versions across environments:

jx get version

Manual promotions

Typically we setup Environments to use automatic promotion so that the CI / CD pipelines will automatically promote versions through the available Environments using the CI / CD Pipeline.

However if you wish to manually promote a version to an environment you can use the following command:

jx promote myapp -e prod

Or if you wish to use a custom namespace:

jx promote myapp -n my-dummy-namespace

Switching Environments

The jx CLI tool uses the same Kubernetes cluster and namespace context as kubectl.

You can switch Environments via:

jx env

Or change it via:

jx env staging
jx env prod

To display the current environment without trying to change it:

jx env -b

To view all the environments type:

jx get env

You can create or edit environments too:

jx create env # Create an environment
jx edit env staging # Edit staging environment

You can switch namespaces in the same way via:

jx ns

or

jx ns awesome-staging

Switching Clusters

If you have multiple Kubernetes clusters then you can switch between them via:

jx ctx

Note that changing the namespace ,environment or cluster changes the current context for ALL shells!

Sub shells

So if you want to work temporarily with, say, the production cluster we highly recommend you use a sub shell for that.

jx shell my-prod-context

Or to pick the context to use for the sub shell:

jx shell

Then your bash prompt will be updated to reflect that you are in a different context and/or namespace. Any changes to the namespace, environment or context will be local to the current shell only!

Setting your prompt

You can use the jx prompt to configure your CLI prompt to display the current team and environment you are working within:

# Enable the prompt for bash
PS1="[\u@\h \W \$(jx prompt)]\$ "

# Enable the prompt for zsh
PROMPT='$(jx prompt)'$PROMPT

Note that the prompt is updated automatically for you via the jx shell command too.

Bash completion

On a Mac to enable bash completion try:

jx completion bash > ~/.jx/bash
source ~/.jx/bash

Or try:

source <(jx completion bash)

For more help try:

jx help completion bash

Addons

We are adding a number of addon capabilities to Jenkins X. To add or remove addons use the jx create addon or jx delete addon commands.

For example to add the Gitea Git server to your Jenkins X installation try:

jx create addon gitea

This will:

  • install the Gitea Helm chart.
  • add Gitea as a Git server (via the jx create git server gitea command).
  • create a new user in Gitea (via the jx create git user -n gitea command).
  • create a new Git API token in Gitea (via the jx create git token -n gitea -p password username command).

Troubleshooting

We have tried to collate common issues here with work arounds. If your issue isn't listed here please let us know.

Other issues

Please let us know and see if we can help? Good luck!

Contributing

We welcome your contributions.

If you're looking to build from source or get started hacking on jx, please see the CONTRIBUTING.MD or our Contributing Guide on the Jenkins X website.

Get more details at codescene.io.

Expand ▾ Collapse ▴

Directories

Path Synopsis
cmd/codegen
cmd/codegen/app
cmd/codegen/generator
cmd/codegen/util
cmd/ip
cmd/jx
cmd/jx/app
pkg/addon
pkg/applications
pkg/apps
pkg/auth
pkg/auth/mocks
pkg/boot
pkg/brew
pkg/buildnum Package buildnum contains stuff to do with generating build numbers.
pkg/buildnum/mocks
pkg/buildnum/mocks/matchers Code generated by pegomock.
pkg/buildpacks
pkg/builds
pkg/chats
pkg/cloud
pkg/cloud/aks
pkg/cloud/aks/storage
pkg/cloud/amazon
pkg/cloud/amazon/awscli
pkg/cloud/amazon/awscli/mocks
pkg/cloud/amazon/ec2
pkg/cloud/amazon/ec2/mocks
pkg/cloud/amazon/eks
pkg/cloud/amazon/eks/mocks
pkg/cloud/amazon/eksctl
pkg/cloud/amazon/eksctl/mocks
pkg/cloud/amazon/session
pkg/cloud/amazon/storage
pkg/cloud/amazon/testutils
pkg/cloud/amazon/vault
pkg/cloud/buckets
pkg/cloud/buckets/mocks
pkg/cloud/factory
pkg/cloud/gke
pkg/cloud/gke/externaldns
pkg/cloud/gke/mocks
pkg/cloud/gke/storage
pkg/cloud/gke/vault
pkg/cloud/iks
pkg/cloud/openshift
pkg/cluster
pkg/cluster/eks
pkg/cluster/factory
pkg/cluster/fake
pkg/cluster/gke
pkg/cmd
pkg/cmd/add
pkg/cmd/boot
pkg/cmd/clients
pkg/cmd/clients/fake
pkg/cmd/clients/mocks
pkg/cmd/compliance
pkg/cmd/config
pkg/cmd/controller
pkg/cmd/controller/pipeline
pkg/cmd/create
pkg/cmd/create/options
pkg/cmd/create/vault
pkg/cmd/deletecmd
pkg/cmd/deprecation
pkg/cmd/edit
pkg/cmd/edit/requirements
pkg/cmd/experimental
pkg/cmd/gc
pkg/cmd/get
pkg/cmd/get/vault
pkg/cmd/get/vault/config
pkg/cmd/helper
pkg/cmd/importcmd
pkg/cmd/importcmd/test_data/import_projects/jenkins-x-go
pkg/cmd/initcmd
pkg/cmd/namespace
pkg/cmd/opts
pkg/cmd/opts/step
pkg/cmd/opts/upgrade
pkg/cmd/preview
pkg/cmd/profile
pkg/cmd/promote
pkg/cmd/rsh
pkg/cmd/start
pkg/cmd/step
pkg/cmd/step/bdd
pkg/cmd/step/boot
pkg/cmd/step/buildpack
pkg/cmd/step/cluster
pkg/cmd/step/create
pkg/cmd/step/create/helmfile
pkg/cmd/step/create/pr
pkg/cmd/step/e2e
pkg/cmd/step/env
pkg/cmd/step/expose
pkg/cmd/step/get
pkg/cmd/step/git
pkg/cmd/step/git/credentials
pkg/cmd/step/helm
pkg/cmd/step/post
pkg/cmd/step/pr
pkg/cmd/step/report
pkg/cmd/step/restore
pkg/cmd/step/scheduler
pkg/cmd/step/syntax
pkg/cmd/step/update
pkg/cmd/step/update/release
pkg/cmd/step/verify
pkg/cmd/stop
pkg/cmd/sync
pkg/cmd/templates
pkg/cmd/testhelpers
pkg/cmd/ui
pkg/cmd/uninstall
pkg/cmd/update
pkg/cmd/upgrade
pkg/cmd/version
pkg/collector
pkg/config +k8s:deepcopy-gen=package +k8s:openapi-gen=true Package v1 is the v1 version of the API.
pkg/cve
pkg/dependencymatrix
pkg/docker
pkg/draft
pkg/environments
pkg/errorutil
pkg/expose
pkg/extensions
pkg/features
pkg/flagger
pkg/github
pkg/gits
pkg/gits/credentialhelper
pkg/gits/features
pkg/gits/mocks
pkg/gits/mocks/matchers Code generated by pegomock.
pkg/gits/operations
pkg/gits/releases
pkg/gits/testhelpers
pkg/health
pkg/helm
pkg/helm/mocks
pkg/helmfile
pkg/io
pkg/io/secrets
pkg/issues
pkg/jenkins
pkg/jenkins/fake
pkg/jenkinsfile +k8s:deepcopy-gen=package +k8s:openapi-gen=true Package v1 is the v1 version of the API.
pkg/jenkinsfile/gitresolver
pkg/jxfactory
pkg/jxfactory/connector
pkg/jxfactory/connector/gcp
pkg/jxfactory/connector/provider
pkg/jxfactory/mocks
pkg/kserving
pkg/ksync
pkg/kube
pkg/kube/cluster
pkg/kube/mocks
pkg/kube/mocks/matchers Code generated by pegomock.
pkg/kube/naming
pkg/kube/pki
pkg/kube/resources
pkg/kube/resources/mocks
pkg/kube/serviceaccount
pkg/kube/services
pkg/kube/test_integration
pkg/kube/vault
pkg/kube/velero
pkg/kustomize
pkg/logs
pkg/maven
pkg/nodes
pkg/packages
pkg/pipeline_events
pkg/pipelinescheduler
pkg/pipelinescheduler/testhelpers
pkg/platform
pkg/prow
pkg/prow/config
pkg/quickstarts
pkg/reportingtools
pkg/reportingtools/mocks
pkg/reports
pkg/secreturl
pkg/secreturl/fakevault
pkg/secreturl/localvault
pkg/secreturl/mocks
pkg/semrel
pkg/spring
pkg/surveyutils
pkg/table
pkg/tekton
pkg/tekton/metapipeline
pkg/tekton/syntax +k8s:deepcopy-gen=package +k8s:openapi-gen=true Package v1 is the v1 version of the API.
pkg/tekton/syntax/syntax_helpers_test
pkg/tekton/tekton_helpers_test
pkg/testkube
pkg/tests
pkg/users
pkg/util
pkg/util/json
pkg/util/mocks
pkg/util/secrets
pkg/util/system
pkg/util/trace
pkg/vault
pkg/vault/create
pkg/vault/fake
pkg/vault/mocks
pkg/vault/mocks/matchers Code generated by pegomock.
pkg/version
pkg/versionstream
pkg/versionstream/mocks
pkg/versionstream/versionstreamrepo
pkg/workflow