github.com/olli-ai/jx/v2@v2.0.400-0.20210921045218-14731b4dd448/README.md (about)

     1  # JX
     2  -	Website: https://jenkins-x.io/
     3  -   Slack channels (part of kubernetes workspace):
     4      -   [#jenkins-x-user](https://app.slack.com/client/T09NY5SBT/C9MBGQJRH) for users of Jenkins X
     5      -   [#jenkins-x-dev](https://app.slack.com/client/T09NY5SBT/C9LTHT2BB) for developers of Jenkins X
     6  -   Discourse forum: [Discourse](https://jenkinsx.discourse.group/)
     7  
     8  JX is a command line tool for installing and using [Jenkins X](https://jenkins-x.io/).
     9  
    10  [![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/3237/badge)](https://bestpractices.coreinfrastructure.org/projects/3237)
    11  [![GoDoc](https://godoc.org/github.com/jenkins-x/jx?status.svg)](https://godoc.org/github.com/jenkins-x/jx)
    12  [![Docs](https://readthedocs.org/projects/docs/badge/?version=latest)](https://jenkins-x.io/docs/)
    13  [![Docker Pulls](https://img.shields.io/docker/pulls/jenkinsxio/jx.svg)](https://hub.docker.com/r/jenkinsxio/jx/tags)
    14  [![Downloads](https://img.shields.io/github/downloads/jenkins-x/jx/total.svg)](https://github.com/jenkins-x/jx/releases)
    15  [![GoReport](https://goreportcard.com/badge/github.com/jenkins-x/jx)](https://goreportcard.com/report/github.com/jenkins-x/jx)
    16  [![Apache](https://img.shields.io/badge/license-Apache-blue.svg)](https://github.com/jenkins-x/jx/blob/master/LICENSE)
    17  [![Reviewed by Hound](https://img.shields.io/badge/reviewed_by-Hound-8E64B0.svg)](https://houndci.com)
    18  ![Build Status](https://img.shields.io/endpoint?url=https%3A%2F%2Fstatusbadge-jx.jenkins-x.live%2Fjx)
    19  [![Slack Status](https://img.shields.io/badge/slack-join_chat-white.svg?logo=slack&style=social)](https://slack.k8s.io/)
    20  
    21  ## Installing
    22  
    23  Check out [how to install jx](https://jenkins-x.io/docs/getting-started/setup/install/).
    24  
    25  ## Getting Started
    26  
    27  Please check out the [Getting Started Guide](https://jenkins-x.io/docs/getting-started/) on how to:
    28  
    29  * [create new Kubernetes clusters with Jenkins X](https://jenkins-x.io/docs/getting-started/setup/create-cluster/)
    30  * [install Jenkins X on existing Kubernetes clusters](https://jenkins-x.io/docs/install-setup/installing/boot/)
    31  
    32  Then [what to do next when you have Jenkins X installed](https://jenkins-x.io/docs/create-project/).
    33  
    34  ## Welcome to the Jenkins X Community
    35  
    36  We value respect and inclusiveness and follow the [CDF Code of Conduct](https://github.com/cdfoundation/toc/blob/master/CODE_OF_CONDUCT.md) in all interactions.
    37  
    38  We’d love to talk with you about Jenkins X and are happy to help if you have any questions.
    39  
    40  Find out more about our bi-weekly office hours, where we discuss all things Jenkins X, and other events [here](https://jenkins-x.io/community/).
    41  
    42  ## Getting Help
    43  
    44  To find out the available commands type:
    45  ```
    46  jx
    47  ```
    48  Or to get help on a specific command, say, `create` then type:
    49  ```
    50  jx help create
    51  ```
    52  You can also browse the [jx command reference documentation](https://jenkins-x.io/commands/jx/).
    53  
    54  ## Reference
    55  
    56  * [Command Line Reference](https://jenkins-x.io/commands/jx/#jx)
    57    
    58    
    59  ## Opening Consoles
    60  To open a console for `foo`:
    61  ```sh
    62  jx open foo
    63  ```
    64  If you do not know the name:
    65  ```sh
    66  jx open
    67  ```
    68  ## Tail logs
    69  
    70  To tail the logs of anything running on Kubernetes (jenkins or your own applications) type.
    71  ```sh
    72  jx logs
    73  ```
    74  Which prompts you for the deployment to log then tails the logs of the newest pod for an app.
    75  
    76  You can filter the list of deployments via:
    77  ```sh
    78  jx logs -f cheese
    79  ```
    80  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.
    81  
    82  ## Remote shells
    83  
    84  You can open a remote shell inside any pods container via the `rsh` command:
    85  ```sh
    86  jx rsh
    87  ```
    88  Or to open a shell inside a pod named foo:
    89  ```sh
    90  jx rsh foo
    91  ```
    92  Pass `-c` to specify the container name. e.g. to open a shell in a maven build pod:
    93  ```sh
    94  jx rsh -c maven maven
    95  ```
    96  ## Importing or Creating apps
    97  
    98  To import an application from the current directory:
    99  ```sh
   100  jx import
   101  ```
   102  Or to create a new Spring Boot application from scratch:
   103  ```sh
   104  jx create spring
   105  ```
   106  e.g. to create a new WebMVC and Spring Boot Actuator microservice try this:
   107  ```sh
   108  jx create spring -d web -d actuator
   109  ```
   110  Or to create a new project from scratch:
   111  ```sh
   112  jx create project
   113  ```
   114  ## Starting builds
   115  
   116  To start a pipeline using a specific name try:
   117  ```sh
   118  jx start pipeline myorg/myrepo
   119  ```
   120  Or to pick the pipeline to start:
   121  ```sh
   122  jx start pipeline
   123  ```
   124  If you know part of the name of the pipeline to run you can filter the list via:
   125  ```sh
   126  jx start pipeline -f thingy
   127  ```
   128  You can start and tail the build log via:
   129  ```sh
   130  jx start pipeline -t
   131  ```
   132  ## Viewing Apps and Environments
   133  
   134  To view environments for a team:
   135  ```sh
   136  jx get env
   137  ```
   138  To view the application versions across environments:
   139  ```sh
   140  jx get version
   141  ```
   142  ## Manual promotions
   143  
   144  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.
   145  
   146  However if you wish to manually promote a version to an environment you can use the following command:
   147  ```sh
   148  jx promote myapp -e prod
   149  ```
   150  Or if you wish to use a custom namespace:   
   151  ```sh
   152  jx promote myapp -n my-dummy-namespace
   153  ```
   154  ## Switching Environments
   155  
   156  The `jx` CLI tool uses the same Kubernetes cluster and namespace context as `kubectl`. 
   157  
   158  You can switch Environments via:
   159  ```sh
   160  jx env
   161  ```
   162  Or change it via:
   163  ```sh
   164  jx env staging
   165  jx env prod
   166  ```
   167      
   168  To display the current environment without trying to change it:
   169  ```sh
   170  jx env -b
   171  ```
   172  To view all the environments type:
   173  ```sh
   174  jx get env
   175  ```
   176  You can create or edit environments too:
   177  ```sh
   178  jx create env # Create an environment
   179  jx edit env staging # Edit staging environment
   180  ```
   181  You can switch namespaces in the same way via:
   182  ```sh
   183  jx ns
   184  ```
   185  or
   186  ```sh
   187  jx ns awesome-staging
   188  ```
   189  ## Switching Clusters
   190  
   191  If you have multiple Kubernetes clusters then you can switch between them via:
   192  ```sh
   193  jx ctx
   194  ```
   195  **Note** that changing the namespace ,environment or cluster changes the current context for **ALL** shells!
   196  
   197  ### Sub shells
   198  
   199  So if you want to work temporarily with, say, the production cluster we highly recommend you use a sub shell for that.
   200  ```sh
   201  jx shell my-prod-context
   202  ```
   203  Or to pick the context to use for the sub shell:
   204  ```sh
   205  jx shell
   206  ```
   207  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!    
   208  
   209  ### Setting your prompt
   210  
   211  You can use the `jx prompt` to configure your CLI prompt to display the current team and environment you are working within:          
   212  ```sh
   213  # Enable the prompt for bash
   214  PS1="[\u@\h \W \$(jx prompt)]\$ "
   215  
   216  # Enable the prompt for zsh
   217  PROMPT='$(jx prompt)'$PROMPT
   218  ```
   219  **Note** that the prompt is updated automatically for you via the `jx shell` command too.
   220  
   221  ### Bash completion
   222  
   223  On a Mac to enable bash completion try:
   224  ```sh
   225  jx completion bash > ~/.jx/bash
   226  source ~/.jx/bash
   227  ```
   228  Or try:
   229  ```sh
   230  source <(jx completion bash)
   231  ```
   232  For more help try:
   233  ```sh
   234  jx help completion bash
   235  ```
   236  ## Addons
   237  
   238  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.
   239  
   240  For example to add the [Gitea Git server](https://gitea.io/en-US/) to your Jenkins X installation try:
   241  ```sh
   242  jx create addon gitea
   243  ```
   244  This will:
   245  
   246  * install the Gitea Helm chart.
   247  * add Gitea as a Git server (via the `jx create git server gitea` command).
   248  * create a new user in Gitea (via the `jx create git user -n gitea` command).
   249  * create a new Git API token in Gitea (via the `jx create git token -n gitea -p password username` command).
   250  
   251  ## Troubleshooting
   252  
   253  We have tried to collate common issues here with work arounds. If your issue isn't listed here please [let us know](https://github.com/jenkins-x/jx/issues/new).
   254  
   255  ### Other issues
   256  
   257  Please [let us know](https://github.com/jenkins-x/jx/issues/new) and see if we can help? Good luck!
   258  
   259  ## Contributing
   260  
   261  We welcome your contributions.
   262  
   263  If you're looking to build from source or get started hacking on jx, please see the [CONTRIBUTING.MD](CONTRIBUTING.MD) or our [Contributing Guide](https://jenkins-x.io/community/code/) on the Jenkins X website.
   264  
   265  
   266  [![](https://codescene.io/projects/4772/status.svg) Get more details at **codescene.io**.](https://codescene.io/projects/4772/jobs/latest-successful/results)
   267  
   268  
   269  [experiments]: docs/contributing/experiments.md