Jenkins X CLI (jx)

repository·main·Indexed 11 days ago

https://github.com/jenkins-x/jx

A modular command-line tool for JayeX 3.x and Jenkins X. The jx CLI serves as the primary entry point for managing environments, pipelines, and components, featuring a plugin-based architecture and specialized commands for GitOps, project creation, and context management.

Tokens
12K
Snippets
67
Records
84
Agent score
88%

What's inside Jenkins X

  1. Overview of JayeX CLI (jx)

    main
    The jx CLI is a modular command-line interface designed for JayeX 3.x. It serves as the primary entry point for interacting with the JayeX ecosystem, utilizing a plugin-based architecture to extend its functionality.
  2. Use the JayeX CLI (jx)

    main
    The jx command is the primary entrypoint for the JayeX 3.x command line interface. It is used to manage resources, control namespaces, and interact with the JayeX ecosystem (pipelines, dashboards, etc.).
    jx
  3. Install JX CLI on Linux

    main

    To install the JX CLI on Linux, download the appropriate tarball for your architecture using curl, extract it, and move the binary to /usr/local/bin.

    Note: Replace {{.Version}} in the commands below with the specific version you wish to install (e.g., v3.17.80).

    # For amd64
    curl -L https://github.com/jenkins-x/jx/releases/download/v{{.Version}}/jx-linux-amd64.tar.gz | tar xzv
    sudo mv jx /usr/local/bin
    
    # For arm
    curl -L https://github.com/jenkins-x/jx/releases/download/v{{.Version}}/jx-linux-arm.tar.gz | tar xzv
    sudo mv jx /usr/local/bin
    
    # For arm64
    curl -L https://github.com/jenkins-x/jx/releases/download/v{{.Version}}/jx-linux-arm64.tar.gz | tar xzv
    sudo mv jx /usr/local/bin
  4. Access the jx command and plugin reference

    main
    For a complete list of available commands and plugin-specific instructions, refer to the official JayeX command reference documentation. This includes both core jx commands and those provided by installed plugins.
  5. Open the JayeX Pipelines Dashboard

    main

    Use the jx dashboard command to view the JayeX Pipelines Dashboard. By default, this command attempts to open the dashboard URL in your default web browser. You can also use the alias jx dash.

    # open the dashboard
    jx dashboard
    
    # or using the alias
    jx dash
  6. Run the Jenkins X quickstart guide

    main

    Use the jx create quickstart command (or its aliases) to initiate the Jenkins X quickstart process. This command is a shortcut for jx project quickstart and is designed to guide you through the initial setup and creation of a Jenkins X project environment.

    jx create quickstart
    # or using aliases
    jx qs
  7. Install JX CLI on macOS

    main

    You can install the JX CLI on macOS using Homebrew or by downloading the binary directly via curl.

    Note: Replace {{.Version}} in the curl commands with the specific version you wish to install.

    # Using Homebrew
    brew install --no-quarantine --cask jenkins-x/jx/jx
    
    # Using curl (amd64)
    curl -L https://github.com/jenkins-x/jx/releases/download/v{{.Version}}/jx-darwin-amd64.tar.gz | tar xzv
    sudo mv jx /usr/local/bin
    
    # Using curl (arm64)
    curl -L https://github.com/jenkins-x/jx/releases/download/v{{.Version}}/jx-darwin-arm64.tar.gz | tar xzv
    sudo mv jx /usr/local/bin
  8. Use the JayeX (jx) CLI

    main

    The jx command is the primary entry point for the JayeX 3.x command line interface. It is used to manage Jenkins X environments, pipelines, and components through a variety of subcommands.

    To view the available commands and general help, use the --help flag.

    jx --help
  9. How JX plugins work

    main

    The jx CLI uses an extension mechanism to support commands not present in the core binary.

    1. Discovery: When you run a command like jx foo-bar, the CLI first checks if foo-bar is a built-in command.
    2. Plugin Mapping: If not found, it searches for a plugin binary named jx-foo-bar in your default plugin directory (typically ~/.jakes/bin or similar, managed by homedir.DefaultPluginDir).
    3. Automatic Installation: If a plugin is identified via the internal PluginMap but not found locally, jx will attempt to install the correct version automatically using extensions.EnsurePluginInstalled.
    4. Execution: Once found or installed, the CLI executes the plugin, passing along the remaining arguments and setting environment variables (BINARY_NAME and TOP_LEVEL_COMMAND) so the plugin knows how it was invoked.
  10. Documentation source format for CLI commands

    main

    The documentation generator expects Markdown files to be organized in a directory structure mirroring the CLI command hierarchy under docs/reference/cmd/.

    Each command's documentation is stored in a file named {command_name}.md (or {parent}_{child}.md for subcommands). To correctly populate the CLI's Long description and Example fields, the Markdown files must use specific headers:

    • ## Description: Everything following this header is used as the command's long description.
    • ## Examples: Everything following this header is used as the command's usage examples.

    If a file does not exist for a specific command, the generator logs a warning and skips that command.

  11. Quickstart a new project with jx create quickstart

    main
    Use the jx create quickstart command (or its alias jx create-quickstart) to initiate the automated process for setting up a new project within Jenkins X. This command serves as a high-level entry point to bootstrap the necessary project structures and configurations required for a standard Jenkins X workflow.
    jx create quickstart