File jenkins-x-cli-3.11.92.obscpio of Package jenkins-x-cli

07070100000000000081A4000000000000000000000001683E350C000000D9000000000000000000000000000000000000002400000000jenkins-x-cli-3.11.92/.dockerignoredraft.toml
target/classes
target/generated-sources
target/generated-test-sources
target/maven-archiver
target/maven-status
target/surefire-reports
target/test-classes
target/*.original
charts/
NOTICE
LICENSE
README.md07070100000001000081A4000000000000000000000001683E350C00000B37000000000000000000000000000000000000002400000000jenkins-x-cli-3.11.92/.golangci.ymllinters-settings:
  depguard:
    rules:
      main:
        list-mode: original
        deny:
        - pkg: github.com/jenkins-x/jx/v2/pkg/log
          desc: "use jenkins-x/jx-logging instead"
        - pkg: github.com/satori/go.uuid
          desc: "use github.com/google/uuid instead"
        - pkg: github.com/pborman/uuid
          desc: "use github.com/google/uuid instead"
  dupl:
    threshold: 100
  exhaustive:
    default-signifies-exhaustive: false
  funlen:
    lines: 200
    statements: 150
  goconst:
    min-len: 3
    min-occurrences: 3
  gocritic:
    enabled-tags:
    - diagnostic
    - experimental
    - opinionated
    - performance
    - style
    disabled-checks:
    - dupImport # https://github.com/go-critic/go-critic/issues/845
    - ifElseChain
    - octalLiteral
    - whyNoLint
    - wrapperFunc
    - importShadow # not important for now
    - unnamedResult # not important
  gocyclo:
    min-complexity: 15
  goimports: {}
  revive:
    confidence: 0
  gofmt:
    simplify: true
  mnd:
    # don't include the "operation" and "assign"
    checks: [argument, case, condition, return]
  govet:
    settings:
      printf:
        funcs:
        - (github.com/jenkins-x/jx-logging/v3/pkg/log/Logger()).Debugf
        - (github.com/jenkins-x/jx-logging/v3/pkg/log/Logger()).Infof
        - (github.com/jenkins-x/jx-logging/v3/pkg/log/Logger()).Warnf
        - (github.com/jenkins-x/jx-logging/v3/pkg/log/Logger()).Errorf
        - (github.com/jenkins-x/jx-logging/v3/pkg/log/Logger()).Fatalf
  lll:
    line-length: 140
  misspell: {}
  nolintlint:
    allow-unused: false # report any unused nolint directives
    require-explanation: false # don't require an explanation for nolint directives
    require-specific: false # don't require nolint directives to be specific about which linter is being skipped
linters:
  # please, do not use `enable-all`: it's deprecated and will be removed soon.
  # inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
  disable-all: true
  enable:
  - asciicheck
  - bodyclose
  - depguard
  - errcheck
  - gofmt
  - goimports
  - goprintffuncname
  - gosec
  - gosimple
  - ineffassign
  - misspell
  - mnd
  - nakedret
  - rowserrcheck
  - staticcheck
  - typecheck
  - unconvert
  - unparam
  - unused
  - revive
  - gocritic
  - govet
  - dupl
issues:
  exclude-dirs:
  - cmd/docs
  # Excluding configuration per-path, per-linter, per-text and per-source
  exclude-rules:
  #    - path: _test\.go
  #      linters:
  #        - gomnd
  #    https://github.com/go-critic/go-critic/issues/926
  - linters:
    - gocritic
    text: "unnecessaryDefer:"
  exclude:
  - 'shadow: declaration of "err" shadows declaration at'
  max-same-issues: 0

run:
  timeout: 1h30m
# golangci.com configuration
# https://github.com/golangci/golangci/wiki/Configuration
07070100000002000081A4000000000000000000000001683E350C00000A56000000000000000000000000000000000000002600000000jenkins-x-cli-3.11.92/.goreleaser.ymlversion: 2
env:
  - GO111MODULE=on
  - CGO_ENABLED=0
  - COSIGN_EXPERIMENTAL=true
before:
  hooks:
    - go mod download
builds:
  - id: jx
    # Path to main.go file or main package.
    # Default is `.`.
    main: ./cmd/main.go
    # Binary name.
    # Can be a path (e.g. `bin/app`) to wrap the binary in a directory.
    # Default is the name of the project directory.
    binary: jx
    # Custom ldflags templates.
    # Default is `-s -w -X main.version={{.Version}} -X main.commit={{.ShortCommit}} -X main.date={{.Date}} -X main.builtBy=goreleaser`.
    ldflags:
      - -X "{{.Env.ROOTPACKAGE}}/pkg/cmd/version.Version={{.Env.VERSION}}" -X "{{.Env.ROOTPACKAGE}}/pkg/cmd/version.Revision={{.Env.REV}}" -X "{{.Env.ROOTPACKAGE}}/pkg/cmd/version.Branch={{.Env.BRANCH}}" -X "{{.Env.ROOTPACKAGE}}/pkg/cmd/version.BuildDate={{.Env.BUILDDATE}}" -X "{{.Env.ROOTPACKAGE}}/pkg/cmd/version.GoVersion={{.Env.GOVERSION}}"
    # GOOS list to build for.
    # For more info refer to: https://golang.org/doc/install/source#environment
    # Defaults are darwin and linux.
    goos:
      - windows
      - darwin
      - linux
    # GOARCH to build for.
    # For more info refer to: https://golang.org/doc/install/source#environment
    # Defaults are 386 and amd64.
    goarch:
      - amd64
      - arm64
    ignore:
      - goos: windows
        goarch: arm64
archives:
  - name_template: "jx-{{ .Os }}-{{ .Arch }}"
    format_overrides:
      - goos: windows
        format: zip
checksum:
  # You can change the name of the checksums file.
  # Default is `jx_{{ .Version }}_checksums.txt`.
  name_template: "jx-checksums.txt"
  # Algorithm to be used.
  # Accepted options are sha256, sha512, sha1, crc32, md5, sha224 and sha384.
  # Default is sha256.
  algorithm: sha256
changelog:
  # set it to true if you wish to skip the changelog generation
  disable: true
release:
  # If set to true, will not auto-publish the release.
  # Default is false.
  draft: false
  # If set to auto, will mark the release as not ready for production
  # in case there is an indicator for this in the tag e.g. v1.0.0-rc1
  # If set to true, will mark the release as not ready for production.
  # Default is false.
  prerelease: true
  # You can change the name of the GitHub release.
  # Default is `{{.Tag}}`
  name_template: "{{.Env.VERSION}}"
sboms:
  - artifacts: archive
signs:
  - cmd: cosign
    env:
      - COSIGN_EXPERIMENTAL=1
    certificate: '${artifact}.pem'
    output: true
    artifacts: all
    args:
      - sign-blob
      - --yes=true
      - '--output-certificate=${certificate}'
      - '--output-signature=${signature}'
      - '${artifact}'
07070100000003000081A4000000000000000000000001683E350C0000018E000000000000000000000000000000000000002200000000jenkins-x-cli-3.11.92/.helmignore# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
# Various IDEs
.project
.idea/
*.tmproj
*.png

# known compile time folders
target/
node_modules/
vendor/07070100000004000041ED000000000000000000000002683E350C00000000000000000000000000000000000000000000001A00000000jenkins-x-cli-3.11.92/.jx07070100000005000081A4000000000000000000000001683E350C000000E6000000000000000000000000000000000000002800000000jenkins-x-cli-3.11.92/.jx/settings.yamlapiVersion: core.jenkins-x.io/v4beta1
kind: Settings
spec:
  gitUrl: "https://github.com/jx3-gitops-repositories/jx3-github.git"
  destination:
    chartRepository: https://github.com/jenkins-x-charts/repo.git
    chartKind: pages07070100000006000081A4000000000000000000000001683E350C00000809000000000000000000000000000000000000002900000000jenkins-x-cli-3.11.92/.jx/updatebot.yamlapiVersion: updatebot.jenkins-x.io/v1alpha1
kind: UpdateConfig
spec:
  rules:
    - urls:
        - https://github.com/jenkins-x/jx3-pipeline-catalog
      changes:
        - regex:
            pattern: "jenkins-x/jx:(.*)"
            files:
              - "**/*.yaml"
        - regex:
            pattern: "jenkins-x/jx-boot:(.*)"
            files:
              - "**/*.yaml"
    - urls:
        - https://github.com/jenkins-x/jx3-versions
      changes:
        - versionTemplate: |
            {{ pullRequestSha "jenkins-x/jx3-pipeline-catalog" }}
          regex:
            pattern: "version: (.*)"
            files:
              - git/github.com/jenkins-x/jx3-pipeline-catalog.yml
        - regex:
            pattern: "\\s+image: ghcr.io/jenkins-x/jx:(.*)"
            files:
              - ".lighthouse/jenkins-x/release.yaml"
              - ".lighthouse/jenkins-x/pullrequest*.yaml"
              - "jenkins-x-*.yml"
              - "git-operator/job.yaml"
        - regex:
            pattern: "\\s+image: ghcr.io/jenkins-x/jx-boot:(.*)"
            files:
              - ".lighthouse/jenkins-x/release.yaml"
              - ".lighthouse/jenkins-x/pullrequest*.yaml"
              - "jenkins-x-*.yml"
              - "git-operator/job*.yaml"
        - regex:
            pattern: "version: (.*)"
            files:
              - "docker/ghcr.io/jenkins-x/jx.yml"
              - "packages/jx.yml"
              - "packages/jx-cli.yml"
        # - regex:
        #     pattern: "terraformVersion: (.*)"
        #     files:
        #     - ".lighthouse/jenkins-x/bdd/*.yaml*"
        - regex:
            pattern: "JX_DEFAULT_IMAGE: ghcr.io/jenkins-x/jx:(.*)"
            files:
              - "apps/jenkins-x/lighthouse/values.yaml.gotmpl"
              - "charts/jenkins-x/lighthouse/values.yaml.gotmpl"
    - urls:
        - https://github.com/jenkins-x-charts/jxboot-helmfile-resources
      changes:
        - regex:
            pattern: "jx: (.*)"
            files:
              - "charts/jxboot-helmfile-resources/values.yaml"
07070100000007000041ED000000000000000000000002683E350C00000000000000000000000000000000000000000000002200000000jenkins-x-cli-3.11.92/.lighthouse07070100000008000041ED000000000000000000000002683E350C00000000000000000000000000000000000000000000002C00000000jenkins-x-cli-3.11.92/.lighthouse/jenkins-x07070100000009000081A4000000000000000000000001683E350C000002CF000000000000000000000000000000000000003600000000jenkins-x-cli-3.11.92/.lighthouse/jenkins-x/lint.yamlapiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
  creationTimestamp: null
  name: lint
spec:
  pipelineSpec:
    tasks:
    - name: jx-lint
      resources: {}
      timeout: 1h30m0s
      taskSpec:
        metadata: {}
        stepTemplate:
          image: uses:jenkins-x/jx3-pipeline-catalog/tasks/go/pullrequest.yaml@versionStream
          name: ""
          resources: {}
          workingDir: /workspace/source
        steps:
        - image: uses:jenkins-x/jx3-pipeline-catalog/tasks/git-clone/git-clone-pr.yaml@versionStream
          name: ""
          resources: {}
        - name: make-lint
          resources: {}
  podTemplate: {}
  serviceAccountName: tekton-bot
  timeout: 1h30m0s
status: {}
0707010000000A000081ED000000000000000000000001683E350C000007E0000000000000000000000000000000000000003D00000000jenkins-x-cli-3.11.92/.lighthouse/jenkins-x/pullrequest.yamlapiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
  creationTimestamp: null
  name: pullrequest
spec:
  pipelineSpec:
    tasks:
    - name: from-build-pack
      resources: {}
      taskSpec:
        metadata: {}
        stepTemplate:
          image: uses:jenkins-x/jx3-pipeline-catalog/tasks/go-plugin/pullrequest.yaml@versionStream
          name: ""
          resources: {}
          workingDir: /workspace/source
        steps:
        - image: uses:jenkins-x/jx3-pipeline-catalog/tasks/git-clone/git-clone-pr.yaml@versionStream
          name: ""
          resources: {}
        - name: jx-variables
          resources: {}
        - name: build-make-linux
          resources: {}
        # Move to catalog
        - image: golang:1.23.2-alpine3.19@sha256:f6392ffebb028fed5ffe743ddb9716e38402c978779edd66474bb5d05f5e65e4
          name: coverage-report
          resources: {}
          script: |
            #!/bin/sh
            source .jx/variables.sh
            apk add --update make bash curl gnupg coreutils
            make test-coverage
            curl https://keybase.io/codecovsecurity/pgp_keys.asc | gpg --no-default-keyring --keyring trustedkeys.gpg --import
            # Pin it to 0.2.4, seeing an error with slug in 0.2.5
            curl -Os https://uploader.codecov.io/v0.2.4/alpine/codecov
            curl -Os https://uploader.codecov.io/0.2.4/alpine/codecov.SHA256SUM
            curl -Os https://uploader.codecov.io/0.2.4/alpine/codecov.SHA256SUM.sig
            gpgv codecov.SHA256SUM.sig codecov.SHA256SUM
            sha256sum -c codecov.SHA256SUM
            chmod +x codecov
            ./codecov -Z -B ${PR_HEAD_REF} -r jenkins-x/jx -C ${PULL_PULL_SHA} -t ${CODECOV_TOKEN} -R . -f ./build/reports/cover.txt
          env:
          - name: CODECOV_TOKEN
            valueFrom:
              secretKeyRef:
                name: codecov
                key: token
                optional: true
  podTemplate: {}
  serviceAccountName: tekton-bot
  timeout: 1h0m
status: {}
0707010000000B000081A4000000000000000000000001683E350C000001B7000000000000000000000000000000000000003A00000000jenkins-x-cli-3.11.92/.lighthouse/jenkins-x/triggers.yamlapiVersion: config.lighthouse.jenkins-x.io/v1alpha1
kind: TriggerConfig
spec:
  presubmits:
  - name: pr
    context: "pr"
    always_run: true
    optional: false
    trigger: (?m)^/test( all| pr),?(s+|$)
    rerun_command: /test pr
    source: "pullrequest.yaml"
  - name: lint
    context: "lint"
    always_run: true
    optional: false
    trigger: (?m)^/test( all| lint),?(s+|$)
    rerun_command: /test lint
    source: "lint.yaml"
0707010000000C000081A4000000000000000000000001683E350C0000284B000000000000000000000000000000000000002600000000jenkins-x-cli-3.11.92/CONTRIBUTING.MD
# Hacking on JX

This guide is for developers who want to improve the Jenkins X jx CLI. These instructions will help you set up a
development environment for working on the jx source code.

## Prerequisites

To compile, test and contribute towards the jx binaries you will need:

 - [git][]
 - [Go][] 1.23 is supported

In most cases, install the prerequisite according to its instructions. See the next section
for a note about Go cross-compiling support.

### Configuring Go

The jx's binary CLI is built on your machine in your GO Path. 

On macOS, Go can be installed with [Homebrew][]:

```shell

$ brew install go 
```

It is also straightforward to build Go from source:

```shell
$ sudo su
$ curl -sSL https://go.dev/dl/go1.23.4.src.tar.gz | tar -C /usr/local -xz
$ cd /usr/local/go/src
$ # compile Go for the default platform first, then add cross-compile support
$ ./make.bash --no-clean
$ GOOS=linux GOARCH=amd64 ./make.bash --no-clean
```

## Fork the Repository

Begin at GitHub by forking jx, then clone your fork locally. Since jx is a Go package, it
should be located at `$GOPATH/src/github.com/jenkins-x/jx`.

```shell
$ mkdir -p $GOPATH/src/github.com/jenkins-x
$ cd $GOPATH/src/github.com/jenkins-x
$ git clone git@github.com:<username>/jx.git
$ cd jx
```

Add the conventional [upstream][] `git` remote in order to fetch changes from jx's main master
branch and to create pull requests:

```shell
$ git remote add upstream https://github.com/jenkins-x/jx.git
```

## Build Your Changes

With the prerequisites installed and your fork of jx cloned, you can make changes to local jx
source code.

Run `make` to build the `jx`  binaries:

```shell

$ make build      # runs dep and builds `jx`  inside the build/
```

## Testing

The jx test suite is divided into three sections:
 - The standard unit test suite
 - Slow unit tests
 - Integration tests

To run the standard test suite:
```make test```

To run the standard test suite including slow running tests:
```make test-slow```

To run all tests including integration tests (NOTE These tests are not encapsulated):
```make test-slow-integration```


To get a nice HTML report on the tests:
```make test-report-html```

### Writing tests

### Unit Tests

Unit tests should be isolated (see what is an unencapsulated test), and should contain the `t.Parallel()` directive in order to keep things nice and speedy.

If you add a slow running (more than a couple of seconds) test, it needs to be wrapped like so:
```
if testing.Short() {
	t.Skip("skipping a_long_running_test")
} else {
	// Slow test goes here...
}
```
Slows tests can (and should) still include `t.Parallel()`

Best practice for unit tests is to define the testing package appending _test to the name of your package, e.g. `mypackage_test` and then import `mypackage` inside your tests.
This encourages good package design and will enable you to define the exported package API in a composable way.

### Integration Tests

To add an integration test, create a separate file for your integration tests using the naming convention `mypackage_integration_test.go` Use the same package declaration as your unit tests: `mypackage_test`. At the very top of the file before the package declaration add this custom build directive:

```
// +build integration

```
Note that there needs to be a blank line before you declare the package name. 

This directive will ensure that integration tests are automatically separated from unit tests, and will not be run as part of the normal test suite.
You should NOT add `t.Parallel()` to an unencapsulated test as it may cause intermittent failures.

### What is an unencapsulated test?
A test is unencapsulated (not isolated) if it cannot be run (with repeatable success) without a certain surrounding state. Relying on external binaries that may not be present, writing or reading from the filesystem without care to specifically avoid collisions, or relying on other tests to run in a specific sequence for your test to pass are all examples of a test that you should carefully consider before committing. If you would like to easily check that your test is isolated before committing simply run: `make docker-test`, or if your test is marked as slow: `make docker-test-slow`. This will mount the jx project folder into a golang docker container that does not include any of your host machines environment. If your test passes here, then you can be happy that the test is encapsulated.

### Mocking / Stubbing
Mocking or stubbing methods in your unit tests will get you a long way towards test isolation. Coupled with the use of interface based APIs you should be able to make your methods easily testable and useful to other packages that may need to import them.
https://github.com/petergtz/pegomock Is our current mocking library of choice, mainly because it is very easy to use and doesn't require you to write your own mocks (Yay!)
We place all interfaces for each package in a file called `interface.go` in the relevant folder. So you can find all interfaces for `github.com/jenkins-x/jx/v2/pkg/util` in `github.com/jenkins-x/jx/v2/pkg/util/interface.go` 
Generating/Regenerating a mock for a given interface is easy, just go to the `interface.go` file that corresponds with the interface you would like to mock and add a comment directly above your interface definition that will look something like this:
```
// CommandInterface defines the interface for a Command
//go:generate pegomock generate github.com/jenkins-x/jx/v2/pkg/util CommandInterface -o mocks/command_interface.go
type CommandInterface interface {
	DidError() bool
	DidFail() bool
	Error() error
	Run() (string, error)
	RunWithoutRetry() (string, error)
	SetName(string)
	SetDir(string)
	SetArgs([]string)
	SetTimeout(time.Duration)
	SetExponentialBackOff(*backoff.ExponentialBackOff)
}
```
In the example you can see that we pass the generator to use: `pegomock generate` the package path name: `github.com/jenkins-x/jx/v2/pkg/util` the name of the interface: `CommandInterface` and finally an output directive to write the generated file to a mock subfolder. To keep things nice and tidy it's best to write each mocked interface to a separate file in this folder. So in this case: `-o mocks/command_interface.go`

Now simply run:
```
go generate ./...
```
or
```
make generate
```

You now have a mock to test your new interface!
The new mock can now be imported into your test file and used for easy mocking/stubbing.
Here's an example:
```
package util_test

import (
	"errors"
	"testing"

	"github.com/jenkins-x/jx/v2/pkg/util"
	mocks "github.com/jenkins-x/jx/v2/pkg/util/mocks"
	. "github.com/petergtz/pegomock"
	"github.com/stretchr/testify/assert"
)

func TestJXBinaryLocationSuccess(t *testing.T) {
	t.Parallel()
	commandInterface := mocks.NewMockCommandInterface()
	When(commandInterface.RunWithoutRetry()).ThenReturn("/test/something/bin/jx", nil)

	res, err := util.JXBinaryLocation(commandInterface)
	assert.Equal(t, "/test/something/bin", res)
	assert.NoError(t, err, "Should not error")
}
```
Here we're importing the mock we need in our import declaration:
```
mocks "github.com/jenkins-x/jx/v2/pkg/util/mocks"
```
Then inside the test we're instantiating `NewMockCommandInterface` which was automatically generated for us by pegomock.

Next we're stubbing something that we don't actually want to run when we execute our test. In this case we don't want to make a call to an external binary as that could break our tests isolation. We're using some handy matchers which are provided by pegomock, and importing using a `.` import to keep the syntax neat (You probably shouldn't do this outside of tests):
```
When(commandInterface.RunWithoutRetry()).ThenReturn("/test/something/bin/jx", nil)
```
Now when we can setup our  test using the mock interface and make assertions as normal.


### Debug logging

Lots of the test have debug output to try figure out when things fail. You can enable verbose debug logging for tests via

```shell 
export JX_TEST_DEBUG=true
```

## Debugging

First you need to [install Delve](https://github.com/derekparker/delve/blob/master/Documentation/installation/README.md)

Then you should be able to run a debug version of a jx command:

```
dlv --listen=:2345 --headless=true --api-version=2 exec ./build/jx -- some arguments
```

Then in you IDE you should be able to then set a breakpoint and connect to `2345`.

e.g. in IntellJ you create a new `Go Remote` execution and then hit `Debug`

### Debugging jx with stdin

If you want to debug using `jx` with `stdin` to test out terminal interaction, you can start `jx` as usual from the command line then:

* find the `pid` of the jx command via something like `ps -elaf | grep jx`
* start Delve attaching to the pid:

```shell

dlv --listen=:2345 --headless=true --api-version=2 attach SomePID
```

### Debugging a unit test

You can run a single unit test via

```shell
export TEST="TestSomething"
make test1
```

You can then start a Delve debug session on a unit test via:

```shell
export TEST="TestSomething"
make debugtest1
```

Then set breakpoints and debug in your IDE like in the above debugging.

### Using a helper script

If you create a bash file called `jxDebug` as the following (replacing `SomePid` with the actual `pid`):

```bash
#!/bin/sh
echo "Debugging jx"
dlv --listen=:2345 --headless=true --api-version=2 exec `which jx` -- $*
```

Then you can change your `jx someArgs` CLI to `jxDebug someArgs` then debug it!

## Pre-commit Hooks

These are installed as a git 'pre-commit' hook and it operates automatically via a hook when using the `git commit` command. To setup this hook:
* Install [pre-commit](https://pre-commit.com/#install)
* Once installed, ensure you're at the root of this repository where the `.pre-commit-config.yaml` file exists, then:

```bash
pre-commit install
```

If you wish to find out more:
- [pre-commit](https://pre-commit.com)
- [git hooks](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks)

[git]: https://git-scm.com/
[dep]: https://github.com/golang/dep 
[go]: https://golang.org/
[Homebrew]: https://brew.sh/
[Kubernetes]: https://github.com/kubernetes/kubernetes
[Minikube]: https://github.com/kubernetes/minikube
[upstream]: https://help.github.com/articles/fork-a-repo/
[upx]: https://upx.github.io
0707010000000D000081A4000000000000000000000001683E350C0000058E000000000000000000000000000000000000001A00000000jenkins-x-cli-3.11.92/DCODeveloper Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
660 York Street, Suite 102,
San Francisco, CA 94110 USA

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.


Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.
0707010000000E000081A4000000000000000000000001683E350C0000019C000000000000000000000000000000000000002100000000jenkins-x-cli-3.11.92/DockerfileFROM ghcr.io/jenkins-x/jx-cli-base-image:0.1.1

ARG VERSION
ARG TARGETARCH
ARG TARGETOS

ENV HOME /home
ENV JX3_HOME /home/.jx3

RUN echo using jx version ${VERSION} and OS ${TARGETOS} arch ${TARGETARCH} && \
  mkdir -p /home/.jx3 && \
  curl -L https://github.com/jenkins-x/jx/releases/download/v${VERSION}/jx-${TARGETOS}-${TARGETARCH}.tar.gz | tar xzv && \
  mv jx /usr/bin

RUN jx upgrade plugins --mandatory
0707010000000F000081A4000000000000000000000001683E350C000002E0000000000000000000000000000000000000002600000000jenkins-x-cli-3.11.92/Dockerfile-bootFROM alpine:3.16.2

ARG BUILD_DATE
ARG VERSION
ARG REVISION
ARG TARGETARCH
ARG TARGETOS

LABEL maintainer="jenkins-x"

RUN addgroup -S app \
    && adduser -S -g app app \
    && apk --no-cache add \
    ca-certificates curl git git-lfs make netcat-openbsd bash yq

ENV JX_HOME /root/.jx
ENV JX3_HOME /root/.jx
ENV HELM_DATA_HOME /root/.local/share/helm

RUN echo using jx version ${VERSION} and OS ${TARGETOS} arch ${TARGETARCH} && \
  mkdir -p /home/.jx3 && \
  curl -L https://github.com/jenkins-x/jx/releases/download/v${VERSION}/jx-${TARGETOS}-${TARGETARCH}.tar.gz | tar xzv && \
  mv jx /usr/bin

RUN jx upgrade plugins --boot --path /usr/bin && \
  jx secret plugins upgrade

#RUN chown -R app:app /usr/bin/jx /home
#USER app



07070100000010000081A4000000000000000000000001683E350C000001F3000000000000000000000000000000000000002400000000jenkins-x-cli-3.11.92/Dockerfile-goFROM golang:1.23.2-alpine3.19@sha256:f6392ffebb028fed5ffe743ddb9716e38402c978779edd66474bb5d05f5e65e4

ARG VERSION
ARG TARGETARCH
ARG TARGETOS

#ENV HOME /home
ENV JX3_HOME /home/.jx3

RUN apk add --no-cache curl && \
  echo using jx version ${VERSION} and OS ${TARGETOS} arch ${TARGETARCH} && \
  mkdir -p /home/.jx3 && \
  curl -L https://github.com/jenkins-x/jx/releases/download/v${VERSION}/jx-${TARGETOS}-${TARGETARCH}.tar.gz | tar xzv && \
  mv jx /usr/bin

RUN jx upgrade plugins --mandatory
07070100000011000081A4000000000000000000000001683E350C0000040D000000000000000000000000000000000000002A00000000jenkins-x-cli-3.11.92/Dockerfile-go-maven# ToDo: Make it work with alpine, not sure why alpine images complain about java not found
FROM golang:1.23.2@sha256:a7f2fc9834049c1f5df787690026a53738e55fc097cd8a4a93faa3e06c67ee32

# Maven
ENV MAVEN_VERSION 3.6.3
ENV M2_HOME /opt/apache-maven-$MAVEN_VERSION
ENV maven.home $M2_HOME
ENV M2 $M2_HOME/bin
ENV PATH $M2:$PATH
ENV JAVA_HOME=/opt/jdk-15.0.1
ENV PATH=$JAVA_HOME/bin:$PATH
ENV JX3_HOME /home/.jx3

ARG VERSION
ARG TARGETARCH
ARG TARGETOS

RUN curl -f -L https://repo1.maven.org/maven2/org/apache/maven/apache-maven/$MAVEN_VERSION/apache-maven-$MAVEN_VERSION-bin.tar.gz | tar -C /opt -xzv

RUN curl -f -L https://download.java.net/java/GA/jdk15.0.1/51f4f36ad4ef43e39d0dfdbaf6549e32/9/GPL/openjdk-15.0.1_linux-x64_bin.tar.gz  | tar -C /opt -xzv

RUN echo using jx version ${VERSION} and OS ${TARGETOS} arch ${TARGETARCH} && \
  mkdir -p /home/.jx3 && \
  curl -L https://github.com/jenkins-x/jx/releases/download/v${VERSION}/jx-${TARGETOS}-${TARGETARCH}.tar.gz | tar xzv && \
  mv jx /usr/bin

RUN jx upgrade plugins --mandatory
07070100000012000081A4000000000000000000000001683E350C000002B0000000000000000000000000000000000000002900000000jenkins-x-cli-3.11.92/Dockerfile-kubectlFROM alpine:3.16.2

ARG VERSION
ARG TARGETARCH
ARG TARGETOS

LABEL org.opencontainers.image.authors="Linux Foundation" \
      org.opencontainers.image.description="Kubectl docker image used by Jenkins X" \
      org.opencontainers.image.ref.name="alpine:3.16.2" \
      org.opencontainers.image.source="https://github.com/jenkins-x/jx/blob/main/Dockerfile-kubectl" \
      org.opencontainers.image.title="kubectl"

RUN apk add --update --no-cache curl &&\
    adduser -D -u 1001 jx

RUN curl -LO "https://dl.k8s.io/release/v${VERSION}/bin/${TARGETOS}/${TARGETARCH}/kubectl" &&\
    chmod +x kubectl && \
    mv kubectl /usr/local/bin

USER 1001
ENTRYPOINT [ "kubectl" ]
CMD [ "--help" ]
07070100000013000081A4000000000000000000000001683E350C000004DC000000000000000000000000000000000000002900000000jenkins-x-cli-3.11.92/Dockerfile-tfo-awsFROM amazon/aws-cli

ARG TARGETARCH
ARG TARGETOS
ARG VERSION

# install packages
RUN yum -y update \
    && yum install -y git tar gzip unzip jq which\
    && yum clean all && rm -rf /var/cache/yum

RUN curl -o aws-iam-authenticator https://amazon-eks.s3-us-west-2.amazonaws.com/1.15.10/2020-02-22/bin/linux/amd64/aws-iam-authenticator && \
    chmod +x aws-iam-authenticator && \
    mv aws-iam-authenticator /usr/bin/aws-iam-authenticator

# terraform
ENV TERRAFORM 1.1.2
RUN curl -LO https://releases.hashicorp.com/terraform/${TERRAFORM}/terraform_${TERRAFORM}_linux_amd64.zip && \
  unzip terraform_${TERRAFORM}_linux_amd64.zip && \
  chmod +x terraform && mv terraform /usr/bin && rm terraform_${TERRAFORM}_linux_amd64.zip

# jx
RUN echo using jx version ${VERSION} and OS ${TARGETOS} arch ${TARGETARCH} && \
  mkdir -p /home/.jx3 && \
  curl -L https://github.com/jenkins-x/jx/releases/download/v${VERSION}/jx-${TARGETOS}-${TARGETARCH}.tar.gz | tar xzv && \
  mv jx /usr/bin

# lets install the boot plugins
RUN jx upgrade plugins --boot --path /usr/bin

# lets install the admin plugin
RUN jx admin help

COPY run.sh /run.sh
ENTRYPOINT ["/bin/bash"]
CMD ["/run.sh"]

LABEL org.opencontainers.image.source https://github.com/jenkins-x/jx
07070100000014000081A4000000000000000000000001683E350C000003C3000000000000000000000000000000000000002900000000jenkins-x-cli-3.11.92/Dockerfile-tfo-gcpFROM google/cloud-sdk:slim
USER root

ARG TARGETARCH
ARG TARGETOS
ARG VERSION

LABEL org.opencontainers.image.source https://github.com/jenkins-x/jx

# unzip
RUN apt-get install -y unzip bash jq && \
    rm -rf /var/lib/apt/lists/*

# terraform
ENV TERRAFORM 1.1.2
RUN curl -LO https://releases.hashicorp.com/terraform/${TERRAFORM}/terraform_${TERRAFORM}_linux_amd64.zip && \
  unzip terraform_${TERRAFORM}_linux_amd64.zip && \
  chmod +x terraform && mv terraform /usr/bin && rm terraform_${TERRAFORM}_linux_amd64.zip

# jx
RUN echo using jx version ${VERSION} and OS ${TARGETOS} arch ${TARGETARCH} && \
  mkdir -p /home/.jx3 && \
  curl -L https://github.com/jenkins-x/jx/releases/download/v${VERSION}/jx-${TARGETOS}-${TARGETARCH}.tar.gz | tar xzv && \
  mv jx /usr/bin

# lets install the boot plugins
RUN jx upgrade plugins --boot --path /usr/bin

# lets install the admin plugin
RUN jx admin help

COPY run.sh /run.sh
ENTRYPOINT ["/bin/bash"]
CMD ["run.sh"]
07070100000015000081A4000000000000000000000001683E350C00002C54000000000000000000000000000000000000001E00000000jenkins-x-cli-3.11.92/LICENSE                                 Apache License
                           Version 2.0, January 2004
                        http://www.apache.org/licenses/

   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

   1. Definitions.

      "License" shall mean the terms and conditions for use, reproduction,
      and distribution as defined by Sections 1 through 9 of this document.

      "Licensor" shall mean the copyright owner or entity authorized by
      the copyright owner that is granting the License.

      "Legal Entity" shall mean the union of the acting entity and all
      other entities that control, are controlled by, or are under common
      control with that entity. For the purposes of this definition,
      "control" means (i) the power, direct or indirect, to cause the
      direction or management of such entity, whether by contract or
      otherwise, or (ii) ownership of fifty percent (50%) or more of the
      outstanding shares, or (iii) beneficial ownership of such entity.

      "You" (or "Your") shall mean an individual or Legal Entity
      exercising permissions granted by this License.

      "Source" form shall mean the preferred form for making modifications,
      including but not limited to software source code, documentation
      source, and configuration files.

      "Object" form shall mean any form resulting from mechanical
      transformation or translation of a Source form, including but
      not limited to compiled object code, generated documentation,
      and conversions to other media types.

      "Work" shall mean the work of authorship, whether in Source or
      Object form, made available under the License, as indicated by a
      copyright notice that is included in or attached to the work
      (an example is provided in the Appendix below).

      "Derivative Works" shall mean any work, whether in Source or Object
      form, that is based on (or derived from) the Work and for which the
      editorial revisions, annotations, elaborations, or other modifications
      represent, as a whole, an original work of authorship. For the purposes
      of this License, Derivative Works shall not include works that remain
      separable from, or merely link (or bind by name) to the interfaces of,
      the Work and Derivative Works thereof.

      "Contribution" shall mean any work of authorship, including
      the original version of the Work and any modifications or additions
      to that Work or Derivative Works thereof, that is intentionally
      submitted to Licensor for inclusion in the Work by the copyright owner
      or by an individual or Legal Entity authorized to submit on behalf of
      the copyright owner. For the purposes of this definition, "submitted"
      means any form of electronic, verbal, or written communication sent
      to the Licensor or its representatives, including but not limited to
      communication on electronic mailing lists, source code control systems,
      and issue tracking systems that are managed by, or on behalf of, the
      Licensor for the purpose of discussing and improving the Work, but
      excluding communication that is conspicuously marked or otherwise
      designated in writing by the copyright owner as "Not a Contribution."

      "Contributor" shall mean Licensor and any individual or Legal Entity
      on behalf of whom a Contribution has been received by Licensor and
      subsequently incorporated within the Work.

   2. Grant of Copyright License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      copyright license to reproduce, prepare Derivative Works of,
      publicly display, publicly perform, sublicense, and distribute the
      Work and such Derivative Works in Source or Object form.

   3. Grant of Patent License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      (except as stated in this section) patent license to make, have made,
      use, offer to sell, sell, import, and otherwise transfer the Work,
      where such license applies only to those patent claims licensable
      by such Contributor that are necessarily infringed by their
      Contribution(s) alone or by combination of their Contribution(s)
      with the Work to which such Contribution(s) was submitted. If You
      institute patent litigation against any entity (including a
      cross-claim or counterclaim in a lawsuit) alleging that the Work
      or a Contribution incorporated within the Work constitutes direct
      or contributory patent infringement, then any patent licenses
      granted to You under this License for that Work shall terminate
      as of the date such litigation is filed.

   4. Redistribution. You may reproduce and distribute copies of the
      Work or Derivative Works thereof in any medium, with or without
      modifications, and in Source or Object form, provided that You
      meet the following conditions:

      (a) You must give any other recipients of the Work or
          Derivative Works a copy of this License; and

      (b) You must cause any modified files to carry prominent notices
          stating that You changed the files; and

      (c) You must retain, in the Source form of any Derivative Works
          that You distribute, all copyright, patent, trademark, and
          attribution notices from the Source form of the Work,
          excluding those notices that do not pertain to any part of
          the Derivative Works; and

      (d) If the Work includes a "NOTICE" text file as part of its
          distribution, then any Derivative Works that You distribute must
          include a readable copy of the attribution notices contained
          within such NOTICE file, excluding those notices that do not
          pertain to any part of the Derivative Works, in at least one
          of the following places: within a NOTICE text file distributed
          as part of the Derivative Works; within the Source form or
          documentation, if provided along with the Derivative Works; or,
          within a display generated by the Derivative Works, if and
          wherever such third-party notices normally appear. The contents
          of the NOTICE file are for informational purposes only and
          do not modify the License. You may add Your own attribution
          notices within Derivative Works that You distribute, alongside
          or as an addendum to the NOTICE text from the Work, provided
          that such additional attribution notices cannot be construed
          as modifying the License.

      You may add Your own copyright statement to Your modifications and
      may provide additional or different license terms and conditions
      for use, reproduction, or distribution of Your modifications, or
      for any such Derivative Works as a whole, provided Your use,
      reproduction, and distribution of the Work otherwise complies with
      the conditions stated in this License.

   5. Submission of Contributions. Unless You explicitly state otherwise,
      any Contribution intentionally submitted for inclusion in the Work
      by You to the Licensor shall be under the terms and conditions of
      this License, without any additional terms or conditions.
      Notwithstanding the above, nothing herein shall supersede or modify
      the terms of any separate license agreement you may have executed
      with Licensor regarding such Contributions.

   6. Trademarks. This License does not grant permission to use the trade
      names, trademarks, service marks, or product names of the Licensor,
      except as required for reasonable and customary use in describing the
      origin of the Work and reproducing the content of the NOTICE file.

   7. Disclaimer of Warranty. Unless required by applicable law or
      agreed to in writing, Licensor provides the Work (and each
      Contributor provides its Contributions) on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
      implied, including, without limitation, any warranties or conditions
      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
      PARTICULAR PURPOSE. You are solely responsible for determining the
      appropriateness of using or redistributing the Work and assume any
      risks associated with Your exercise of permissions under this License.

   8. Limitation of Liability. In no event and under no legal theory,
      whether in tort (including negligence), contract, or otherwise,
      unless required by applicable law (such as deliberate and grossly
      negligent acts) or agreed to in writing, shall any Contributor be
      liable to You for damages, including any direct, indirect, special,
      incidental, or consequential damages of any character arising as a
      result of this License or out of the use or inability to use the
      Work (including but not limited to damages for loss of goodwill,
      work stoppage, computer failure or malfunction, or any and all
      other commercial damages or losses), even if such Contributor
      has been advised of the possibility of such damages.

   9. Accepting Warranty or Additional Liability. While redistributing
      the Work or Derivative Works thereof, You may choose to offer,
      and charge a fee for, acceptance of support, warranty, indemnity,
      or other liability obligations and/or rights consistent with this
      License. However, in accepting such obligations, You may act only
      on Your own behalf and on Your sole responsibility, not on behalf
      of any other Contributor, and only if You agree to indemnify,
      defend, and hold each Contributor harmless for any liability
      incurred by, or claims asserted against, such Contributor by reason
      of your accepting any such warranty or additional liability.

   END OF TERMS AND CONDITIONS

   APPENDIX: How to apply the Apache License to your work.

      To apply the Apache License to your work, attach the following
      boilerplate notice, with the fields enclosed by brackets "[]"
      replaced with your own identifying information. (Don't include
      the brackets!)  The text should be enclosed in the appropriate
      comment syntax for the file format. We also recommend that a
      file or class name and description of purpose be included on the
      same "printed page" as the copyright notice for easier
      identification within third-party archives.

   Copyright [2018] [Jenkins X Team]

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
07070100000016000081A4000000000000000000000001683E350C000018E4000000000000000000000000000000000000001F00000000jenkins-x-cli-3.11.92/Makefile# Make does not offer a recursive wildcard function, so here's one:
rwildcard=$(wildcard $1$2) $(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2))

SHELL := /bin/sh
NAME := jx
BINARY_NAME := jx
BUILD_TARGET = build
MAIN_SRC_FILE=cmd/main.go
GO := GO111MODULE=on go
GO_NOMOD :=GO111MODULE=off go
REV := $(shell git rev-parse --short HEAD 2> /dev/null || echo 'unknown')
ORG := jenkins-x
ORG_REPO := $(ORG)/$(NAME)
RELEASE_ORG_REPO := $(ORG_REPO)
ROOT_PACKAGE := github.com/$(ORG_REPO)

# The go version is derived from the image built by this repo: https://github.com/jenkins-x/jx-goreleaser-image
GO_VERSION := $(shell $(GO) version | sed -e 's/^[^0-9.]*\([0-9.]*\).*/\1/')
GO_DEPENDENCIES := $(call rwildcard,pkg/,*.go) $(call rwildcard,cmd/,*.go)

GIT_TREE_STATE := $(shell test -z "`git status --porcelain`" && echo "clean" || echo "dirty")
BRANCH     := $(shell git rev-parse --abbrev-ref HEAD 2> /dev/null  || echo 'unknown')
BUILD_DATE := $(shell date -u +%Y-%m-%dT%H:%M:%S)
CGO_ENABLED = 0

REPORTS_DIR=$(BUILD_TARGET)/reports

GOTEST := $(GO) test

# set dev version unless VERSION is explicitly set via environment
VERSION ?= $(shell echo "$$(git for-each-ref refs/tags/ --count=1 --sort=-version:refname --format='%(refname:short)' 2>/dev/null)-dev+$(REV)" | sed 's/^v//')

# Build flags for setting build-specific configuration at build time - defaults to empty
#BUILD_TIME_CONFIG_FLAGS ?= ""

# Full build flags used when building binaries. Not used for test compilation/execution.
BUILDFLAGS :=  -ldflags \
  " -X $(ROOT_PACKAGE)/pkg/cmd/version.Version=$(VERSION)\
		-X $(ROOT_PACKAGE)/pkg/cmd/version.Revision=$(REV)\
		-X $(ROOT_PACKAGE)/pkg/cmd/version.Branch=$(BRANCH)\
		-X $(ROOT_PACKAGE)/pkg/cmd/version.GitTreeState=$(GIT_TREE_STATE)\
		-X $(ROOT_PACKAGE)/pkg/cmd/version.BuildDate=$(BUILD_DATE)\
		-X $(ROOT_PACKAGE)/pkg/cmd/version.GoVersion=$(GO_VERSION)\
		$(BUILD_TIME_CONFIG_FLAGS)"

# Some tests expect default values for version.*, so just use the config package values there.
TEST_BUILDFLAGS :=  -ldflags "$(BUILD_TIME_CONFIG_FLAGS)"

ifdef DEBUG
BUILDFLAGS := -gcflags "all=-N -l" $(BUILDFLAGS)
endif

ifdef PARALLEL_BUILDS
BUILDFLAGS += -p $(PARALLEL_BUILDS)
GOTEST += -p $(PARALLEL_BUILDS)
else
# -p 4 seems to work well for people
GOTEST += -p 4
endif

ifdef DISABLE_TEST_CACHING
GOTEST += -count=1
endif

TEST_PACKAGE ?= ./...
COVER_OUT:=$(REPORTS_DIR)/cover.txt
COVERFLAGS=-coverprofile=$(COVER_OUT) --covermode=atomic --coverpkg=./pkg/...

.PHONY: list
list: ## List all make targets
	@$(MAKE) -pRrn : -f $(MAKEFILE_LIST) 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | egrep -v -e '^[^[:alnum:]]' -e '^$@$$' | sort

.PHONY: help
.DEFAULT_GOAL := help
help:
	@grep -h -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

full: check ## Build and run the tests
check: build test ## Build and run the tests

print-version: ## Print version
	@echo $(VERSION)

build: $(GO_DEPENDENCIES) clean ## Build jx binary for current OS
	go mod download
	CGO_ENABLED=$(CGO_ENABLED) $(GO) $(BUILD_TARGET) $(BUILDFLAGS) -o build/$(BINARY_NAME) $(MAIN_SRC_FILE)

build-all: $(GO_DEPENDENCIES) build make-reports-dir ## Build all files - runtime, all tests etc.
	CGO_ENABLED=$(CGO_ENABLED) $(GOTEST) -run=nope -tags=integration -failfast -short ./... $(BUILDFLAGS)

tidy-deps: ## Cleans up dependencies
	$(GO) mod tidy
	# mod tidy only takes compile dependencies into account, let's make sure we capture tooling dependencies as well
	@$(MAKE) install-generate-deps

.PHONY: make-reports-dir
make-reports-dir:
	mkdir -p $(REPORTS_DIR)

test: ## Run tests with the "unit" build tag
	KUBECONFIG=/cluster/connections/not/allowed JX3_HOME=/tmp/jx3 CGO_ENABLED=$(CGO_ENABLED) $(GOTEST) --tags=unit -failfast -short ./... $(TEST_BUILDFLAGS)

test-coverage : make-reports-dir ## Run tests and coverage for all tests with the "unit" build tag
	CGO_ENABLED=$(CGO_ENABLED) $(GOTEST) --tags=unit $(COVERFLAGS) -failfast -short ./... $(TEST_BUILDFLAGS)

test-report-html: make-reports-dir test-coverage
	$(GO) tool cover -html=$(COVER_OUT)

test-total-cov: make-reports-dir test-coverage
	$(GO) tool cover -func=$(COVER_OUT)

install: $(GO_DEPENDENCIES) ## Install the binary
	GOBIN=${GOPATH}/bin $(GO) install $(BUILDFLAGS) $(MAIN_SRC_FILE)

linux: ## Build for Linux
	CGO_ENABLED=$(CGO_ENABLED) GOOS=linux GOARCH=amd64 $(GO) $(BUILD_TARGET) $(BUILDFLAGS) -o build/linux/$(BINARY_NAME) $(MAIN_SRC_FILE)
	chmod +x build/linux/$(BINARY_NAME)

arm: ## Build for ARM
	CGO_ENABLED=$(CGO_ENABLED) GOOS=linux GOARCH=arm $(GO) $(BUILD_TARGET) $(BUILDFLAGS) -o build/arm/$(BINARY_NAME) $(MAIN_SRC_FILE)
	chmod +x build/arm/$(BINARY_NAME)

win: ## Build for Windows
	CGO_ENABLED=$(CGO_ENABLED) GOOS=windows GOARCH=amd64 $(GO) $(BUILD_TARGET) $(BUILDFLAGS) -o build/win/$(BINARY_NAME)-windows-amd64.exe $(MAIN_SRC_FILE)

darwin: ## Build for OSX
	CGO_ENABLED=$(CGO_ENABLED) GOOS=darwin GOARCH=amd64 $(GO) $(BUILD_TARGET) $(BUILDFLAGS) -o build/darwin/$(BINARY_NAME) $(MAIN_SRC_FILE)
	chmod +x build/darwin/$(BINARY_NAME)

.PHONY: release
release: clean linux test

release-all: release linux win darwin

.PHONY: goreleaser
goreleaser:
	step-go-releaser --organisation=$(ORG) --revision=$(REV) --branch=$(BRANCH) --build-date=$(BUILD_DATE) --go-version=$(GO_VERSION) --root-package=$(ROOT_PACKAGE) --version=$(VERSION)

.PHONY: clean
clean: ## Clean the generated artifacts
	rm -rf build release dist

get-fmt-deps: ## Install test dependencies
	$(GO_NOMOD) install golang.org/x/tools/cmd/goimports

.PHONY: fmt
fmt: importfmt ## Format the code
	$(eval FORMATTED = $(shell $(GO) fmt ./...))
	@if [ "$(FORMATTED)" == "" ]; \
      	then \
      	    echo "All Go files properly formatted"; \
      	else \
      		echo "Fixed formatting for: $(FORMATTED)"; \
      	fi

.PHONY: importfmt
importfmt: get-fmt-deps
	@echo "Formatting the imports..."
	goimports -w $(GO_DEPENDENCIES)

.PHONY: lint
lint: ## Lint the code
	./hack/gofmt.sh
	./hack/linter.sh
	./hack/generate.sh

.PHONY: all
all: fmt build test lint

bin/docs:
	go build $(LDFLAGS) -v -o bin/docs cmd/docs/*.go

.PHONY: docs
docs: bin/docs ## update docs
	@echo "Generating docs"
	@./bin/docs --target=./docs/cmd
	@./bin/docs --target=./docs/man/man1 --kind=man
	@rm -f ./bin/docs07070100000017000081A4000000000000000000000001683E350C00000092000000000000000000000000000000000000001D00000000jenkins-x-cli-3.11.92/OWNERSapprovers:
- rawlingsj
- jstrachan
- rajdavies
- ankitm123
- maintainers
reviewers:
- rawlingsj
- jstrachan
- rajdavies
- ankitm123
- maintainers
07070100000018000081A4000000000000000000000001683E350C00000025000000000000000000000000000000000000002500000000jenkins-x-cli-3.11.92/OWNERS_ALIASESforeignAliases:
- name: jx-community
07070100000019000081A4000000000000000000000001683E350C00000B6E000000000000000000000000000000000000002000000000jenkins-x-cli-3.11.92/README.md# Jenkins X CLI

[![Documentation](https://godoc.org/github.com/jenkins-x/jx?status.svg)](https://pkg.go.dev/mod/github.com/jenkins-x/jx)
[![Go Report Card](https://goreportcard.com/badge/github.com/jenkins-x/jx)](https://goreportcard.com/report/github.com/jenkins-x/jx)
[![Releases](https://img.shields.io/github/release-pre/jenkins-x/jx.svg)](https://github.com/jenkins-x/jx/releases)
[![LICENSE](https://img.shields.io/github/license/jenkins-x/jx.svg)](https://github.com/jenkins-x/jx/blob/master/LICENSE)
[![Slack Status](https://img.shields.io/badge/slack-join_chat-white.svg?logo=slack&style=social)](https://slack.k8s.io/)
[![codecov](https://codecov.io/gh/jenkins-x/jx/branch/main/graph/badge.svg?token=aBT7eQHx37)](https://codecov.io/gh/jenkins-x/jx)

`jx` is the modular command line CLI for [Jenkins X 3.x](https://jenkins-x.io/v3/about/)

## Commands

See the [jx command reference](https://jenkins-x.io/v3/develop/reference/jx/)

## Issues

To track [issues in this repository](https://github.com/jenkins-x/jx/issues) and all the related [Plugins](#plugins) use these links:

* [view open issues in jenkins-x-plugins](https://github.com/issues?q=is%3Aopen+is%3Aissue+author%3Ajstrachan+archived%3Afalse+user%3Ajenkins-x-plugins)
* [view open pull requests in jenkins-x-plugins](https://github.com/pulls?q=is%3Aopen+is%3Apr+archived%3Afalse+user%3Ajenkins-x-plugins+-label%3Adependencies)

## Plugins

You can browse the documentation for all of the `jx`  plugins at:

* [Plugin CLI Reference](https://jenkins-x.io/v3/develop/reference/jx/)
* [Plugin Source](https://github.com/jenkins-x-plugins)


## Components

* [jx-git-operator](https://github.com/jenkins-x/jx-git-operator) is an operator for triggering jobs when git commits are made
* [octant-jx](https://github.com/jenkins-x/octant-jx) an open source Jenkins X UI for  [vmware-tanzu/octant](https://github.com/vmware-tanzu/octant)

## Libraries

These are the modular libraries which have been refactored out of the main [jenkins-x/jx](https://github.com/jenkins-x/jx) repository as part of the [modularisation enhancement process](https://github.com/jenkins-x/enhancements/tree/master/proposals/5#1-overview)
       
* [go-scm](https://github.com/jenkins-x/go-scm) API for working with SCM providers
* [jx-api](https://github.com/jenkins-x/jx-api) the core JX APIs
* [jx-helpers](https://github.com/jenkins-x/jx-helpers) a bunch of utilities (mostly from the `util` package) refactored + no longer dependent on [jenkins-x/jx](https://github.com/jenkins-x/jx/) 
* [jx-kube-client](https://github.com/jenkins-x/jx-kube-client) the core library for working with kube/jx/tekton clients
* [jx-logging](https://github.com/jenkins-x/jx-logging) logging APIs
* [lighthouse-client](https://github.com/jenkins-x/lighthouse-client) client library for working with [lighthouse](https://github.com/jenkins-x/lighthouse)
     
                                        
0707010000001A000081A4000000000000000000000001683E350C000005A0000000000000000000000000000000000000002200000000jenkins-x-cli-3.11.92/SECURITY.md# Security Policy

The Jenkins X project takes security seriously. We make every possible effort to ensure users can adequately secure their automation infrastructure. To that end, we work with Jenkins X platform and app developers, as well as security researchers, to fix security vulnerabilities in Jenkins X in a timely manner, and to improve the security of Jenkins X in general.

## Supported Versions

| Version | Supported          |
| ------- | ------------------ |
| 2.0.x   | :white_check_mark: |


## Reporting a Vulnerability

If you find a vulnerability in Jenkins X, please report it in the Jenkins CI issue tracker under the [SECURITY](https://issues.jenkins-ci.org/browse/SECURITY) project. **Please do not report security issues in the github tracker.**
This project is configured in such a way that only the reporter and the security team can see the details. By restricting access to this potentially sensitive information, we can work on a fix and deliver it before the method of attack becomes well-known.

If you are unable to report using the above issue tracker, you can also send your report to the private Jenkins Security Team mailing list: jenkinsci-cert@googlegroups.com

## Vulnerabilities in Apps

Whilst the Jenkins X team is not responsible for the quality of third party apps, please still use the above reporting mechanism and we will co-ordinate with the app developer to ensure a fix in a secure maner.
0707010000001B000081ED000000000000000000000001683E350C00000153000000000000000000000000000000000000001F00000000jenkins-x-cli-3.11.92/build.sh#!/bin/sh

if [ -z "$GCP_SA" ]
then
  echo "no GCP SA specified"
else
  echo "enabling GCP Service Account from $GCP_SA"
  gcloud auth activate-service-account --key-file $GCP_SA
fi


echo "building container image version: $VERSION"

gcloud builds submit --config cloudbuild.yaml --project jenkinsxio --substitutions=_VERSION="$VERSION"

0707010000001C000041ED000000000000000000000002683E350C00000000000000000000000000000000000000000000001D00000000jenkins-x-cli-3.11.92/charts0707010000001D000041ED000000000000000000000002683E350C00000000000000000000000000000000000000000000002400000000jenkins-x-cli-3.11.92/charts/jx-cli0707010000001E000081A4000000000000000000000001683E350C0000015B000000000000000000000000000000000000003000000000jenkins-x-cli-3.11.92/charts/jx-cli/.helmignore# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
# Various IDEs
.project
.idea/
*.tmproj
*.png
Makefile0707010000001F000081A4000000000000000000000001683E350C00000151000000000000000000000000000000000000002F00000000jenkins-x-cli-3.11.92/charts/jx-cli/Chart.yamlapiVersion: v2
name: jx
description: Jenkins X next gen cloud CI / CD platform for Kubernetes
home: https://jenkins-x.io/
version: 0.0.1
appVersion: 3.0.0
icon: https://jenkins-x.github.io/jenkins-x-website/img/profile.png
sources:
- https://github.com/jenkins-x/jx
maintainers:
- name: Jenkins X Team
  email: jenkins-x@googlegroups.com07070100000020000081A4000000000000000000000001683E350C0000020C000000000000000000000000000000000000002D00000000jenkins-x-cli-3.11.92/charts/jx-cli/MakefileCHART_REPO := gs://jenkinsxio/charts
NAME := jx

build: clean
	rm -rf Chart.lock
	helm dependency build
	helm lint

install: clean build
	helm install . --name ${NAME}

upgrade: clean build
	helm upgrade ${NAME} .

delete:
	helm delete --purge ${NAME}

clean:
	rm -rf charts
	rm -rf ${NAME}*.tgz

release: clean
	sed -i -e "s/version:.*/version: $(VERSION)/" Chart.yaml

	helm dependency build
	helm lint
	helm package .
	helm repo add jx-labs $(CHART_REPO)
	helm gcs push ${NAME}*.tgz jx-labs --public
	rm -rf ${NAME}*.tgz%07070100000021000041ED000000000000000000000002683E350C00000000000000000000000000000000000000000000002E00000000jenkins-x-cli-3.11.92/charts/jx-cli/templates07070100000022000081A4000000000000000000000001683E350C00000001000000000000000000000000000000000000003800000000jenkins-x-cli-3.11.92/charts/jx-cli/templates/NOTES.txt
07070100000023000081A4000000000000000000000001683E350C00000394000000000000000000000000000000000000003B00000000jenkins-x-cli-3.11.92/charts/jx-cli/templates/_helpers.tpl{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "jx.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "jx.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
07070100000024000081A4000000000000000000000001683E350C0000011F000000000000000000000000000000000000003F00000000jenkins-x-cli-3.11.92/charts/jx-cli/templates/clusterrole.yaml{{- if .Values.clusterrole.enabled -}}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: {{ template "jx.fullname" . }}-{{ .Release.Namespace }}
{{ if .Values.clusterrole.rules -}}
rules:
{{ toYaml .Values.clusterrole.rules | indent 0 }}
{{- end }}
{{- end }}
07070100000025000081A4000000000000000000000001683E350C0000027C000000000000000000000000000000000000004600000000jenkins-x-cli-3.11.92/charts/jx-cli/templates/clusterrolebinding.yaml{{- if .Values.clusterrole.enabled -}}
{{- if .Values.serviceaccount.enabled -}}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: {{ template "jx.fullname" . }}-{{ .Release.Namespace }}
  namespace: {{ .Release.Namespace }}
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: {{ template "jx.fullname" . }}-{{ .Release.Namespace }}
subjects:
- kind: ServiceAccount
{{- if .Values.serviceaccount.customName }}
  name: {{ .Values.serviceaccount.customName }}
{{- else }}
  name: {{ template "jx.fullname" . }}
{{- end }}
  namespace: {{ .Release.Namespace }}
{{- end }}
{{- end }}07070100000026000081A4000000000000000000000001683E350C000008BB000000000000000000000000000000000000003B00000000jenkins-x-cli-3.11.92/charts/jx-cli/templates/cronjob.yaml{{- if .Values.cronjob.enabled -}}
apiVersion: batch/v1
kind: CronJob
metadata:
  name: {{ template "jx.fullname" . }}
  labels:
    app: {{ template "jx.fullname" . }}
    chart: {{ template "jx.chart" . }}
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}
spec:
  concurrencyPolicy: {{ .Values.cronjob.concurrencyPolicy }}
  failedJobsHistoryLimit: {{ .Values.cronjob.failedJobsHistoryLimit }}
  successfulJobsHistoryLimit: {{ .Values.cronjob.successfulJobsHistoryLimit }}
  schedule: {{ .Values.cronjob.schedule | quote }}
  jobTemplate:
    spec:
      template:
        metadata:
          labels:
            app: {{ template "jx.fullname" . }}
            release: {{ .Release.Name }}
    {{- if .Values.podAnnotations }}
          annotations:
{{ toYaml .Values.podAnnotations | indent 12 }}
    {{- end }}
        spec:
    {{- if .Values.restartPolicy }}
          restartPolicy: {{ .Values.restartPolicy }}
    {{- end }}
    {{- if .Values.serviceaccount.customName }}
          serviceAccountName: {{ .Values.serviceaccount.customName }}
    {{- else if .Values.serviceaccount.enabled }}
          serviceAccountName: {{ template "jx.fullname" . }}
    {{- end }}
          containers:
            - name: {{ .Chart.Name }}
              {{ if .Values.command -}}
              command: {{ .Values.command }}
              {{- end }}
              {{ if .Values.args -}}
              args:
{{ toYaml .Values.args | indent 14 }}
              {{- end }}
              imagePullPolicy: {{ .Values.image.pullPolicy }}
              image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
    {{- if .Values.env }}
              env:
    {{- range $pkey, $pval := .Values.env }}
              - name: {{ $pkey }}
                value: {{ $pval }}
    {{- end }}
    {{- end }}
              resources:
    {{ toYaml .Values.resources | indent 12 }}
        {{- with .Values.nodeSelector }}
          nodeSelector:
    {{ toYaml . | indent 8 }}
        {{- end }}
        {{- with .Values.affinity }}
          affinity:
    {{ toYaml . | indent 8 }}
        {{- end }}
        {{- with .Values.tolerations }}
          tolerations:
    {{ toYaml . | indent 8 }}
        {{- end }}
    {{- end }}
07070100000027000081A4000000000000000000000001683E350C00000832000000000000000000000000000000000000003D00000000jenkins-x-cli-3.11.92/charts/jx-cli/templates/daemonset.yaml{{- if .Values.daemonset.enabled -}}
apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: {{ template "jx.fullname" . }}
  labels:
    app: {{ template "jx.fullname" . }}
    chart: {{ template "jx.chart" . }}
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}
spec:
  backoffLimit: {{ .Values.backoffLimit }}
  activeDeadlineSeconds: {{ .Values.activeDeadlineSeconds }}
  selector:
    matchLabels:
      app: {{ template "jx.fullname" . }}
      release: {{ .Release.Name }}
  template:
    metadata:
      labels:
        app: {{ template "jx.fullname" . }}
        release: {{ .Release.Name }}
{{- if .Values.podAnnotations }}
      annotations:
{{ toYaml .Values.podAnnotations | indent 8 }}
{{- end }}
    spec:
{{- if .Values.restartPolicy }}
      restartPolicy: {{ .Values.restartPolicy }}
{{- end }}
      containers:
        - name: {{ .Chart.Name }}
          {{ if .Values.command -}}
          command: {{ .Values.command }}
          {{- end }}
          {{ if .Values.args -}}
          args:
{{ toYaml .Values.args | indent 10 }}
          {{- end }}
          imagePullPolicy: {{ .Values.image.pullPolicy }}
          image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
          ports:
            - name: http
              containerPort: {{ .Values.internalPort }}
              protocol: TCP
          livenessProbe:
            httpGet:
              path: {{ .Values.probe.path }}
              port: http
          readinessProbe:
            httpGet:
              path: {{ .Values.probe.path }}
              port: http
{{- if .Values.env }}
          env:
{{- range $pkey, $pval := .Values.env }}
          - name: {{ $pkey }}
            value: {{ $pval }}
{{- end }}
{{- end }}
          resources:
{{ toYaml .Values.resources | indent 12 }}
    {{- with .Values.nodeSelector }}
      nodeSelector:
{{ toYaml . | indent 8 }}
    {{- end }}
    {{- with .Values.affinity }}
      affinity:
{{ toYaml . | indent 8 }}
    {{- end }}
    {{- with .Values.tolerations }}
      tolerations:
{{ toYaml . | indent 8 }}
    {{- end }}
{{- end }}07070100000028000081A4000000000000000000000001683E350C000008D5000000000000000000000000000000000000003E00000000jenkins-x-cli-3.11.92/charts/jx-cli/templates/deployment.yaml{{- if .Values.deployment.enabled -}}
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ template "jx.fullname" . }}
  labels:
    app: {{ template "jx.fullname" . }}
    chart: {{ template "jx.chart" . }}
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}
spec:
  selector:
    matchLabels:
      app: {{ template "jx.fullname" . }}
      release: {{ .Release.Name }}
  template:
    metadata:
      labels:
        app: {{ template "jx.fullname" . }}
        release: {{ .Release.Name }}
{{- if .Values.podAnnotations }}
      annotations:
{{ toYaml .Values.podAnnotations | indent 8 }}
{{- end }}
    spec:
{{- if .Values.restartPolicy }}
      restartPolicy: {{ .Values.restartPolicy }}
{{- end }}
{{- if .Values.serviceaccount.customName }}
      serviceAccountName: {{ .Values.serviceaccount.customName }}
{{- else if .Values.serviceaccount.enabled }}
      serviceAccountName: {{ template "jx.fullname" . }}
{{- end }}
      containers:
        - name: {{ .Chart.Name }}
          {{ if .Values.command -}}
          command: {{ .Values.command }}
          {{- end }}
          {{ if .Values.args -}}
          args:
{{ toYaml .Values.args | indent 10 }}
          {{- end }}
          imagePullPolicy: {{ .Values.image.pullPolicy }}
          image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
          ports:
            - name: http
              containerPort: {{ .Values.internalPort }}
              protocol: TCP
{{- if .Values.probe.path }}
          livenessProbe:
            httpGet:
              path: {{ .Values.probe.path }}
              port: http
          readinessProbe:
            httpGet:
              path: {{ .Values.probe.path }}
              port: http
{{- end }}
{{- if .Values.env }}
          env:
{{- range $pkey, $pval := .Values.env }}
          - name: {{ $pkey }}
            value: {{ $pval }}
{{- end }}
{{- end }}
          resources:
{{ toYaml .Values.resources | indent 12 }}
    {{- with .Values.nodeSelector }}
      nodeSelector:
{{ toYaml . | indent 8 }}
    {{- end }}
    {{- with .Values.affinity }}
      affinity:
{{ toYaml . | indent 8 }}
    {{- end }}
    {{- with .Values.tolerations }}
      tolerations:
{{ toYaml . | indent 8 }}
    {{- end }}
{{- end }}
07070100000029000081A4000000000000000000000001683E350C00000931000000000000000000000000000000000000003700000000jenkins-x-cli-3.11.92/charts/jx-cli/templates/job.yaml{{- if .Values.job.enabled -}}
apiVersion: batch/v1
kind: Job
metadata:
  name: {{ template "jx.fullname" . }}
  labels:
    app: {{ template "jx.fullname" . }}
    chart: {{ template "jx.chart" . }}
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}
{{- if .Values.job.annotations }}
  annotations:
{{ toYaml .Values.job.annotations | indent 4 }}
{{- end }}
spec:
  backoffLimit: {{ .Values.backoffLimit }}
  activeDeadlineSeconds: {{ .Values.activeDeadlineSeconds }}
  template:
    metadata:
      labels:
        app: {{ template "jx.fullname" . }}
        release: {{ .Release.Name }}
{{- if .Values.podAnnotations }}
      annotations:
{{ toYaml .Values.podAnnotations | indent 8 }}
{{- end }}
    spec:
{{- if .Values.restartPolicy }}
      restartPolicy: {{ .Values.restartPolicy }}
{{- end }}
{{- if .Values.serviceaccount.customName }}
      serviceAccountName: {{ .Values.serviceaccount.customName }}
{{- else if .Values.serviceaccount.enabled }}
      serviceAccountName: {{ template "jx.fullname" . }}
{{- end }}
      containers:
        - name: {{ .Chart.Name }}
          {{ if .Values.command -}}
          command: {{ .Values.command }}
          {{- end }}
          {{ if .Values.args -}}
          args:
{{ toYaml .Values.args | indent 10 }}
          {{- end }}
          imagePullPolicy: {{ .Values.image.pullPolicy }}
          image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
          ports:
            - name: http
              containerPort: {{ .Values.internalPort }}
              protocol: TCP
{{- if .Values.probe.path }}
          livenessProbe:
            httpGet:
              path: {{ .Values.probe.path }}
              port: http
          readinessProbe:
            httpGet:
              path: {{ .Values.probe.path }}
              port: http
{{- end }}
{{- if .Values.env }}
          env:
{{- range $pkey, $pval := .Values.env }}
          - name: {{ $pkey }}
            value: {{ $pval }}
{{- end }}
{{- end }}
          resources:
{{ toYaml .Values.resources | indent 12 }}
    {{- with .Values.nodeSelector }}
      nodeSelector:
{{ toYaml . | indent 8 }}
    {{- end }}
    {{- with .Values.affinity }}
      affinity:
{{ toYaml . | indent 8 }}
    {{- end }}
    {{- with .Values.tolerations }}
      tolerations:
{{ toYaml . | indent 8 }}
    {{- end }}
{{- end }}0707010000002A000081A4000000000000000000000001683E350C0000024B000000000000000000000000000000000000003800000000jenkins-x-cli-3.11.92/charts/jx-cli/templates/role.yaml{{- if .Values.role.enabled -}}
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: {{ template "jx.fullname" . }}
{{ if .Values.role.rules -}}
rules:
{{ toYaml .Values.role.rules | indent 0 }}
{{- end }}

{{- if .Values.role.additionalNamespaces }}
{{- $ctx := . -}}
{{- range .Values.role.additionalNamespaces }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: {{ template "jx.fullname" $ctx }}
  namespace: {{ . }}
{{ if $.Values.role.rules -}}
rules:
{{ toYaml $.Values.role.rules | indent 0 }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
0707010000002B000081A4000000000000000000000001683E350C00000498000000000000000000000000000000000000003F00000000jenkins-x-cli-3.11.92/charts/jx-cli/templates/rolebinding.yaml{{- if .Values.role.enabled -}}
{{- if .Values.serviceaccount.enabled -}}
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: {{ template "jx.fullname" . }}
  namespace: {{ .Release.Namespace }}
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: {{ template "jx.fullname" . }}
subjects:
- kind: ServiceAccount
{{- if .Values.serviceaccount.customName }}
  name: {{ .Values.serviceaccount.customName }}
{{- else }}
  name: {{ template "jx.fullname" . }}
{{- end }}
  namespace: {{ .Release.Namespace }}

{{- if .Values.role.additionalNamespaces }}
{{- $ctx := . -}}
{{- range .Values.role.additionalNamespaces }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: {{ template "jx.fullname" $ctx }}
  namespace: {{ . }}
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: {{ template "jx.fullname" $ctx }}
subjects:
  - kind: ServiceAccount
{{- if $.Values.serviceaccount.customName }}
    name: {{ $.Values.serviceaccount.customName }}
{{- else }}
    name: {{ template "jx.fullname" $ctx }}
{{- end }}
    namespace: {{ $.Release.Namespace }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}

0707010000002C000081A4000000000000000000000001683E350C00000286000000000000000000000000000000000000003B00000000jenkins-x-cli-3.11.92/charts/jx-cli/templates/service.yaml{{- if .Values.service.enabled -}}
apiVersion: v1
kind: Service
metadata:
  name: {{ template "jx.fullname" . }}
  labels:
    app: {{ template "jx.fullname" . }}
    chart: {{ template "jx.chart" . }}
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}
{{- if .Values.service.serviceAnnotations }}
  annotations:
{{ toYaml .Values.service.serviceAnnotations | indent 4 }}
{{- end }}
spec:
  type: {{ .Values.service.type }}
  ports:
    - port: {{ .Values.service.port }}
      targetPort: http
      protocol: TCP
      name: http
  selector:
    app: {{ template "jx.fullname" . }}
    release: {{ .Release.Name }}
{{- end }}0707010000002D000081A4000000000000000000000001683E350C0000021B000000000000000000000000000000000000004200000000jenkins-x-cli-3.11.92/charts/jx-cli/templates/serviceaccount.yaml{{- if .Values.serviceaccount.enabled -}}
apiVersion: v1
kind: ServiceAccount
metadata:
{{- if .Values.serviceaccount.customName }}
  name: {{ .Values.serviceaccount.customName }}
{{- else }}
  name: {{ template "jx.fullname" . }}
{{- end }}
  labels:
    app: {{ template "jx.fullname" . }}
    chart: {{ template "jx.chart" . }}
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}
  annotations:
    {{- range $key, $value := .Values.serviceaccount.annotations }}
    {{ $key }}: {{ $value }}
    {{- end }}
{{- end }}
0707010000002E000081A4000000000000000000000001683E350C00000932000000000000000000000000000000000000003000000000jenkins-x-cli-3.11.92/charts/jx-cli/values.yamlimage:
  repository: gcr.io/jenkinsxio/jx
  tag: 3.0.354
  pullPolicy: IfNotPresent

replicaCount: 1

deployment:
  enabled: false

service:
  enabled: false

daemonset:
  enabled: false

job:
  enabled: false

podAnnotations: {}

cronjob:
  enabled: false
  schedule: "* * * * *"
  failedJobsHistoryLimit: 1
  successfulJobsHistoryLimit: 3
  concurrencyPolicy: Forbid

serviceaccount:
  enabled: false
  customName: ""

role:
  enabled: false
# example:
#  rules:
#  - apiGroups:
#    - jenkins.io
#    resources:
#    - pipelineactivities
#    verbs:
#    - list
#    - delete
#  - apiGroups:
#    - ""
#    resources:
#    - secrets
#    - services
#    verbs:
#    - get
  # rules:
  # - apiGroups:
  #   - jenkins.io
  #   resources:
  #   - environments
  #   verbs:
  #   - list
  #   - delete
  # - apiGroups:
  #   - ""
  #   resources:
  #   - secrets
  #   verbs:
  #   - get
  #   - list
  # - apiGroups:
  #   - apiextensions.k8s.io
  #   resources:
  #   - customresourcedefinitions
  #   verbs:
  #   - create

clusterrole:
  enabled: false
  # rules:
  # - apiGroups:
  #   - apiextensions.k8s.io
  #   resources:
  #   - customresourcedefinitions
  #   verbs:
  #   - get
  # - apiGroups:
  #   - ""
  #   resources:
  #   - namespace
  #   verbs:
  #   - get
  #   - delete
  #   - list
  # - apiGroups:
  #   - ""
  #   resources:
  #   - deployments
  #   verbs:
  #   - get

activeDeadlineSeconds: 300
backoffLimit: 5

# default is Always but for Jobs use Never or OnFailure
restartPolicy: Never

command: ["jx"]
args:
  - "version"

env:
  # lets use JSON output in logs
  JX_LOG_FORMAT: json

  # lets set the logging level
  JX_LOG_LEVEL: info

  # lets mark this pod as being a CI/CD pipeline job so reuse the pipeline git user
  PIPELINE_KIND: dummy

internalPort: 80

probe:
  path: /

service:
  type: ClusterIP
  port: 80

resources: {}
  # We usually recommend not to specify default resources and to leave this as a conscious
  # choice for the user. This also increases chances charts run on environments with little
  # resources. If you do want to specify resources, uncomment the following
  # lines, adjust them as necessary, and remove the curly braces after 'resources:'.
  # limits:
  #  cpu: 100m
  #  memory: 128Mi
  # requests:
  #  cpu: 100m
  #  memory: 128Mi

nodeSelector: {}

tolerations: []

affinity: {}
0707010000002F000041ED000000000000000000000002683E350C00000000000000000000000000000000000000000000001A00000000jenkins-x-cli-3.11.92/cmd07070100000030000041ED000000000000000000000002683E350C00000000000000000000000000000000000000000000001E00000000jenkins-x-cli-3.11.92/cmd/app07070100000031000081A4000000000000000000000001683E350C00000545000000000000000000000000000000000000002A00000000jenkins-x-cli-3.11.92/cmd/app/main-win.go//go:build windows

package app

import (
	"os"
	"syscall"

	"github.com/jenkins-x/jx/pkg/cmd"
)

// Run runs the command, if args are not nil they will be set on the command
func Run(args []string) error {
	configureTerminalForAnsiEscapes()
	cmd := cmd.Main(args)
	if len(args) > 0 {
		args = args[1:]
		cmd.SetArgs(args)
	}
	return cmd.Execute()
}

const (
	// https://docs.microsoft.com/en-us/windows/console/setconsolemode
	enableProcessedOutput           = 0x1
	enableWrapAtEOLOutput           = 0x2
	enableVirtualTerminalProcessing = 0x4
)

// configureTerminalForAnsiEscapes enables the windows 10 console to translate ansi escape sequences
// requires windows 10 1511 or higher and fails gracefully on older versions (and prior releases like windows 7)
// https://docs.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences
func configureTerminalForAnsiEscapes() {

	kernel32 := syscall.NewLazyDLL("kernel32.dll")
	kern32SetConsoleMode := kernel32.NewProc("SetConsoleMode")

	// stderr
	handle := syscall.Handle(os.Stderr.Fd())
	kern32SetConsoleMode.Call(uintptr(handle), enableProcessedOutput|enableWrapAtEOLOutput|enableVirtualTerminalProcessing)

	// stdout
	handle = syscall.Handle(os.Stdout.Fd())
	kern32SetConsoleMode.Call(uintptr(handle), enableProcessedOutput|enableWrapAtEOLOutput|enableVirtualTerminalProcessing)
}
07070100000032000081A4000000000000000000000001683E350C0000013B000000000000000000000000000000000000002600000000jenkins-x-cli-3.11.92/cmd/app/main.go//nolint:gofmt,goimports
//go:build !windows

package app

import (
	"github.com/jenkins-x/jx/pkg/cmd"
)

// Run runs the command, if args are not nil they will be set on the command
func Run(args []string) error {
	c := cmd.Main(args)
	if args != nil {
		args = args[1:]
		c.SetArgs(args)
	}
	return c.Execute()
}
07070100000033000041ED000000000000000000000002683E350C00000000000000000000000000000000000000000000001F00000000jenkins-x-cli-3.11.92/cmd/docs07070100000034000081A4000000000000000000000001683E350C00000EB9000000000000000000000000000000000000002700000000jenkins-x-cli-3.11.92/cmd/docs/main.go// Copyright © 2019 The Tekton Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//	http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package main

import (
	"fmt"
	"log"
	"os"
	"path/filepath"
	"strings"

	"github.com/jenkins-x/jx/pkg/cmd"
	"github.com/spf13/cobra"
	"github.com/spf13/pflag"
)

const descriptionSourcePath = "docs/reference/cmd/"

func generateCliYaml(opts *options) error {
	root := cmd.Main(nil)
	disableFlagsInUseLine(root)
	source := filepath.Join(opts.source, descriptionSourcePath)
	if err := loadLongDescription(root, source); err != nil {
		return err
	}

	switch opts.kind {
	case "markdown":
		return GenMarkdownTree(root, opts.target)
	case "man":
		header := &GenManHeader{
			Section: "1",
		}
		return GenManTree(root, header, opts.target)
	default:
		return fmt.Errorf("invalid docs kind : %s", opts.kind)
	}
}

func disableFlagsInUseLine(cmd *cobra.Command) {
	visitAll(cmd, func(ccmd *cobra.Command) {
		// do not add a `[flags]` to the end of the usage line.
		ccmd.DisableFlagsInUseLine = true
	})
}

// visitAll will traverse all commands from the root.
// This is different from the VisitAll of cobra.Command where only parents
// are checked.
func visitAll(root *cobra.Command, fn func(*cobra.Command)) {
	for _, c := range root.Commands() {
		visitAll(c, fn)
	}
	fn(root)
}

func loadLongDescription(cmd *cobra.Command, path ...string) error {
	for _, c := range cmd.Commands() {
		if c.Name() == "" {
			continue
		}
		fullpath := filepath.Join(path[0], strings.Join(append(path[1:], c.Name()), "_")+".md")
		if c.HasSubCommands() {
			if err := loadLongDescription(c, path[0], c.Name()); err != nil {
				return err
			}
		}

		if _, err := os.Stat(fullpath); err != nil {
			log.Printf("WARN: %s does not exist, skipping\n", fullpath)
			continue
		}

		content, err := os.ReadFile(fullpath)
		if err != nil {
			return err
		}
		description, examples := parseMDContent(string(content))
		c.Long = description
		c.Example = examples
	}
	return nil
}

type options struct {
	source string
	target string
	kind   string
}

func parseArgs() (*options, error) {
	opts := &options{}
	cwd, _ := os.Getwd()
	flags := pflag.NewFlagSet(os.Args[0], pflag.ContinueOnError)
	flags.StringVar(&opts.source, "root", cwd, "Path to project root")
	flags.StringVar(&opts.target, "target", "/tmp", "Target path for generated yaml files")
	flags.StringVar(&opts.kind, "kind", "markdown", "Kind of docs to generate (supported: man, markdown)")
	err := flags.Parse(os.Args[1:])
	return opts, err
}

func parseMDContent(mdString string) (description, examples string) {
	parsedContent := strings.Split(mdString, "\n## ")
	for _, s := range parsedContent {
		if strings.Index(s, "Description") == 0 {
			description = strings.TrimSpace(strings.TrimPrefix(s, "Description"))
		}
		if strings.Index(s, "Examples") == 0 {
			examples = strings.TrimSpace(strings.TrimPrefix(s, "Examples"))
		}
	}
	return description, examples
}

func main() {
	opts, err := parseArgs()
	if err != nil {
		fmt.Fprintln(os.Stderr, err.Error())
	}
	if opts != nil {
		fmt.Printf("Project root: %s\n", opts.source)
		fmt.Printf("Generating yaml files into %s\n", opts.target)

		if err := generateCliYaml(opts); err != nil {
			fmt.Fprintf(os.Stderr, "Failed to generate yaml files: %s\n", err.Error())
		}
	}
}
07070100000035000081A4000000000000000000000001683E350C000019C4000000000000000000000000000000000000002B00000000jenkins-x-cli-3.11.92/cmd/docs/man_docs.go// Copyright © 2019 The Tekton Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package main

import (
	"bytes"
	"fmt"
	"io"
	"os"
	"path/filepath"
	"sort"
	"strings"

	"github.com/cpuguy83/go-md2man/md2man"
	"github.com/spf13/cobra"
	"github.com/spf13/pflag"
)

// GenManTree will generate a man page for this command and all descendants
// in the directory given. The header may be nil. This function may not work
// correctly if your command names have `-` in them. If you have `cmd` with two
// subcmds, `sub` and `sub-third`, and `sub` has a subcommand called `third`
// it is undefined which help output will be in the file `cmd-sub-third.1`.
func GenManTree(cmd *cobra.Command, header *GenManHeader, dir string) error {
	return GenManTreeFromOpts(cmd, GenManTreeOptions{
		Header:           header,
		Path:             dir,
		CommandSeparator: "-",
	})
}

// GenManTreeFromOpts generates a man page for the command and all descendants.
// The pages are written to the opts.Path directory.
func GenManTreeFromOpts(cmd *cobra.Command, opts GenManTreeOptions) error {
	header := opts.Header
	if header == nil {
		header = &GenManHeader{}
	}
	for _, c := range cmd.Commands() {
		if !c.IsAvailableCommand() || c.IsAdditionalHelpTopicCommand() {
			continue
		}
		if err := GenManTreeFromOpts(c, opts); err != nil {
			return err
		}
	}
	section := "1"
	if header.Section != "" {
		section = header.Section
	}

	separator := "_"
	if opts.CommandSeparator != "" {
		separator = opts.CommandSeparator
	}
	basename := strings.ReplaceAll(cmd.CommandPath(), " ", separator)
	filename := filepath.Join(opts.Path, basename+"."+section)
	f, err := os.Create(filename)
	if err != nil {
		return err
	}
	defer f.Close()

	headerCopy := *header
	return GenMan(cmd, &headerCopy, f)
}

// GenManTreeOptions is the options for generating the man pages.
// Used only in GenManTreeFromOpts.
type GenManTreeOptions struct {
	Header           *GenManHeader
	Path             string
	CommandSeparator string
}

// GenManHeader is a lot like the .TH header at the start of man pages. These
// include the title, section, source, and manual. We will use
// "Auto generated by spf13/cobra" if the Source is unset.
type GenManHeader struct {
	Title   string
	Section string
	Source  string
	Manual  string
}

// GenMan will generate a man page for the given command and write it to
// w. The header argument may be nil, however obviously w may not.
func GenMan(cmd *cobra.Command, header *GenManHeader, w io.Writer) error {
	if header == nil {
		header = &GenManHeader{}
	}
	if err := fillHeader(header, cmd.CommandPath()); err != nil {
		return err
	}

	b := genMan(cmd, header)
	_, err := w.Write(md2man.Render(b))
	return err
}

func fillHeader(header *GenManHeader, name string) error {
	if header.Title == "" {
		header.Title = strings.ToUpper(strings.ReplaceAll(name, " ", "\\-"))
	}
	if header.Section == "" {
		header.Section = "1"
	}
	if header.Source == "" {
		header.Source = "Auto generated by spf13/cobra"
	}
	return nil
}

func manPreamble(buf *bytes.Buffer, header *GenManHeader, cmd *cobra.Command, dashedName string) {
	description := cmd.Long
	if description == "" {
		description = cmd.Short
	}

	buf.WriteString(fmt.Sprintf(`%% %s(%s)
%% %s
%% %s
# NAME
`, header.Title, header.Section, header.Source, header.Manual))
	buf.WriteString(fmt.Sprintf("%s \\- %s\n\n", dashedName, cmd.Short))
	buf.WriteString("# SYNOPSIS\n")
	buf.WriteString(fmt.Sprintf("**%s**\n\n", cmd.UseLine()))
	buf.WriteString("# DESCRIPTION\n")
	buf.WriteString(description + "\n\n")
}

func manPrintFlags(buf *bytes.Buffer, flags *pflag.FlagSet) {
	flags.VisitAll(func(flag *pflag.Flag) {
		if len(flag.Deprecated) > 0 || flag.Hidden {
			return
		}
		format := ""
		if len(flag.Shorthand) > 0 && flag.ShorthandDeprecated == "" {
			format = fmt.Sprintf("**-%s**, **--%s**", flag.Shorthand, flag.Name)
		} else {
			format = fmt.Sprintf("**--%s**", flag.Name)
		}
		if len(flag.NoOptDefVal) > 0 {
			format += "["
		}
		if flag.Value.Type() == "string" {
			// put quotes on the value
			format += "=%q"
		} else {
			format += "=%s"
		}
		if len(flag.NoOptDefVal) > 0 {
			format += "]"
		}
		format += "\n\t%s\n\n"
		buf.WriteString(fmt.Sprintf(format, flag.DefValue, flag.Usage))
	})
}

func manPrintOptions(buf *bytes.Buffer, command *cobra.Command) {
	flags := command.NonInheritedFlags()
	if flags.HasAvailableFlags() {
		buf.WriteString("# OPTIONS\n")
		manPrintFlags(buf, flags)
		buf.WriteString("\n")
	}
	flags = command.InheritedFlags()
	if flags.HasAvailableFlags() {
		buf.WriteString("# OPTIONS INHERITED FROM PARENT COMMANDS\n")
		manPrintFlags(buf, flags)
		buf.WriteString("\n")
	}
}

func genMan(cmd *cobra.Command, header *GenManHeader) []byte {
	cmd.InitDefaultHelpCmd()
	cmd.InitDefaultHelpFlag()

	// something like `rootcmd-subcmd1-subcmd2`
	dashCommandName := strings.ReplaceAll(cmd.CommandPath(), " ", "-")

	buf := new(bytes.Buffer)

	manPreamble(buf, header, cmd, dashCommandName)
	manPrintOptions(buf, cmd)
	if len(cmd.Example) > 0 {
		buf.WriteString("# EXAMPLE\n")
		buf.WriteString(fmt.Sprintf("\n%s\n\n", cmd.Example))
	}
	if hasSeeAlso(cmd) {
		buf.WriteString("# SEE ALSO\n")
		seealsos := make([]string, 0)
		if cmd.HasParent() {
			parentPath := cmd.Parent().CommandPath()
			dashParentPath := strings.ReplaceAll(parentPath, " ", "-")
			seealso := fmt.Sprintf("**%s(%s)**", dashParentPath, header.Section)
			seealsos = append(seealsos, seealso)
			cmd.VisitParents(func(c *cobra.Command) {
				if c.DisableAutoGenTag {
					cmd.DisableAutoGenTag = c.DisableAutoGenTag
				}
			})
		}
		children := cmd.Commands()
		sort.Sort(byName(children))
		for _, c := range children {
			if !c.IsAvailableCommand() || c.IsAdditionalHelpTopicCommand() {
				continue
			}
			seealso := fmt.Sprintf("**%s-%s(%s)**", dashCommandName, c.Name(), header.Section)
			seealsos = append(seealsos, seealso)
		}
		buf.WriteString(strings.Join(seealsos, ", ") + "\n")
	}
	if !cmd.DisableAutoGenTag {
		buf.WriteString("# HISTORY\n Auto generated by spf13/cobra\n")
	}
	return buf.Bytes()
}
07070100000036000081A4000000000000000000000001683E350C0000147F000000000000000000000000000000000000002A00000000jenkins-x-cli-3.11.92/cmd/docs/md_docs.go// Copyright © 2019 The Tekton Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//	http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package main

import (
	"bytes"
	"fmt"
	"io"
	"os"
	"path/filepath"
	"sort"
	"strings"
	"time"

	"github.com/spf13/cobra"
)

func printOptions(buf *bytes.Buffer, cmd *cobra.Command) error {
	flags := cmd.NonInheritedFlags()
	flags.SetOutput(buf)
	if flags.HasAvailableFlags() {
		buf.WriteString("### Options\n\n```\n")
		flags.PrintDefaults()
		buf.WriteString("```\n\n")
	}

	parentFlags := cmd.InheritedFlags()
	parentFlags.SetOutput(buf)
	if parentFlags.HasAvailableFlags() {
		buf.WriteString("### Options inherited from parent commands\n\n```\n")
		parentFlags.PrintDefaults()
		buf.WriteString("```\n\n")
	}
	return nil
}

// GenMarkdownCustom creates custom markdown output.
func GenMarkdownCustom(cmd *cobra.Command, w io.Writer, linkHandler func(string) string) error {
	cmd.InitDefaultHelpCmd()
	cmd.InitDefaultHelpFlag()

	buf := new(bytes.Buffer)
	name := cmd.CommandPath()

	short := cmd.Short
	long := cmd.Long
	if long == "" {
		long = short
	}

	buf.WriteString("## " + name + "\n\n")
	buf.WriteString(short + "\n\n")

	if len(cmd.Aliases) > 0 {
		buf.WriteString(fmt.Sprintf("***Aliases**: %s*\n\n", strings.Join(cmd.Aliases, ",")))
	}

	if cmd.Runnable() {
		buf.WriteString("### Usage\n\n")
		buf.WriteString(fmt.Sprintf("```\n%s\n```\n\n", cmd.UseLine()))
	}

	buf.WriteString("### Synopsis\n\n")

	buf.WriteString(long + "\n\n")

	if len(cmd.Example) > 0 {
		buf.WriteString("### Examples\n\n")
		buf.WriteString(fmt.Sprintf("%s\n\n", cmd.Example))
	}

	if err := printOptions(buf, cmd); err != nil {
		return err
	}
	if hasSeeAlso(cmd) {
		buf.WriteString("### SEE ALSO\n\n")
		if cmd.HasParent() {
			parent := cmd.Parent()
			pname := parent.CommandPath()
			link := pname + ".md"
			link = strings.ReplaceAll(link, " ", "_")
			buf.WriteString(fmt.Sprintf("* [%s](%s)\t - %s\n", pname, linkHandler(link), parent.Short))
			cmd.VisitParents(func(c *cobra.Command) {
				if c.DisableAutoGenTag {
					cmd.DisableAutoGenTag = c.DisableAutoGenTag
				}
			})
		}

		children := cmd.Commands()
		sort.Sort(byName(children))

		for _, child := range children {
			if !child.IsAvailableCommand() || child.IsAdditionalHelpTopicCommand() {
				continue
			}
			cname := name + " " + child.Name()
			link := cname + ".md"
			link = strings.ReplaceAll(link, " ", "_")
			buf.WriteString(fmt.Sprintf("* [%s](%s)\t - %s\n", cname, linkHandler(link), child.Short))
		}
		buf.WriteString("\n")
	}
	if !cmd.DisableAutoGenTag {
		buf.WriteString("###### Auto generated by spf13/cobra on " + time.Now().Format("2-Jan-2006") + "\n")
	}
	_, err := buf.WriteTo(w)
	return err
}

// GenMarkdownTree will generate a markdown page for this command and all
// descendants in the directory given. The header may be nil.
// This function may not work correctly if your command names have `-` in them.
// If you have `cmd` with two subcmds, `sub` and `sub-third`,
// and `sub` has a subcommand called `third`, it is undefined which
// help output will be in the file `cmd-sub-third.1`.
func GenMarkdownTree(cmd *cobra.Command, dir string) error {
	identity := func(s string) string { return s }
	emptyStr := func(s string) string { return "" }
	return GenMarkdownTreeCustom(cmd, dir, emptyStr, identity)
}

// GenMarkdownTreeCustom is the the same as GenMarkdownTree, but
// with custom filePrepender and linkHandler.
func GenMarkdownTreeCustom(cmd *cobra.Command, dir string, filePrepender, linkHandler func(string) string) error {
	for _, c := range cmd.Commands() {
		if !c.IsAvailableCommand() || c.IsAdditionalHelpTopicCommand() {
			continue
		}
		if err := GenMarkdownTreeCustom(c, dir, filePrepender, linkHandler); err != nil {
			return err
		}
	}

	basename := strings.ReplaceAll(cmd.CommandPath(), " ", "_") + ".md"
	filename := filepath.Join(dir, basename)
	f, err := os.Create(filename)
	if err != nil {
		return err
	}
	defer f.Close()

	if _, err := io.WriteString(f, filePrepender(filename)); err != nil {
		return err
	}
	return GenMarkdownCustom(cmd, f, linkHandler)
}

// Test to see if we have a reason to print See Also information in docs
// Basically this is a test for a parent commend or a subcommand which is
// both not deprecated and not the autogenerated help command.
func hasSeeAlso(cmd *cobra.Command) bool {
	if cmd.HasParent() {
		return true
	}
	for _, c := range cmd.Commands() {
		if !c.IsAvailableCommand() || c.IsAdditionalHelpTopicCommand() {
			continue
		}
		return true
	}
	return false
}

type byName []*cobra.Command

func (s byName) Len() int           { return len(s) }
func (s byName) Swap(i, j int)      { s[i], s[j] = s[j], s[i] }
func (s byName) Less(i, j int) bool { return s[i].Name() < s[j].Name() }
07070100000037000081A4000000000000000000000001683E350C000000B4000000000000000000000000000000000000002200000000jenkins-x-cli-3.11.92/cmd/main.gopackage main

import (
	"os"

	"github.com/jenkins-x/jx/cmd/app"
)

// Entrypoint for the command
func main() {
	if err := app.Run(nil); err != nil {
		os.Exit(1)
	}
	os.Exit(0)
}
07070100000038000081A4000000000000000000000001683E350C00000000000000000000000000000000000000000000003000000000jenkins-x-cli-3.11.92/custom-boilerplate.go.txt07070100000039000041ED000000000000000000000002683E350C00000000000000000000000000000000000000000000002800000000jenkins-x-cli-3.11.92/dependency-matrix0707010000003A000081A4000000000000000000000001683E350C0000095C000000000000000000000000000000000000003200000000jenkins-x-cli-3.11.92/dependency-matrix/matrix.md# Dependency Matrix

Dependency | Sources | Version | Mismatched versions
---------- | ------- | ------- | -------------------
[jenkins-x/jx-admin](https://github.com/jenkins-x/jx-admin.git) |  | [0.0.143](https://github.com/jenkins-x/jx-admin/releases/tag/v0.0.143) | 
[jenkins-x/jx-secret](https://github.com/jenkins-x/jx-secret.git) |  | [0.0.214](https://github.com/jenkins-x/jx-secret/releases/tag/v0.0.214) | 
[jenkins-x/jx-promote](https://github.com/jenkins-x/jx-promote.git) |  | [0.0.148](https://github.com/jenkins-x/jx-promote/releases/tag/v0.0.148) | 
[jenkins-x/jx-project](https://github.com/jenkins-x/jx-project.git) |  | [0.0.178](https://github.com/jenkins-x/jx-project/releases/tag/v0.0.178) | 
[jenkins-x/jx-verify](https://github.com/jenkins-x/jx-verify.git) |  | [0.0.42](https://github.com/jenkins-x/jx-verify/releases/tag/v0.0.42) | 
[jenkins-x/jx-pipeline](https://github.com/jenkins-x/jx-pipeline.git) |  | [0.0.88](https://github.com/jenkins-x/jx-pipeline/releases/tag/v0.0.88) | 
[jenkins-x/jx-application](https://github.com/jenkins-x/jx-application.git) |  | [0.0.25](https://github.com/jenkins-x/jx-application/releases/tag/v0.0.25) | 
[jenkins-x/jx-gitops](https://github.com/jenkins-x/jx-gitops.git) |  | [0.0.446](https://github.com/jenkins-x/jx-gitops/releases/tag/v0.0.446) | 
[jenkins-x/jx-preview](https://github.com/jenkins-x/jx-preview.git) |  | [0.0.128](https://github.com/jenkins-x/jx-preview/releases/tag/v0.0.128) | 
[jenkins-x/jx-test](https://github.com/jenkins-x/jx-test.git) |  | [0.0.25](https://github.com/jenkins-x/jx-test/releases/tag/v0.0.25) | 
[jenkins-x/jxl-base-image](https://github.com/jenkins-x/jxl-base-image) |  | [0.0.61]() | 
[jenkins-x/jx-base-image](https://github.com/jenkins-x/jx-base-image.git) |  | [0.0.43]() | 
[jenkins-x/jx-jenkins](https://github.com/jenkins-x/jx-jenkins.git) |  | [0.0.29](https://github.com/jenkins-x/jx-jenkins/releases/tag/v0.0.29) | 
[jenkins-x-plugins/jx-scm](https://github.com/jenkins-x-plugins/jx-scm) |  | [0.0.2](https://github.com/jenkins-x-plugins/jx-scm/releases/tag/v0.0.2) | 
[jenkins-x-plugins/jx-health](https://github.com/jenkins-x-plugins/jx-health.git) |  | [0.0.66](https://github.com/jenkins-x-plugins/jx-health/releases/tag/v0.0.66) | 
[jenkins-x/octant-jx](https://github.com/jenkins-x/octant-jx.git) |  | [0.0.38](https://github.com/jenkins-x/octant-jx/releases/tag/v0.0.38) | 
0707010000003B000081A4000000000000000000000001683E350C00000C4F000000000000000000000000000000000000003400000000jenkins-x-cli-3.11.92/dependency-matrix/matrix.yamldependencies:
- host: github.com
  owner: jenkins-x
  repo: jx-admin
  url: https://github.com/jenkins-x/jx-admin.git
  version: 0.0.143
  versionURL: https://github.com/jenkins-x/jx-admin/releases/tag/v0.0.143
- host: github.com
  owner: jenkins-x
  repo: jx-secret
  url: https://github.com/jenkins-x/jx-secret.git
  version: 0.0.214
  versionURL: https://github.com/jenkins-x/jx-secret/releases/tag/v0.0.214
- host: github.com
  owner: jenkins-x
  repo: jx-promote
  url: https://github.com/jenkins-x/jx-promote.git
  version: 0.0.148
  versionURL: https://github.com/jenkins-x/jx-promote/releases/tag/v0.0.148
- host: github.com
  owner: jenkins-x
  repo: jx-project
  url: https://github.com/jenkins-x/jx-project.git
  version: 0.0.178
  versionURL: https://github.com/jenkins-x/jx-project/releases/tag/v0.0.178
- host: github.com
  owner: jenkins-x
  repo: jx-verify
  url: https://github.com/jenkins-x/jx-verify.git
  version: 0.0.42
  versionURL: https://github.com/jenkins-x/jx-verify/releases/tag/v0.0.42
- host: github.com
  owner: jenkins-x
  repo: jx-pipeline
  url: https://github.com/jenkins-x/jx-pipeline.git
  version: 0.0.88
  versionURL: https://github.com/jenkins-x/jx-pipeline/releases/tag/v0.0.88
- host: github.com
  owner: jenkins-x
  repo: jx-application
  url: https://github.com/jenkins-x/jx-application.git
  version: 0.0.25
  versionURL: https://github.com/jenkins-x/jx-application/releases/tag/v0.0.25
- host: github.com
  owner: jenkins-x
  repo: jx-gitops
  url: https://github.com/jenkins-x/jx-gitops.git
  version: 0.0.446
  versionURL: https://github.com/jenkins-x/jx-gitops/releases/tag/v0.0.446
- host: github.com
  owner: jenkins-x
  repo: jx-preview
  url: https://github.com/jenkins-x/jx-preview.git
  version: 0.0.128
  versionURL: https://github.com/jenkins-x/jx-preview/releases/tag/v0.0.128
- host: github.com
  owner: jenkins-x
  repo: jx-test
  url: https://github.com/jenkins-x/jx-test.git
  version: 0.0.25
  versionURL: https://github.com/jenkins-x/jx-test/releases/tag/v0.0.25
- host: github.com
  owner: jenkins-x
  repo: jxl-base-image
  url: https://github.com/jenkins-x/jxl-base-image
  version: 0.0.61
  versionURL: ""
- host: github.com
  owner: jenkins-x
  repo: jx-base-image
  url: https://github.com/jenkins-x/jx-base-image.git
  version: 0.0.43
  versionURL: ""
- host: github.com
  owner: jenkins-x
  repo: jx-jenkins
  url: https://github.com/jenkins-x/jx-jenkins.git
  version: 0.0.29
  versionURL: https://github.com/jenkins-x/jx-jenkins/releases/tag/v0.0.29
- host: github.com
  owner: jenkins-x-plugins
  repo: jx-scm
  url: https://github.com/jenkins-x-plugins/jx-scm
  version: 0.0.2
  versionURL: https://github.com/jenkins-x-plugins/jx-scm/releases/tag/v0.0.2
- host: github.com
  owner: jenkins-x-plugins
  repo: jx-health
  url: https://github.com/jenkins-x-plugins/jx-health.git
  version: 0.0.66
  versionURL: https://github.com/jenkins-x-plugins/jx-health/releases/tag/v0.0.66
- host: github.com
  owner: jenkins-x
  repo: octant-jx
  url: https://github.com/jenkins-x/octant-jx.git
  version: 0.0.38
  versionURL: https://github.com/jenkins-x/octant-jx/releases/tag/v0.0.38
0707010000003C000041ED000000000000000000000002683E350C00000000000000000000000000000000000000000000001B00000000jenkins-x-cli-3.11.92/docs0707010000003D000041ED000000000000000000000002683E350C00000000000000000000000000000000000000000000001F00000000jenkins-x-cli-3.11.92/docs/cmd0707010000003E000081A4000000000000000000000001683E350C000003B6000000000000000000000000000000000000002500000000jenkins-x-cli-3.11.92/docs/cmd/jx.md## jx

Jenkins X 3.x command line

### Usage

```
jx
```

### Synopsis

Jenkins X 3.x command line

### Options

```
  -h, --help   help for jx
```

### SEE ALSO

* [jx add](jx_add.md)	 - Adds one or more resources
* [jx create](jx_create.md)	 - Create one or more resources
* [jx ctx](jx_ctx.md)	 - alias for: jx context
* [jx dashboard](jx_dashboard.md)	 - View the Jenkins X Pipelines Dashboard
* [jx get](jx_get.md)	 - Display one or more resources
* [jx import](jx_import.md)	 - alias for: jx project import
* [jx namespace](jx_namespace.md)	 - View or change the current namespace context in the current Kubernetes cluster
* [jx start](jx_start.md)	 - Starts a resource
* [jx stop](jx_stop.md)	 - Stops a resource
* [jx ui](jx_ui.md)	 - Views the Jenkins X UI (octant)
* [jx upgrade](jx_upgrade.md)	 - Upgrades resources
* [jx version](jx_version.md)	 - Displays the version of this command

###### Auto generated by spf13/cobra on 14-Sep-2022
0707010000003F000081A4000000000000000000000001683E350C0000015D000000000000000000000000000000000000002900000000jenkins-x-cli-3.11.92/docs/cmd/jx_add.md## jx add

Adds one or more resources

### Usage

```
jx add TYPE [flags]
```

### Synopsis

Adds one or more resources

### Options

```
  -h, --help   help for add
```

### SEE ALSO

* [jx](jx.md)	 - Jenkins X 3.x command line
* [jx add app](jx_add_app.md)	 - alias for: jx gitops helmfile add

###### Auto generated by spf13/cobra on 14-Sep-2022
07070100000040000081A4000000000000000000000001683E350C00000141000000000000000000000000000000000000002D00000000jenkins-x-cli-3.11.92/docs/cmd/jx_add_app.md## jx add app

alias for: jx gitops helmfile add

***Aliases**: chart*

### Usage

```
jx add app
```

### Synopsis

alias for: jx gitops helmfile add

### Options

```
  -h, --help   help for app
```

### SEE ALSO

* [jx add](jx_add.md)	 - Adds one or more resources

###### Auto generated by spf13/cobra on 14-Sep-2022
07070100000041000081A4000000000000000000000001683E350C00000265000000000000000000000000000000000000002C00000000jenkins-x-cli-3.11.92/docs/cmd/jx_create.md## jx create

Create one or more resources

### Usage

```
jx create TYPE [flags]
```

### Synopsis

Create one or more resources

### Options

```
  -h, --help   help for create
```

### SEE ALSO

* [jx](jx.md)	 - Jenkins X 3.x command line
* [jx create project](jx_create_project.md)	 - alias for: jx project
* [jx create pullrequest](jx_create_pullrequest.md)	 - alias for: jx project pullrequest
* [jx create quickstart](jx_create_quickstart.md)	 - alias for: jx project quickstart
* [jx create spring](jx_create_spring.md)	 - alias for: jx project spring

###### Auto generated by spf13/cobra on 14-Sep-2022
07070100000042000081A4000000000000000000000001683E350C0000012D000000000000000000000000000000000000003400000000jenkins-x-cli-3.11.92/docs/cmd/jx_create_project.md## jx create project

alias for: jx project

### Usage

```
jx create project
```

### Synopsis

alias for: jx project

### Options

```
  -h, --help   help for project
```

### SEE ALSO

* [jx create](jx_create.md)	 - Create one or more resources

###### Auto generated by spf13/cobra on 14-Sep-2022
07070100000043000081A4000000000000000000000001683E350C00000164000000000000000000000000000000000000003800000000jenkins-x-cli-3.11.92/docs/cmd/jx_create_pullrequest.md## jx create pullrequest

alias for: jx project pullrequest

***Aliases**: pr*

### Usage

```
jx create pullrequest
```

### Synopsis

alias for: jx project pullrequest

### Options

```
  -h, --help   help for pullrequest
```

### SEE ALSO

* [jx create](jx_create.md)	 - Create one or more resources

###### Auto generated by spf13/cobra on 14-Sep-2022
07070100000044000081A4000000000000000000000001683E350C0000015F000000000000000000000000000000000000003700000000jenkins-x-cli-3.11.92/docs/cmd/jx_create_quickstart.md## jx create quickstart

alias for: jx project quickstart

***Aliases**: qs*

### Usage

```
jx create quickstart
```

### Synopsis

alias for: jx project quickstart

### Options

```
  -h, --help   help for quickstart
```

### SEE ALSO

* [jx create](jx_create.md)	 - Create one or more resources

###### Auto generated by spf13/cobra on 14-Sep-2022
07070100000045000081A4000000000000000000000001683E350C0000014B000000000000000000000000000000000000003300000000jenkins-x-cli-3.11.92/docs/cmd/jx_create_spring.md## jx create spring

alias for: jx project spring

***Aliases**: sb*

### Usage

```
jx create spring
```

### Synopsis

alias for: jx project spring

### Options

```
  -h, --help   help for spring
```

### SEE ALSO

* [jx create](jx_create.md)	 - Create one or more resources

###### Auto generated by spf13/cobra on 14-Sep-2022
07070100000046000081A4000000000000000000000001683E350C00000103000000000000000000000000000000000000002900000000jenkins-x-cli-3.11.92/docs/cmd/jx_ctx.md## jx ctx

alias for: jx context

### Usage

```
jx ctx
```

### Synopsis

alias for: jx context

### Options

```
  -h, --help   help for ctx
```

### SEE ALSO

* [jx](jx.md)	 - Jenkins X 3.x command line

###### Auto generated by spf13/cobra on 14-Sep-2022
07070100000047000081A4000000000000000000000001683E350C0000048F000000000000000000000000000000000000002F00000000jenkins-x-cli-3.11.92/docs/cmd/jx_dashboard.md## jx dashboard

View the Jenkins X Pipelines Dashboard

***Aliases**: dash*

### Usage

```
jx dashboard
```

### Synopsis

View the Jenkins X Pipelines Dashboard.

### Examples

  # open the dashboard
  jx dashboard
  
  # display the URL only without opening a browser
  jx --no-open

### Options

```
  -b, --batch-mode         Runs in batch mode without prompting for user input
  -h, --help               help for dashboard
      --log-level string   Sets the logging level. If not specified defaults to $JX_LOG_LEVEL
  -n, --name string        The name of the dashboard service (default "jx-pipelines-visualizer")
      --no-open            Disable opening the URL; just show it on the console
  -s, --secret string      The name of the Secret containing the basic auth login/password (default "jx-basic-auth-user-password")
      --verbose            Enables verbose output. The environment variable JX_LOG_LEVEL has precedence over this flag and allows setting the logging level to any value of: panic, fatal, error, warn, info, debug, trace
```

### SEE ALSO

* [jx](jx.md)	 - Jenkins X 3.x command line

###### Auto generated by spf13/cobra on 14-Sep-2022
07070100000048000081A4000000000000000000000001683E350C000002AD000000000000000000000000000000000000002900000000jenkins-x-cli-3.11.92/docs/cmd/jx_get.md## jx get

Display one or more resources

### Usage

```
jx get TYPE [flags]
```

### Synopsis

Display one or more resources

### Options

```
  -h, --help   help for get
```

### SEE ALSO

* [jx](jx.md)	 - Jenkins X 3.x command line
* [jx get activities](jx_get_activities.md)	 - alias for: jx pipeline activities
* [jx get application](jx_get_application.md)	 - alias for: jx application get
* [jx get build](jx_get_build.md)	 - Display one or more resources relating to a pipeline build
* [jx get pipelines](jx_get_pipelines.md)	 - alias for: jx pipeline get
* [jx get previews](jx_get_previews.md)	 - alias for: jx preview get

###### Auto generated by spf13/cobra on 14-Sep-2022
07070100000049000081A4000000000000000000000001683E350C00000160000000000000000000000000000000000000003400000000jenkins-x-cli-3.11.92/docs/cmd/jx_get_activities.md## jx get activities

alias for: jx pipeline activities

***Aliases**: act,activity*

### Usage

```
jx get activities
```

### Synopsis

alias for: jx pipeline activities

### Options

```
  -h, --help   help for activities
```

### SEE ALSO

* [jx get](jx_get.md)	 - Display one or more resources

###### Auto generated by spf13/cobra on 14-Sep-2022
0707010000004A000081A4000000000000000000000001683E350C00000164000000000000000000000000000000000000003500000000jenkins-x-cli-3.11.92/docs/cmd/jx_get_application.md## jx get application

alias for: jx application get

***Aliases**: app,apps,applications*

### Usage

```
jx get application
```

### Synopsis

alias for: jx application get

### Options

```
  -h, --help   help for application
```

### SEE ALSO

* [jx get](jx_get.md)	 - Display one or more resources

###### Auto generated by spf13/cobra on 14-Sep-2022
0707010000004B000081A4000000000000000000000001683E350C00000220000000000000000000000000000000000000002F00000000jenkins-x-cli-3.11.92/docs/cmd/jx_get_build.md## jx get build

Display one or more resources relating to a pipeline build

***Aliases**: builds*

### Usage

```
jx get build TYPE [flags]
```

### Synopsis

Display one or more resources relating to a pipeline build

### Options

```
  -h, --help   help for build
```

### SEE ALSO

* [jx get](jx_get.md)	 - Display one or more resources
* [jx get build logs](jx_get_build_logs.md)	 - alias for: jx pipeline logs
* [jx get build pods](jx_get_build_pods.md)	 - alias for: jx pipeline pods

###### Auto generated by spf13/cobra on 14-Sep-2022
0707010000004C000081A4000000000000000000000001683E350C0000016E000000000000000000000000000000000000003400000000jenkins-x-cli-3.11.92/docs/cmd/jx_get_build_logs.md## jx get build logs

alias for: jx pipeline logs

***Aliases**: log*

### Usage

```
jx get build logs
```

### Synopsis

alias for: jx pipeline logs

### Options

```
  -h, --help   help for logs
```

### SEE ALSO

* [jx get build](jx_get_build.md)	 - Display one or more resources relating to a pipeline build

###### Auto generated by spf13/cobra on 14-Sep-2022
0707010000004D000081A4000000000000000000000001683E350C0000016E000000000000000000000000000000000000003400000000jenkins-x-cli-3.11.92/docs/cmd/jx_get_build_pods.md## jx get build pods

alias for: jx pipeline pods

***Aliases**: pod*

### Usage

```
jx get build pods
```

### Synopsis

alias for: jx pipeline pods

### Options

```
  -h, --help   help for pods
```

### SEE ALSO

* [jx get build](jx_get_build.md)	 - Display one or more resources relating to a pipeline build

###### Auto generated by spf13/cobra on 14-Sep-2022
0707010000004E000081A4000000000000000000000001683E350C0000014B000000000000000000000000000000000000003300000000jenkins-x-cli-3.11.92/docs/cmd/jx_get_pipelines.md## jx get pipelines

alias for: jx pipeline get

***Aliases**: pipeline*

### Usage

```
jx get pipelines
```

### Synopsis

alias for: jx pipeline get

### Options

```
  -h, --help   help for pipelines
```

### SEE ALSO

* [jx get](jx_get.md)	 - Display one or more resources

###### Auto generated by spf13/cobra on 14-Sep-2022
0707010000004F000081A4000000000000000000000001683E350C00000145000000000000000000000000000000000000003200000000jenkins-x-cli-3.11.92/docs/cmd/jx_get_previews.md## jx get previews

alias for: jx preview get

***Aliases**: preview*

### Usage

```
jx get previews
```

### Synopsis

alias for: jx preview get

### Options

```
  -h, --help   help for previews
```

### SEE ALSO

* [jx get](jx_get.md)	 - Display one or more resources

###### Auto generated by spf13/cobra on 14-Sep-2022
07070100000050000081A4000000000000000000000001683E350C0000011A000000000000000000000000000000000000002C00000000jenkins-x-cli-3.11.92/docs/cmd/jx_import.md## jx import

alias for: jx project import

### Usage

```
jx import
```

### Synopsis

alias for: jx project import

### Options

```
  -h, --help   help for import
```

### SEE ALSO

* [jx](jx.md)	 - Jenkins X 3.x command line

###### Auto generated by spf13/cobra on 14-Sep-2022
07070100000051000081A4000000000000000000000001683E350C000004A5000000000000000000000000000000000000002F00000000jenkins-x-cli-3.11.92/docs/cmd/jx_namespace.md## jx namespace

View or change the current namespace context in the current Kubernetes cluster

***Aliases**: ns*

### Usage

```
jx namespace
```

### Synopsis

Displays or changes the current namespace.

### Examples

  # view the current namespace
  jx --batch-mode ns
  
  # interactively select the namespace to switch to
  jx ns
  
  # change the current namespace to 'cheese'
  jx ns cheese
  
  # change the current namespace to 'brie' creating it if necessary
  jx ns --create brie
  
  # switch to the namespace of the staging environment
  jx ns --env staging
  
  # switch back to the dev environment namespace
  jx ns --e dev
  
  # interactively select the Environment to switch to
  jx ns --pick

### Options

```
  -b, --batch-mode   Enables batch mode
  -c, --create       Creates the specified namespace if it does not exist
  -e, --env string   The Environment name to switch to the namepsace
  -h, --help         help for namespace
  -v, --pick         Pick the Environment to switch to
  -q, --quiet        Do not fail if the namespace does not exist
```

### SEE ALSO

* [jx](jx.md)	 - Jenkins X 3.x command line

###### Auto generated by spf13/cobra on 14-Sep-2022
07070100000052000081A4000000000000000000000001683E350C0000015A000000000000000000000000000000000000002B00000000jenkins-x-cli-3.11.92/docs/cmd/jx_start.md## jx start

Starts a resource

### Usage

```
jx start TYPE [flags]
```

### Synopsis

Starts a resource

### Options

```
  -h, --help   help for start
```

### SEE ALSO

* [jx](jx.md)	 - Jenkins X 3.x command line
* [jx start pipeline](jx_start_pipeline.md)	 - alias for: jx pipeline start

###### Auto generated by spf13/cobra on 14-Sep-2022
07070100000053000081A4000000000000000000000001683E350C00000149000000000000000000000000000000000000003400000000jenkins-x-cli-3.11.92/docs/cmd/jx_start_pipeline.md## jx start pipeline

alias for: jx pipeline start

***Aliases**: pipelines*

### Usage

```
jx start pipeline
```

### Synopsis

alias for: jx pipeline start

### Options

```
  -h, --help   help for pipeline
```

### SEE ALSO

* [jx start](jx_start.md)	 - Starts a resource

###### Auto generated by spf13/cobra on 14-Sep-2022
07070100000054000081A4000000000000000000000001683E350C00000152000000000000000000000000000000000000002A00000000jenkins-x-cli-3.11.92/docs/cmd/jx_stop.md## jx stop

Stops a resource

### Usage

```
jx stop TYPE [flags]
```

### Synopsis

Stops a resource

### Options

```
  -h, --help   help for stop
```

### SEE ALSO

* [jx](jx.md)	 - Jenkins X 3.x command line
* [jx stop pipeline](jx_stop_pipeline.md)	 - alias for: jx pipeline stop

###### Auto generated by spf13/cobra on 14-Sep-2022
07070100000055000081A4000000000000000000000001683E350C00000142000000000000000000000000000000000000003300000000jenkins-x-cli-3.11.92/docs/cmd/jx_stop_pipeline.md## jx stop pipeline

alias for: jx pipeline stop

***Aliases**: pipelines*

### Usage

```
jx stop pipeline
```

### Synopsis

alias for: jx pipeline stop

### Options

```
  -h, --help   help for pipeline
```

### SEE ALSO

* [jx stop](jx_stop.md)	 - Stops a resource

###### Auto generated by spf13/cobra on 14-Sep-2022
07070100000056000081A4000000000000000000000001683E350C00000480000000000000000000000000000000000000002800000000jenkins-x-cli-3.11.92/docs/cmd/jx_ui.md## jx ui

Views the Jenkins X UI (octant)

### Usage

```
jx ui
```

### Synopsis

Views the Jenkins X UI (octant).

### Examples

  # open the UI
  jx ui
  # To pass arguments to octant
  jx ui -o --namespace=jx -o -v -o --browser-path="/#/jx/pipelines"

### Options

```
  -b, --batch-mode            Runs in batch mode without prompting for user input
  -p, --browser-path string   The browser path inside octant to open (default "/#/jx/pipelines-recent")
  -h, --help                  help for ui
      --host string           The host to listen on
      --log-level string      Sets the logging level. If not specified defaults to $JX_LOG_LEVEL
  -o, --octant-args strings   Extra arguments passed to the octant binary (default [--namespace=jx])
      --port int              The port for octant to listen on
      --verbose               Enables verbose output. The environment variable JX_LOG_LEVEL has precedence over this flag and allows setting the logging level to any value of: panic, fatal, error, warn, info, debug, trace
```

### SEE ALSO

* [jx](jx.md)	 - Jenkins X 3.x command line

###### Auto generated by spf13/cobra on 14-Sep-2022
07070100000057000081A4000000000000000000000001683E350C00000220000000000000000000000000000000000000002D00000000jenkins-x-cli-3.11.92/docs/cmd/jx_upgrade.md## jx upgrade

Upgrades resources

### Usage

```
jx upgrade
```

### Synopsis

Upgrades all of the plugins in your local Jenkins X CLI

### Examples

  # upgrades your plugin binaries
  jx upgrade

### Options

```
  -h, --help   help for upgrade
```

### SEE ALSO

* [jx](jx.md)	 - Jenkins X 3.x command line
* [jx upgrade cli](jx_upgrade_cli.md)	 - Upgrades your local Jenkins X CLI
* [jx upgrade plugins](jx_upgrade_plugins.md)	 - Upgrades all of the plugins in your local Jenkins X CLI

###### Auto generated by spf13/cobra on 14-Sep-2022
07070100000058000081A4000000000000000000000001683E350C0000031E000000000000000000000000000000000000003100000000jenkins-x-cli-3.11.92/docs/cmd/jx_upgrade_cli.md## jx upgrade cli

Upgrades your local Jenkins X CLI

### Usage

```
jx upgrade cli
```

### Synopsis

Upgrades your local Jenkins X CLI

### Examples

  # upgrades your jx CLI
  jx upgrade cli

### Options

```
  -e, --from-environment                Use the clusters dev environment to obtain the version stream URL to find correct version to upgrade the jx cli, this overrides version-stream-git-url
  -h, --help                            help for cli
  -v, --version string                  The specific version to upgrade to (requires --brew=false on macOS)
      --version-stream-git-url string   The version stream git URL to lookup the jx cli version to upgrade to
```

### SEE ALSO

* [jx upgrade](jx_upgrade.md)	 - Upgrades resources

###### Auto generated by spf13/cobra on 14-Sep-2022
07070100000059000081A4000000000000000000000001683E350C00000297000000000000000000000000000000000000003500000000jenkins-x-cli-3.11.92/docs/cmd/jx_upgrade_plugins.md## jx upgrade plugins

Upgrades all of the plugins in your local Jenkins X CLI

### Usage

```
jx upgrade plugins
```

### Synopsis

Upgrades all of the plugins in your local Jenkins X CLI

### Examples

  # upgrades your plugin binaries
  jx upgrade plugins

### Options

```
      --boot          only install plugins required for boot
  -h, --help          help for plugins
  -m, --mandatory     if set lets ignore optional plugins
      --path string   creates a symlink to the binary plugins in this bin path dir (default "/usr/bin")
```

### SEE ALSO

* [jx upgrade](jx_upgrade.md)	 - Upgrades resources

###### Auto generated by spf13/cobra on 14-Sep-2022
0707010000005A000081A4000000000000000000000001683E350C000001D0000000000000000000000000000000000000002D00000000jenkins-x-cli-3.11.92/docs/cmd/jx_version.md## jx version

Displays the version of this command

### Usage

```
jx version
```

### Synopsis

Displays the version of this command

### Options

```
  -h, --help    help for version
  -q, --quiet   uses the quiet format of just outputting the version number only
  -s, --short   uses the short format of just outputting the version number only
```

### SEE ALSO

* [jx](jx.md)	 - Jenkins X 3.x command line

###### Auto generated by spf13/cobra on 14-Sep-2022
0707010000005B000041ED000000000000000000000002683E350C00000000000000000000000000000000000000000000001F00000000jenkins-x-cli-3.11.92/docs/man0707010000005C000041ED000000000000000000000002683E350C00000000000000000000000000000000000000000000002400000000jenkins-x-cli-3.11.92/docs/man/man10707010000005D000081A4000000000000000000000001683E350C0000017E000000000000000000000000000000000000003100000000jenkins-x-cli-3.11.92/docs/man/man1/jx-add-app.1.TH "JX\-ADD\-APP" "1" "" "Auto generated by spf13/cobra" "" 
.nh
.ad l


.SH NAME
.PP
jx\-add\-app \- alias for: jx gitops helmfile add


.SH SYNOPSIS
.PP
\fBjx add app\fP


.SH DESCRIPTION
.PP
alias for: jx gitops helmfile add


.SH OPTIONS
.PP
\fB\-h\fP, \fB\-\-help\fP[=false]
    help for app


.SH SEE ALSO
.PP
\fBjx\-add(1)\fP


.SH HISTORY
.PP
Auto generated by spf13/cobra
0707010000005E000081A4000000000000000000000001683E350C00000181000000000000000000000000000000000000002D00000000jenkins-x-cli-3.11.92/docs/man/man1/jx-add.1.TH "JX\-ADD" "1" "" "Auto generated by spf13/cobra" "" 
.nh
.ad l


.SH NAME
.PP
jx\-add \- Adds one or more resources


.SH SYNOPSIS
.PP
\fBjx add TYPE [flags]\fP


.SH DESCRIPTION
.PP
Adds one or more resources


.SH OPTIONS
.PP
\fB\-h\fP, \fB\-\-help\fP[=false]
    help for add


.SH SEE ALSO
.PP
\fBjx(1)\fP, \fBjx\-add\-app(1)\fP


.SH HISTORY
.PP
Auto generated by spf13/cobra
0707010000005F000081A4000000000000000000000001683E350C00000182000000000000000000000000000000000000003800000000jenkins-x-cli-3.11.92/docs/man/man1/jx-create-project.1.TH "JX\-CREATE\-PROJECT" "1" "" "Auto generated by spf13/cobra" "" 
.nh
.ad l


.SH NAME
.PP
jx\-create\-project \- alias for: jx project


.SH SYNOPSIS
.PP
\fBjx create project\fP


.SH DESCRIPTION
.PP
alias for: jx project


.SH OPTIONS
.PP
\fB\-h\fP, \fB\-\-help\fP[=false]
    help for project


.SH SEE ALSO
.PP
\fBjx\-create(1)\fP


.SH HISTORY
.PP
Auto generated by spf13/cobra
07070100000060000081A4000000000000000000000001683E350C000001AA000000000000000000000000000000000000003C00000000jenkins-x-cli-3.11.92/docs/man/man1/jx-create-pullrequest.1.TH "JX\-CREATE\-PULLREQUEST" "1" "" "Auto generated by spf13/cobra" "" 
.nh
.ad l


.SH NAME
.PP
jx\-create\-pullrequest \- alias for: jx project pullrequest


.SH SYNOPSIS
.PP
\fBjx create pullrequest\fP


.SH DESCRIPTION
.PP
alias for: jx project pullrequest


.SH OPTIONS
.PP
\fB\-h\fP, \fB\-\-help\fP[=false]
    help for pullrequest


.SH SEE ALSO
.PP
\fBjx\-create(1)\fP


.SH HISTORY
.PP
Auto generated by spf13/cobra
07070100000061000081A4000000000000000000000001683E350C000001A4000000000000000000000000000000000000003B00000000jenkins-x-cli-3.11.92/docs/man/man1/jx-create-quickstart.1.TH "JX\-CREATE\-QUICKSTART" "1" "" "Auto generated by spf13/cobra" "" 
.nh
.ad l


.SH NAME
.PP
jx\-create\-quickstart \- alias for: jx project quickstart


.SH SYNOPSIS
.PP
\fBjx create quickstart\fP


.SH DESCRIPTION
.PP
alias for: jx project quickstart


.SH OPTIONS
.PP
\fB\-h\fP, \fB\-\-help\fP[=false]
    help for quickstart


.SH SEE ALSO
.PP
\fBjx\-create(1)\fP


.SH HISTORY
.PP
Auto generated by spf13/cobra
07070100000062000081A4000000000000000000000001683E350C0000018C000000000000000000000000000000000000003700000000jenkins-x-cli-3.11.92/docs/man/man1/jx-create-spring.1.TH "JX\-CREATE\-SPRING" "1" "" "Auto generated by spf13/cobra" "" 
.nh
.ad l


.SH NAME
.PP
jx\-create\-spring \- alias for: jx project spring


.SH SYNOPSIS
.PP
\fBjx create spring\fP


.SH DESCRIPTION
.PP
alias for: jx project spring


.SH OPTIONS
.PP
\fB\-h\fP, \fB\-\-help\fP[=false]
    help for spring


.SH SEE ALSO
.PP
\fBjx\-create(1)\fP


.SH HISTORY
.PP
Auto generated by spf13/cobra
07070100000063000081A4000000000000000000000001683E350C000001F8000000000000000000000000000000000000003000000000jenkins-x-cli-3.11.92/docs/man/man1/jx-create.1.TH "JX\-CREATE" "1" "" "Auto generated by spf13/cobra" "" 
.nh
.ad l


.SH NAME
.PP
jx\-create \- Create one or more resources


.SH SYNOPSIS
.PP
\fBjx create TYPE [flags]\fP


.SH DESCRIPTION
.PP
Create one or more resources


.SH OPTIONS
.PP
\fB\-h\fP, \fB\-\-help\fP[=false]
    help for create


.SH SEE ALSO
.PP
\fBjx(1)\fP, \fBjx\-create\-project(1)\fP, \fBjx\-create\-pullrequest(1)\fP, \fBjx\-create\-quickstart(1)\fP, \fBjx\-create\-spring(1)\fP


.SH HISTORY
.PP
Auto generated by spf13/cobra
07070100000064000081A4000000000000000000000001683E350C00000153000000000000000000000000000000000000002D00000000jenkins-x-cli-3.11.92/docs/man/man1/jx-ctx.1.TH "JX\-CTX" "1" "" "Auto generated by spf13/cobra" "" 
.nh
.ad l


.SH NAME
.PP
jx\-ctx \- alias for: jx context


.SH SYNOPSIS
.PP
\fBjx ctx\fP


.SH DESCRIPTION
.PP
alias for: jx context


.SH OPTIONS
.PP
\fB\-h\fP, \fB\-\-help\fP[=false]
    help for ctx


.SH SEE ALSO
.PP
\fBjx(1)\fP


.SH HISTORY
.PP
Auto generated by spf13/cobra
07070100000065000081A4000000000000000000000001683E350C000004FE000000000000000000000000000000000000003300000000jenkins-x-cli-3.11.92/docs/man/man1/jx-dashboard.1.TH "JX\-DASHBOARD" "1" "" "Auto generated by spf13/cobra" "" 
.nh
.ad l


.SH NAME
.PP
jx\-dashboard \- View the Jenkins X Pipelines Dashboard


.SH SYNOPSIS
.PP
\fBjx dashboard\fP


.SH DESCRIPTION
.PP
View the Jenkins X Pipelines Dashboard.


.SH OPTIONS
.PP
\fB\-b\fP, \fB\-\-batch\-mode\fP[=false]
    Runs in batch mode without prompting for user input

.PP
\fB\-h\fP, \fB\-\-help\fP[=false]
    help for dashboard

.PP
\fB\-\-log\-level\fP=""
    Sets the logging level. If not specified defaults to $JX\_LOG\_LEVEL

.PP
\fB\-n\fP, \fB\-\-name\fP="jx\-pipelines\-visualizer"
    The name of the dashboard service

.PP
\fB\-\-no\-open\fP[=false]
    Disable opening the URL; just show it on the console

.PP
\fB\-s\fP, \fB\-\-secret\fP="jx\-basic\-auth\-user\-password"
    The name of the Secret containing the basic auth login/password

.PP
\fB\-\-verbose\fP[=false]
    Enables verbose output. The environment variable JX\_LOG\_LEVEL has precedence over this flag and allows setting the logging level to any value of: panic, fatal, error, warn, info, debug, trace


.SH EXAMPLE
.PP
# open the dashboard
  jx dashboard

.PP
# display the URL only without opening a browser
  jx \-\-no\-open


.SH SEE ALSO
.PP
\fBjx(1)\fP


.SH HISTORY
.PP
Auto generated by spf13/cobra
07070100000066000081A4000000000000000000000001683E350C0000019A000000000000000000000000000000000000003800000000jenkins-x-cli-3.11.92/docs/man/man1/jx-get-activities.1.TH "JX\-GET\-ACTIVITIES" "1" "" "Auto generated by spf13/cobra" "" 
.nh
.ad l


.SH NAME
.PP
jx\-get\-activities \- alias for: jx pipeline activities


.SH SYNOPSIS
.PP
\fBjx get activities\fP


.SH DESCRIPTION
.PP
alias for: jx pipeline activities


.SH OPTIONS
.PP
\fB\-h\fP, \fB\-\-help\fP[=false]
    help for activities


.SH SEE ALSO
.PP
\fBjx\-get(1)\fP


.SH HISTORY
.PP
Auto generated by spf13/cobra
07070100000067000081A4000000000000000000000001683E350C00000196000000000000000000000000000000000000003900000000jenkins-x-cli-3.11.92/docs/man/man1/jx-get-application.1.TH "JX\-GET\-APPLICATION" "1" "" "Auto generated by spf13/cobra" "" 
.nh
.ad l


.SH NAME
.PP
jx\-get\-application \- alias for: jx application get


.SH SYNOPSIS
.PP
\fBjx get application\fP


.SH DESCRIPTION
.PP
alias for: jx application get


.SH OPTIONS
.PP
\fB\-h\fP, \fB\-\-help\fP[=false]
    help for application


.SH SEE ALSO
.PP
\fBjx\-get(1)\fP


.SH HISTORY
.PP
Auto generated by spf13/cobra
07070100000068000081A4000000000000000000000001683E350C00000191000000000000000000000000000000000000003800000000jenkins-x-cli-3.11.92/docs/man/man1/jx-get-build-logs.1.TH "JX\-GET\-BUILD\-LOGS" "1" "" "Auto generated by spf13/cobra" "" 
.nh
.ad l


.SH NAME
.PP
jx\-get\-build\-logs \- alias for: jx pipeline logs


.SH SYNOPSIS
.PP
\fBjx get build logs\fP


.SH DESCRIPTION
.PP
alias for: jx pipeline logs


.SH OPTIONS
.PP
\fB\-h\fP, \fB\-\-help\fP[=false]
    help for logs


.SH SEE ALSO
.PP
\fBjx\-get\-build(1)\fP


.SH HISTORY
.PP
Auto generated by spf13/cobra
07070100000069000081A4000000000000000000000001683E350C00000191000000000000000000000000000000000000003800000000jenkins-x-cli-3.11.92/docs/man/man1/jx-get-build-pods.1.TH "JX\-GET\-BUILD\-PODS" "1" "" "Auto generated by spf13/cobra" "" 
.nh
.ad l


.SH NAME
.PP
jx\-get\-build\-pods \- alias for: jx pipeline pods


.SH SYNOPSIS
.PP
\fBjx get build pods\fP


.SH DESCRIPTION
.PP
alias for: jx pipeline pods


.SH OPTIONS
.PP
\fB\-h\fP, \fB\-\-help\fP[=false]
    help for pods


.SH SEE ALSO
.PP
\fBjx\-get\-build(1)\fP


.SH HISTORY
.PP
Auto generated by spf13/cobra
0707010000006A000081A4000000000000000000000001683E350C00000203000000000000000000000000000000000000003300000000jenkins-x-cli-3.11.92/docs/man/man1/jx-get-build.1.TH "JX\-GET\-BUILD" "1" "" "Auto generated by spf13/cobra" "" 
.nh
.ad l


.SH NAME
.PP
jx\-get\-build \- Display one or more resources relating to a pipeline build


.SH SYNOPSIS
.PP
\fBjx get build TYPE [flags]\fP


.SH DESCRIPTION
.PP
Display one or more resources relating to a pipeline build


.SH OPTIONS
.PP
\fB\-h\fP, \fB\-\-help\fP[=false]
    help for build


.SH SEE ALSO
.PP
\fBjx\-get(1)\fP, \fBjx\-get\-build\-logs(1)\fP, \fBjx\-get\-build\-pods(1)\fP


.SH HISTORY
.PP
Auto generated by spf13/cobra
0707010000006B000081A4000000000000000000000001683E350C00000188000000000000000000000000000000000000003700000000jenkins-x-cli-3.11.92/docs/man/man1/jx-get-pipelines.1.TH "JX\-GET\-PIPELINES" "1" "" "Auto generated by spf13/cobra" "" 
.nh
.ad l


.SH NAME
.PP
jx\-get\-pipelines \- alias for: jx pipeline get


.SH SYNOPSIS
.PP
\fBjx get pipelines\fP


.SH DESCRIPTION
.PP
alias for: jx pipeline get


.SH OPTIONS
.PP
\fB\-h\fP, \fB\-\-help\fP[=false]
    help for pipelines


.SH SEE ALSO
.PP
\fBjx\-get(1)\fP


.SH HISTORY
.PP
Auto generated by spf13/cobra
0707010000006C000081A4000000000000000000000001683E350C00000182000000000000000000000000000000000000003600000000jenkins-x-cli-3.11.92/docs/man/man1/jx-get-previews.1.TH "JX\-GET\-PREVIEWS" "1" "" "Auto generated by spf13/cobra" "" 
.nh
.ad l


.SH NAME
.PP
jx\-get\-previews \- alias for: jx preview get


.SH SYNOPSIS
.PP
\fBjx get previews\fP


.SH DESCRIPTION
.PP
alias for: jx preview get


.SH OPTIONS
.PP
\fB\-h\fP, \fB\-\-help\fP[=false]
    help for previews


.SH SEE ALSO
.PP
\fBjx\-get(1)\fP


.SH HISTORY
.PP
Auto generated by spf13/cobra
0707010000006D000081A4000000000000000000000001683E350C000001FF000000000000000000000000000000000000002D00000000jenkins-x-cli-3.11.92/docs/man/man1/jx-get.1.TH "JX\-GET" "1" "" "Auto generated by spf13/cobra" "" 
.nh
.ad l


.SH NAME
.PP
jx\-get \- Display one or more resources


.SH SYNOPSIS
.PP
\fBjx get TYPE [flags]\fP


.SH DESCRIPTION
.PP
Display one or more resources


.SH OPTIONS
.PP
\fB\-h\fP, \fB\-\-help\fP[=false]
    help for get


.SH SEE ALSO
.PP
\fBjx(1)\fP, \fBjx\-get\-activities(1)\fP, \fBjx\-get\-application(1)\fP, \fBjx\-get\-build(1)\fP, \fBjx\-get\-pipelines(1)\fP, \fBjx\-get\-previews(1)\fP


.SH HISTORY
.PP
Auto generated by spf13/cobra
0707010000006E000081A4000000000000000000000001683E350C0000016D000000000000000000000000000000000000003000000000jenkins-x-cli-3.11.92/docs/man/man1/jx-import.1.TH "JX\-IMPORT" "1" "" "Auto generated by spf13/cobra" "" 
.nh
.ad l


.SH NAME
.PP
jx\-import \- alias for: jx project import


.SH SYNOPSIS
.PP
\fBjx import\fP


.SH DESCRIPTION
.PP
alias for: jx project import


.SH OPTIONS
.PP
\fB\-h\fP, \fB\-\-help\fP[=false]
    help for import


.SH SEE ALSO
.PP
\fBjx(1)\fP


.SH HISTORY
.PP
Auto generated by spf13/cobra
0707010000006F000081A4000000000000000000000001683E350C00000560000000000000000000000000000000000000003300000000jenkins-x-cli-3.11.92/docs/man/man1/jx-namespace.1.TH "JX\-NAMESPACE" "1" "" "Auto generated by spf13/cobra" "" 
.nh
.ad l


.SH NAME
.PP
jx\-namespace \- View or change the current namespace context in the current Kubernetes cluster


.SH SYNOPSIS
.PP
\fBjx namespace\fP


.SH DESCRIPTION
.PP
Displays or changes the current namespace.


.SH OPTIONS
.PP
\fB\-b\fP, \fB\-\-batch\-mode\fP[=false]
    Enables batch mode

.PP
\fB\-c\fP, \fB\-\-create\fP[=false]
    Creates the specified namespace if it does not exist

.PP
\fB\-e\fP, \fB\-\-env\fP=""
    The Environment name to switch to the namepsace

.PP
\fB\-h\fP, \fB\-\-help\fP[=false]
    help for namespace

.PP
\fB\-v\fP, \fB\-\-pick\fP[=false]
    Pick the Environment to switch to

.PP
\fB\-q\fP, \fB\-\-quiet\fP[=false]
    Do not fail if the namespace does not exist


.SH EXAMPLE
.PP
# view the current namespace
  jx \-\-batch\-mode ns

.PP
# interactively select the namespace to switch to
  jx ns

.PP
# change the current namespace to 'cheese'
  jx ns cheese

.PP
# change the current namespace to 'brie' creating it if necessary
  jx ns \-\-create brie

.PP
# switch to the namespace of the staging environment
  jx ns \-\-env staging

.PP
# switch back to the dev environment namespace
  jx ns \-\-e dev

.PP
# interactively select the Environment to switch to
  jx ns \-\-pick


.SH SEE ALSO
.PP
\fBjx(1)\fP


.SH HISTORY
.PP
Auto generated by spf13/cobra
07070100000070000081A4000000000000000000000001683E350C00000190000000000000000000000000000000000000003800000000jenkins-x-cli-3.11.92/docs/man/man1/jx-start-pipeline.1.TH "JX\-START\-PIPELINE" "1" "" "Auto generated by spf13/cobra" "" 
.nh
.ad l


.SH NAME
.PP
jx\-start\-pipeline \- alias for: jx pipeline start


.SH SYNOPSIS
.PP
\fBjx start pipeline\fP


.SH DESCRIPTION
.PP
alias for: jx pipeline start


.SH OPTIONS
.PP
\fB\-h\fP, \fB\-\-help\fP[=false]
    help for pipeline


.SH SEE ALSO
.PP
\fBjx\-start(1)\fP


.SH HISTORY
.PP
Auto generated by spf13/cobra
07070100000071000081A4000000000000000000000001683E350C0000017E000000000000000000000000000000000000002F00000000jenkins-x-cli-3.11.92/docs/man/man1/jx-start.1.TH "JX\-START" "1" "" "Auto generated by spf13/cobra" "" 
.nh
.ad l


.SH NAME
.PP
jx\-start \- Starts a resource


.SH SYNOPSIS
.PP
\fBjx start TYPE [flags]\fP


.SH DESCRIPTION
.PP
Starts a resource


.SH OPTIONS
.PP
\fB\-h\fP, \fB\-\-help\fP[=false]
    help for start


.SH SEE ALSO
.PP
\fBjx(1)\fP, \fBjx\-start\-pipeline(1)\fP


.SH HISTORY
.PP
Auto generated by spf13/cobra
07070100000072000081A4000000000000000000000001683E350C0000018A000000000000000000000000000000000000003700000000jenkins-x-cli-3.11.92/docs/man/man1/jx-stop-pipeline.1.TH "JX\-STOP\-PIPELINE" "1" "" "Auto generated by spf13/cobra" "" 
.nh
.ad l


.SH NAME
.PP
jx\-stop\-pipeline \- alias for: jx pipeline stop


.SH SYNOPSIS
.PP
\fBjx stop pipeline\fP


.SH DESCRIPTION
.PP
alias for: jx pipeline stop


.SH OPTIONS
.PP
\fB\-h\fP, \fB\-\-help\fP[=false]
    help for pipeline


.SH SEE ALSO
.PP
\fBjx\-stop(1)\fP


.SH HISTORY
.PP
Auto generated by spf13/cobra
07070100000073000081A4000000000000000000000001683E350C00000177000000000000000000000000000000000000002E00000000jenkins-x-cli-3.11.92/docs/man/man1/jx-stop.1.TH "JX\-STOP" "1" "" "Auto generated by spf13/cobra" "" 
.nh
.ad l


.SH NAME
.PP
jx\-stop \- Stops a resource


.SH SYNOPSIS
.PP
\fBjx stop TYPE [flags]\fP


.SH DESCRIPTION
.PP
Stops a resource


.SH OPTIONS
.PP
\fB\-h\fP, \fB\-\-help\fP[=false]
    help for stop


.SH SEE ALSO
.PP
\fBjx(1)\fP, \fBjx\-stop\-pipeline(1)\fP


.SH HISTORY
.PP
Auto generated by spf13/cobra
07070100000074000081A4000000000000000000000001683E350C000004ED000000000000000000000000000000000000002C00000000jenkins-x-cli-3.11.92/docs/man/man1/jx-ui.1.TH "JX\-UI" "1" "" "Auto generated by spf13/cobra" "" 
.nh
.ad l


.SH NAME
.PP
jx\-ui \- Views the Jenkins X UI (octant)


.SH SYNOPSIS
.PP
\fBjx ui\fP


.SH DESCRIPTION
.PP
Views the Jenkins X UI (octant).


.SH OPTIONS
.PP
\fB\-b\fP, \fB\-\-batch\-mode\fP[=false]
    Runs in batch mode without prompting for user input

.PP
\fB\-p\fP, \fB\-\-browser\-path\fP="/#/jx/pipelines\-recent"
    The browser path inside octant to open

.PP
\fB\-h\fP, \fB\-\-help\fP[=false]
    help for ui

.PP
\fB\-\-host\fP=""
    The host to listen on

.PP
\fB\-\-log\-level\fP=""
    Sets the logging level. If not specified defaults to $JX\_LOG\_LEVEL

.PP
\fB\-o\fP, \fB\-\-octant\-args\fP=[\-\-namespace=jx]
    Extra arguments passed to the octant binary

.PP
\fB\-\-port\fP=0
    The port for octant to listen on

.PP
\fB\-\-verbose\fP[=false]
    Enables verbose output. The environment variable JX\_LOG\_LEVEL has precedence over this flag and allows setting the logging level to any value of: panic, fatal, error, warn, info, debug, trace


.SH EXAMPLE
.PP
# open the UI
  jx ui
  # To pass arguments to octant
  jx ui \-o \-\-namespace=jx \-o \-v \-o \-\-browser\-path="/#/jx/pipelines"


.SH SEE ALSO
.PP
\fBjx(1)\fP


.SH HISTORY
.PP
Auto generated by spf13/cobra
07070100000075000081A4000000000000000000000001683E350C0000037F000000000000000000000000000000000000003500000000jenkins-x-cli-3.11.92/docs/man/man1/jx-upgrade-cli.1.TH "JX\-UPGRADE\-CLI" "1" "" "Auto generated by spf13/cobra" "" 
.nh
.ad l


.SH NAME
.PP
jx\-upgrade\-cli \- Upgrades your local Jenkins X CLI


.SH SYNOPSIS
.PP
\fBjx upgrade cli\fP


.SH DESCRIPTION
.PP
Upgrades your local Jenkins X CLI


.SH OPTIONS
.PP
\fB\-e\fP, \fB\-\-from\-environment\fP[=false]
    Use the clusters dev environment to obtain the version stream URL to find correct version to upgrade the jx cli, this overrides version\-stream\-git\-url

.PP
\fB\-h\fP, \fB\-\-help\fP[=false]
    help for cli

.PP
\fB\-v\fP, \fB\-\-version\fP=""
    The specific version to upgrade to (requires \-\-brew=false on macOS)

.PP
\fB\-\-version\-stream\-git\-url\fP=""
    The version stream git URL to lookup the jx cli version to upgrade to


.SH EXAMPLE
.PP
# upgrades your jx CLI
  jx upgrade cli


.SH SEE ALSO
.PP
\fBjx\-upgrade(1)\fP


.SH HISTORY
.PP
Auto generated by spf13/cobra
07070100000076000081A4000000000000000000000001683E350C0000030C000000000000000000000000000000000000003900000000jenkins-x-cli-3.11.92/docs/man/man1/jx-upgrade-plugins.1.TH "JX\-UPGRADE\-PLUGINS" "1" "" "Auto generated by spf13/cobra" "" 
.nh
.ad l


.SH NAME
.PP
jx\-upgrade\-plugins \- Upgrades all of the plugins in your local Jenkins X CLI


.SH SYNOPSIS
.PP
\fBjx upgrade plugins\fP


.SH DESCRIPTION
.PP
Upgrades all of the plugins in your local Jenkins X CLI


.SH OPTIONS
.PP
\fB\-\-boot\fP[=false]
    only install plugins required for boot

.PP
\fB\-h\fP, \fB\-\-help\fP[=false]
    help for plugins

.PP
\fB\-m\fP, \fB\-\-mandatory\fP[=false]
    if set lets ignore optional plugins

.PP
\fB\-\-path\fP="/usr/bin"
    creates a symlink to the binary plugins in this bin path dir


.SH EXAMPLE
.PP
# upgrades your plugin binaries
  jx upgrade plugins


.SH SEE ALSO
.PP
\fBjx\-upgrade(1)\fP


.SH HISTORY
.PP
Auto generated by spf13/cobra
07070100000077000081A4000000000000000000000001683E350C000001FB000000000000000000000000000000000000003100000000jenkins-x-cli-3.11.92/docs/man/man1/jx-upgrade.1.TH "JX\-UPGRADE" "1" "" "Auto generated by spf13/cobra" "" 
.nh
.ad l


.SH NAME
.PP
jx\-upgrade \- Upgrades resources


.SH SYNOPSIS
.PP
\fBjx upgrade\fP


.SH DESCRIPTION
.PP
Upgrades all of the plugins in your local Jenkins X CLI


.SH OPTIONS
.PP
\fB\-h\fP, \fB\-\-help\fP[=false]
    help for upgrade


.SH EXAMPLE
.PP
# upgrades your plugin binaries
  jx upgrade


.SH SEE ALSO
.PP
\fBjx(1)\fP, \fBjx\-upgrade\-cli(1)\fP, \fBjx\-upgrade\-plugins(1)\fP


.SH HISTORY
.PP
Auto generated by spf13/cobra
07070100000078000081A4000000000000000000000001683E350C0000025B000000000000000000000000000000000000003100000000jenkins-x-cli-3.11.92/docs/man/man1/jx-version.1.TH "JX\-VERSION" "1" "" "Auto generated by spf13/cobra" "" 
.nh
.ad l


.SH NAME
.PP
jx\-version \- Displays the version of this command


.SH SYNOPSIS
.PP
\fBjx version\fP


.SH DESCRIPTION
.PP
Displays the version of this command


.SH OPTIONS
.PP
\fB\-h\fP, \fB\-\-help\fP[=false]
    help for version

.PP
\fB\-q\fP, \fB\-\-quiet\fP[=false]
    uses the quiet format of just outputting the version number only

.PP
\fB\-s\fP, \fB\-\-short\fP[=false]
    uses the short format of just outputting the version number only


.SH SEE ALSO
.PP
\fBjx(1)\fP


.SH HISTORY
.PP
Auto generated by spf13/cobra
07070100000079000081A4000000000000000000000001683E350C00000235000000000000000000000000000000000000002900000000jenkins-x-cli-3.11.92/docs/man/man1/jx.1.TH "JX" "1" "" "Auto generated by spf13/cobra" "" 
.nh
.ad l


.SH NAME
.PP
jx \- Jenkins X 3.x command line


.SH SYNOPSIS
.PP
\fBjx\fP


.SH DESCRIPTION
.PP
Jenkins X 3.x command line


.SH OPTIONS
.PP
\fB\-h\fP, \fB\-\-help\fP[=false]
    help for jx


.SH SEE ALSO
.PP
\fBjx\-add(1)\fP, \fBjx\-create(1)\fP, \fBjx\-ctx(1)\fP, \fBjx\-dashboard(1)\fP, \fBjx\-get(1)\fP, \fBjx\-import(1)\fP, \fBjx\-namespace(1)\fP, \fBjx\-start(1)\fP, \fBjx\-stop(1)\fP, \fBjx\-ui(1)\fP, \fBjx\-upgrade(1)\fP, \fBjx\-version(1)\fP


.SH HISTORY
.PP
Auto generated by spf13/cobra
0707010000007A000081A4000000000000000000000001683E350C0000109D000000000000000000000000000000000000001D00000000jenkins-x-cli-3.11.92/go.modmodule github.com/jenkins-x/jx

require (
	github.com/blang/semver v3.5.1+incompatible
	github.com/cpuguy83/go-md2man v1.0.10
	github.com/jenkins-x/jx-api/v4 v4.7.6
	github.com/jenkins-x/jx-helpers/v3 v3.8.0
	github.com/jenkins-x/jx-kube-client/v3 v3.0.8
	github.com/jenkins-x/jx-logging/v3 v3.0.17
	github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4
	github.com/rhysd/go-github-selfupdate v1.2.3
	github.com/spf13/cobra v1.8.1
	github.com/spf13/pflag v1.0.5
	github.com/stretchr/testify v1.9.0
	k8s.io/api v0.31.2
	k8s.io/apimachinery v0.31.2
	k8s.io/client-go v0.31.2
	sigs.k8s.io/kustomize/kyaml v0.17.1

)

require (
	dario.cat/mergo v1.0.0 // indirect
	github.com/AlecAivazis/survey/v2 v2.3.4 // indirect
	github.com/MakeNowJust/heredoc v1.0.0 // indirect
	github.com/cenkalti/backoff v2.2.1+incompatible // indirect
	github.com/creack/pty v1.1.18 // indirect
	github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
	github.com/emicklei/go-restful/v3 v3.12.1 // indirect
	github.com/fatih/color v1.15.0 // indirect
	github.com/fxamacker/cbor/v2 v2.7.0 // indirect
	github.com/ghodss/yaml v1.0.0 // indirect
	github.com/go-errors/errors v1.4.2 // indirect
	github.com/go-logr/logr v1.4.2 // indirect
	github.com/go-openapi/jsonpointer v0.21.0 // indirect
	github.com/go-openapi/jsonreference v0.21.0 // indirect
	github.com/go-openapi/swag v0.23.0 // indirect
	github.com/go-stack/stack v1.8.1 // indirect
	github.com/gogo/protobuf v1.3.2 // indirect
	github.com/golang/glog v1.2.4 // indirect
	github.com/golang/protobuf v1.5.4 // indirect
	github.com/google/gnostic-models v0.6.8 // indirect
	github.com/google/go-cmp v0.6.0 // indirect
	github.com/google/go-github/v30 v30.1.0 // indirect
	github.com/google/go-querystring v1.0.0 // indirect
	github.com/google/gofuzz v1.2.0 // indirect
	github.com/google/uuid v1.6.0 // indirect
	github.com/imdario/mergo v0.3.16 // indirect
	github.com/inconshreveable/go-update v0.0.0-20160112193335-8152e7eb6ccf // indirect
	github.com/inconshreveable/mousetrap v1.1.0 // indirect
	github.com/jenkins-x/logrus-stackdriver-formatter v0.2.7 // indirect
	github.com/josharian/intern v1.0.0 // indirect
	github.com/json-iterator/go v1.1.12 // indirect
	github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
	github.com/mailru/easyjson v0.7.7 // indirect
	github.com/mattn/go-colorable v0.1.13 // indirect
	github.com/mattn/go-isatty v0.0.17 // indirect
	github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect
	github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
	github.com/modern-go/reflect2 v1.0.2 // indirect
	github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
	github.com/pkg/errors v0.9.1 // indirect
	github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
	github.com/rawlingsj/jsonschema v0.0.0-20210511142122-a9c2cfdb7dcf // indirect
	github.com/russross/blackfriday v1.6.0 // indirect
	github.com/sirupsen/logrus v1.9.3 // indirect
	github.com/tcnksm/go-gitconfig v0.1.2 // indirect
	github.com/ulikunitz/xz v0.5.9 // indirect
	github.com/vrischmann/envconfig v1.3.0 // indirect
	github.com/x448/float16 v0.8.4 // indirect
	github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
	github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
	github.com/xeipuuv/gojsonschema v1.2.0 // indirect
	golang.org/x/crypto v0.31.0 // indirect
	golang.org/x/net v0.33.0 // indirect
	golang.org/x/oauth2 v0.23.0 // indirect
	golang.org/x/sys v0.28.0 // indirect
	golang.org/x/term v0.27.0 // indirect
	golang.org/x/text v0.21.0 // indirect
	golang.org/x/time v0.7.0 // indirect
	google.golang.org/protobuf v1.35.1 // indirect
	gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
	gopkg.in/inf.v0 v0.9.1 // indirect
	gopkg.in/yaml.v2 v2.4.0 // indirect
	gopkg.in/yaml.v3 v3.0.1 // indirect
	k8s.io/klog/v2 v2.130.1 // indirect
	k8s.io/kube-openapi v0.0.0-20241009091222-67ed5848f094 // indirect
	k8s.io/utils v0.0.0-20240921022957-49e7df575cb6 // indirect
	sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 // indirect
	sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
	sigs.k8s.io/yaml v1.4.0 // indirect
)

go 1.23
0707010000007B000081A4000000000000000000000001683E350C000065AC000000000000000000000000000000000000001D00000000jenkins-x-cli-3.11.92/go.sumdario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk=
dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk=
github.com/AlecAivazis/survey/v2 v2.3.4 h1:pchTU9rsLUSvWEl2Aq9Pv3k0IE2fkqtGxazskAMd9Ng=
github.com/AlecAivazis/survey/v2 v2.3.4/go.mod h1:hrV6Y/kQCLhIZXGcriDCUBtB3wnN7156gMXJ3+b23xM=
github.com/MakeNowJust/heredoc v1.0.0 h1:cXCdzVdstXyiTqTvfqk9SDHpKNjxuom+DOlyEeQ4pzQ=
github.com/MakeNowJust/heredoc v1.0.0/go.mod h1:mG5amYoWBHf8vpLOuehzbGGw0EHxpZZ6lCpQ4fNJ8LE=
github.com/Netflix/go-expect v0.0.0-20220104043353-73e0943537d2 h1:+vx7roKuyA63nhn5WAunQHLTznkw5W8b1Xc0dNjp83s=
github.com/Netflix/go-expect v0.0.0-20220104043353-73e0943537d2/go.mod h1:HBCaDeC1lPdgDeDbhX8XFpy1jqjK0IBG8W5K+xYqA0w=
github.com/TV4/logrus-stackdriver-formatter v0.1.0 h1:nFea8RiX7ecTnWPM+9FIqwZYJdcGo58CHMGIVdYzMXg=
github.com/TV4/logrus-stackdriver-formatter v0.1.0/go.mod h1:wwS7hOiBvP6SBD0UXCa767+VhHkaXrfX0MzUojYcN0Q=
github.com/blang/semver v3.5.1+incompatible h1:cQNTCjp13qL8KC3Nbxr/y2Bqb63oX6wdnnjpJbkM4JQ=
github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk=
github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4=
github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM=
github.com/cpuguy83/go-md2man v1.0.10 h1:BSKMNlYxDvnunlTymqtgONjNnaRV1sTpcovwwjF22jk=
github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE=
github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/creack/pty v1.1.17/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4=
github.com/creack/pty v1.1.18 h1:n56/Zwd5o6whRC5PMGretI4IdRLlmBXYNjScPaBgsbY=
github.com/creack/pty v1.1.18/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/emicklei/go-restful/v3 v3.12.1 h1:PJMDIM/ak7btuL8Ex0iYET9hxM3CI2sjZtzpL63nKAU=
github.com/emicklei/go-restful/v3 v3.12.1/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc=
github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs=
github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/fxamacker/cbor/v2 v2.7.0 h1:iM5WgngdRBanHcxugY4JySA0nk1wZorNOpTgCMedv5E=
github.com/fxamacker/cbor/v2 v2.7.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ=
github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA=
github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og=
github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY=
github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
github.com/go-openapi/jsonpointer v0.21.0 h1:YgdVicSA9vH5RiHs9TZW5oyafXZFc6+2Vc1rr/O9oNQ=
github.com/go-openapi/jsonpointer v0.21.0/go.mod h1:IUyH9l/+uyhIYQ/PXVA41Rexl+kOkAPDdXEYns6fzUY=
github.com/go-openapi/jsonreference v0.21.0 h1:Rs+Y7hSXT83Jacb7kFyjn4ijOuVGSvOdF2+tg1TRrwQ=
github.com/go-openapi/jsonreference v0.21.0/go.mod h1:LmZmgsrTkVg9LG4EaHeY8cBDslNPMo06cago5JNLkm4=
github.com/go-openapi/swag v0.23.0 h1:vsEVJDUo2hPJ2tu0/Xc+4noaxyEffXNIs3cOULZ+GrE=
github.com/go-openapi/swag v0.23.0/go.mod h1:esZ8ITTYEsH1V2trKHjAN8Ai7xHb8RV+YSZ577vPjgQ=
github.com/go-stack/stack v1.8.1 h1:ntEHSVwIt7PNXNpgPmVfMrNhLtgjlmnZha2kOpuRiDw=
github.com/go-stack/stack v1.8.1/go.mod h1:dcoOX6HbPZSZptuspn9bctJ+N/CnF5gGygcUP3XYfe4=
github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI=
github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8=
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
github.com/golang/glog v1.2.4 h1:CNNw5U8lSiiBk7druxtSHHTsRWcxKoac6kZKm2peBBc=
github.com/golang/glog v1.2.4/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
github.com/google/gnostic-models v0.6.8 h1:yo/ABAfM5IMRsS1VnXjTBvUb61tFIHozhlYvRgGre9I=
github.com/google/gnostic-models v0.6.8/go.mod h1:5n7qKqH0f5wFt+aWF8CW6pZLLNOfYuF5OpfBSENuI8U=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-github/v30 v30.1.0 h1:VLDx+UolQICEOKu2m4uAoMti1SxuEBAl7RSEG16L+Oo=
github.com/google/go-github/v30 v30.1.0/go.mod h1:n8jBpHl45a/rlBUtRJMOG4GhNADUQFEufcolZ95JfU8=
github.com/google/go-querystring v1.0.0 h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASuANWTrk=
github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0=
github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/pprof v0.0.0-20240727154555-813a5fbdbec8 h1:FKHo8hFI3A+7w0aUQuYXQ+6EN5stWmeY/AZqtM8xk9k=
github.com/google/pprof v0.0.0-20240727154555-813a5fbdbec8/go.mod h1:K1liHPHnj73Fdn/EKuT8nrFqBihUSKXoLYU0BuatOYo=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/hinshun/vt10x v0.0.0-20220119200601-820417d04eec h1:qv2VnGeEQHchGaZ/u7lxST/RaJw+cv273q79D81Xbog=
github.com/hinshun/vt10x v0.0.0-20220119200601-820417d04eec/go.mod h1:Q48J4R4DvxnHolD5P8pOtXigYlRuPLGl6moFx3ulM68=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/imdario/mergo v0.3.16 h1:wwQJbIsHYGMUyLSPrEq1CT16AhnhNJQ51+4fdHUnCl4=
github.com/imdario/mergo v0.3.16/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY=
github.com/inconshreveable/go-update v0.0.0-20160112193335-8152e7eb6ccf h1:WfD7VjIE6z8dIvMsI4/s+1qr5EL+zoIGev1BQj1eoJ8=
github.com/inconshreveable/go-update v0.0.0-20160112193335-8152e7eb6ccf/go.mod h1:hyb9oH7vZsitZCiBt0ZvifOrB+qc8PS5IiilCIb87rg=
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/jenkins-x/jx-api/v4 v4.7.6 h1:+SJwYn/uF7CwbC5cD399zLjcM+VEgJMS89QL8ixa0WY=
github.com/jenkins-x/jx-api/v4 v4.7.6/go.mod h1:qBBQ+CUsclk9O8vV0dksPpyKgS0wXe7O/3Tzm9xxRiA=
github.com/jenkins-x/jx-helpers/v3 v3.8.0 h1:1xrEhyMeFUBDME3Filt7Co2tGjID5EOMnSo3HAhVM+M=
github.com/jenkins-x/jx-helpers/v3 v3.8.0/go.mod h1:4FcqDU6+PXksYHJkmlCMrlnriR1LsnLKZ2coXVzCrXE=
github.com/jenkins-x/jx-kube-client/v3 v3.0.8 h1:AzXuXCdv4DQf8wqR5c1UL0uXVu6KrAjdPtPb6wrG0Hs=
github.com/jenkins-x/jx-kube-client/v3 v3.0.8/go.mod h1:ELgPjZhMqYiCKml4L16GREF6bkC890KRKfpNCz+aIgE=
github.com/jenkins-x/jx-logging/v3 v3.0.17 h1:0qpgKfpxl4uks6vZZV5LCGCOOD3axgMxoK3m6X74kpQ=
github.com/jenkins-x/jx-logging/v3 v3.0.17/go.mod h1:vUW4EJxE8TowVsFhcwcpKag189ZS5J25a3kyMPq1mYM=
github.com/jenkins-x/logrus-stackdriver-formatter v0.2.7 h1:waTRYQoVXfRZXs1SVGgk8hcHdlBZOP8rJJLYg33up6k=
github.com/jenkins-x/logrus-stackdriver-formatter v0.2.7/go.mod h1:4xQdtL7MXIiluYFTF1cP7c0IZdLv5UMJv3h1ttgH72w=
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs=
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8=
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng=
github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE=
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d h1:5PJl274Y63IEHC+7izoQE9x6ikvDFZS2mDVS3drnohI=
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.14.0 h1:2mOpI4JVVPBN+WQRa0WKH2eXR+Ey+uK4n7Zj0aYpIQA=
github.com/onsi/ginkgo/v2 v2.19.0 h1:9Cnnf7UHo57Hy3k6/m5k3dRfGTMXGvxhHFvkDTCTpvA=
github.com/onsi/ginkgo/v2 v2.19.0/go.mod h1:rlwLi9PilAFJ8jCg9UE1QP6VBpd6/xj3SRC0d6TU0To=
github.com/onsi/gomega v1.4.2/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/onsi/gomega v1.33.1 h1:dsYjIxxSR755MDmKVsaFQTE22ChNBcuuTWgkUDSubOk=
github.com/onsi/gomega v1.33.1/go.mod h1:U4R44UsT+9eLIaYRB2a5qajjtQYn0hauxvRm16AVYg0=
github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4 h1:49lOXmGaUpV9Fz3gd7TFZY106KVlPVa5jcYD1gaQf98=
github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4/go.mod h1:4OwLy04Bl9Ef3GJJCoec+30X3LQs/0/m4HFRt/2LUSA=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rawlingsj/jsonschema v0.0.0-20210511142122-a9c2cfdb7dcf h1:YPl5D1RlBkDDxJBodNwBtzBnqDQobrDJcs/2x3Grfts=
github.com/rawlingsj/jsonschema v0.0.0-20210511142122-a9c2cfdb7dcf/go.mod h1:8LFgdjjkhuo3+T0/kprWPWGqh2+v8QC4hLyjNK6j15s=
github.com/rhysd/go-github-selfupdate v1.2.3 h1:iaa+J202f+Nc+A8zi75uccC8Wg3omaM7HDeimXA22Ag=
github.com/rhysd/go-github-selfupdate v1.2.3/go.mod h1:mp/N8zj6jFfBQy/XMYoWsmfzxazpPAODuqarmPDe2Rg=
github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8=
github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4=
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
github.com/russross/blackfriday v1.6.0 h1:KqfZb0pUVN2lYqZUYRddxF4OR8ZMURnJIG5Y3VRLtww=
github.com/russross/blackfriday v1.6.0/go.mod h1:ti0ldHuxg49ri4ksnFxlkCfN+hvslNlmVHqNRXXJNAY=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM=
github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/tcnksm/go-gitconfig v0.1.2 h1:iiDhRitByXAEyjgBqsKi9QU4o2TNtv9kPP3RgPgXBPw=
github.com/tcnksm/go-gitconfig v0.1.2/go.mod h1:/8EhP4H7oJZdIPyT+/UIsG87kTzrzM4UsLGSItWYCpE=
github.com/ulikunitz/xz v0.5.9 h1:RsKRIA2MO8x56wkkcd3LbtcE/uMszhb6DpRf+3uwa3I=
github.com/ulikunitz/xz v0.5.9/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
github.com/vrischmann/envconfig v1.3.0 h1:4XIvQTXznxmWMnjouj0ST5lFo/WAYf5Exgl3x82crEk=
github.com/vrischmann/envconfig v1.3.0/go.mod h1:bbvxFYJdRSpXrhS63mBFtKJzkDiNkyArOLXtY6q0kuI=
github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM=
github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg=
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb h1:zGWFAtiMcyryUHoUjUJX0/lt1H2+i2Ka2n+D3DImSNo=
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHovont7NscjpAxXsDA8S8BMYve8Y5+7cuRE7R0=
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ=
github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74=
github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U=
golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I=
golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20181106182150-f42d05182288/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.23.0 h1:PbgcYx2W7i4LvjJWEbf0ngHV6qJYr86PkAV3bXdLEbs=
golang.org/x/oauth2 v0.23.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA=
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/term v0.0.0-20210503060354-a79de5458b56/go.mod h1:tfny5GFUkzUvx4ps4ajbZsCe5lw1metzhBm9T3x7oIY=
golang.org/x/term v0.27.0 h1:WP60Sv1nlK1T6SupCHbXzSaN0b9wUmsPoRS9b61A23Q=
golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
golang.org/x/time v0.7.0 h1:ntUhktv3OPE6TgYxXWv9vKvUSJyIFJlyohwbkEwPrKQ=
golang.org/x/time v0.7.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.24.0 h1:J1shsA93PJUEVaUSaay7UXAyE8aimq3GW0pjlolpa24=
golang.org/x/tools v0.24.0/go.mod h1:YhNqVBIfWHdzvTLs0d8LCuMhkKUgSUKldakyV7W/WDQ=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
google.golang.org/appengine v1.3.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA=
google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/evanphx/json-patch.v4 v4.12.0 h1:n6jtcsulIzXPJaxegRbvFNNrZDjbij7ny3gmSPG+6V4=
gopkg.in/evanphx/json-patch.v4 v4.12.0/go.mod h1:p8EYWUEYMpynmqDbY58zCKCFZw8pRWMG4EsWvDvM72M=
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc=
gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
k8s.io/api v0.31.2 h1:3wLBbL5Uom/8Zy98GRPXpJ254nEFpl+hwndmk9RwmL0=
k8s.io/api v0.31.2/go.mod h1:bWmGvrGPssSK1ljmLzd3pwCQ9MgoTsRCuK35u6SygUk=
k8s.io/apimachinery v0.31.2 h1:i4vUt2hPK56W6mlT7Ry+AO8eEsyxMD1U44NR22CLTYw=
k8s.io/apimachinery v0.31.2/go.mod h1:rsPdaZJfTfLsNJSQzNHQvYoTmxhoOEofxtOsF3rtsMo=
k8s.io/client-go v0.31.2 h1:Y2F4dxU5d3AQj+ybwSMqQnpZH9F30//1ObxOKlTI9yc=
k8s.io/client-go v0.31.2/go.mod h1:NPa74jSVR/+eez2dFsEIHNa+3o09vtNaWwWwb1qSxSs=
k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk=
k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE=
k8s.io/kube-openapi v0.0.0-20241009091222-67ed5848f094 h1:MErs8YA0abvOqJ8gIupA1Tz6PKXYUw34XsGlA7uSL1k=
k8s.io/kube-openapi v0.0.0-20241009091222-67ed5848f094/go.mod h1:7ioBJr1A6igWjsR2fxq2EZ0mlMwYLejazSIc2bzMp2U=
k8s.io/utils v0.0.0-20240921022957-49e7df575cb6 h1:MDF6h2H/h4tbzmtIKTuctcwZmY0tY9mD9fNT47QO6HI=
k8s.io/utils v0.0.0-20240921022957-49e7df575cb6/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 h1:gBQPwqORJ8d8/YNZWEjoZs7npUVDpVXUUOFfW6CgAqE=
sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8/go.mod h1:mdzfpAEoE6DHQEN0uh9ZbOCuHbLK5wOm7dK4ctXE9Tg=
sigs.k8s.io/kustomize/kyaml v0.17.1 h1:TnxYQxFXzbmNG6gOINgGWQt09GghzgTP6mIurOgrLCQ=
sigs.k8s.io/kustomize/kyaml v0.17.1/go.mod h1:9V0mCjIEYjlXuCdYsSXvyoy2BTsLESH7TlGV81S282U=
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 h1:150L+0vs/8DA78h1u02ooW1/fFq/Lwr+sGiqlzvrtq4=
sigs.k8s.io/structured-merge-diff/v4 v4.4.1/go.mod h1:N8hJocpFajUSSeSJ9bOZ77VzejKZaXsTtZo4/u7Io08=
sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E=
sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY=
0707010000007C000041ED000000000000000000000002683E350C00000000000000000000000000000000000000000000001B00000000jenkins-x-cli-3.11.92/hack0707010000007D000081A4000000000000000000000001683E350C00000380000000000000000000000000000000000000002F00000000jenkins-x-cli-3.11.92/hack/changelog-header.md## Linux

### amd64

```shell
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
```

### arm

```shell
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
```

### arm64

```shell
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
```

## macOS

### Using homebrew

```shell
brew install --no-quarantine --cask jenkins-x/jx/jx
```

### Using curl

#### amd64

```shell
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
```

#### arm64

```shell
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
```
0707010000007E000081ED000000000000000000000001683E350C00000215000000000000000000000000000000000000003900000000jenkins-x-cli-3.11.92/hack/ensure-test-classification.sh#!/usr/bin/env bash

# get the dir of this scipt
dir=$(dirname "$0")

declare -a unclassified

while IFS= read -r -d '' file
do
  [ -z "$(sed -n '/^\/\/ +build/p;q' "$file")" ] && unclassified+=("$file")
done < <(find ${dir}/.. -name '*_test.go' -print0)

if [ "${#unclassified[@]}" -eq "0" ]; then
  echo "OK - all test files contain a build tag"
  exit 0
fi

echo "The following ${#unclassified[@]} test files are not classified with a valid Go build tag [unit|integration]"
for i in "${unclassified[@]}"
do
  echo "$i"
done
exit 10707010000007F000081ED000000000000000000000001683E350C00000207000000000000000000000000000000000000002700000000jenkins-x-cli-3.11.92/hack/generate.sh#!/bin/bash

set -e

RED='\033[0;31m'
GREEN='\033[0;32m'
RESET='\033[0m'

if ! [ -x "$(command -v goimports)" ]; then
	echo "Installing goimports"
    go install golang.org/x/tools/cmd/goimports
fi

echo "Running validation scripts..."

scripts=(
)
fail=0
for s in "${scripts[@]}"; do
    echo "RUN ${s}"
    set +e
    $s
    result=$?
    set -e
    if [[ $result  -eq 0 ]]; then
        echo -e "${GREEN}PASSED${RESET} ${s}"
    else
        echo -e "${RED}FAILED${RESET} ${s}"
        fail=1
    fi
done
exit $fail
07070100000080000081ED000000000000000000000001683E350C0000016F000000000000000000000000000000000000002400000000jenkins-x-cli-3.11.92/hack/gofmt.sh#!/bin/bash

files=$(find . -name "*.go" | grep -v vendor/ | grep -v ./pkg/client/openapi/all | grep -v Dockerfile | xargs gofmt -l -s)
if [[ $files ]]; then
    echo "Gofmt errors in files:"
    echo "$files"
    diff=$(find . -name "*.go" | grep -v vendor/ | grep -v ./pkg/client/openapi/all | grep -v Dockerfile | xargs gofmt -d -s)
    echo "$diff"
    exit 1
fi
07070100000081000081ED000000000000000000000001683E350C000001C3000000000000000000000000000000000000002500000000jenkins-x-cli-3.11.92/hack/linter.sh#!/bin/bash

set -e -o pipefail

if [ "$DISABLE_LINTER" == "true" ]
then
  exit 0
fi

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

linterVersion="$(golangci-lint --version | awk '{print $4}')"

expectedLinterVersion=1.50.1

if [ "${linterVersion}" != "${expectedLinterVersion}" ]; then
	echo "Install GolangCI-Lint version ${expectedLinterVersion}"
  exit 1
fi

export GO111MODULE=on
golangci-lint run \
  --verbose \
  --build-tags build
07070100000082000081ED000000000000000000000001683E350C00000281000000000000000000000000000000000000002C00000000jenkins-x-cli-3.11.92/hack/upload_plugin.sh#!/bin/bash

echo "uploading the plugin for version ${VERSION}"

echo "creating the plugin.gz"
cd dist

echo "apiVersion: jenkins.io/v1
kind: Plugin
metadata:
  labels:
    jenkins.io/pluginCommand: jx
  name: remote
spec:
  description: CloudBees plugin for remote environments
  name: remote
  subCommand: remote
  version: ${VERSION}" > plugin.yaml
tar -czvf ../plugin.gz plugin.* *.zip *.gz *.txt *.md
cd ..

echo "created plugin.gz:"
pwd
ls -al *.gz

echo "uploading the plugin distro to github"
github-release upload \
    --user jenkins-x \
    --repo jx \
    --tag v${VERSION} \
    --name "plugin.gz" \
    --file plugin.gz

    

07070100000083000081A4000000000000000000000001683E350C000000B2000000000000000000000000000000000000001D00000000jenkins-x-cli-3.11.92/jx.pub-----BEGIN PUBLIC KEY-----
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEofm/QFAG18JrP+/t0gBTTwK+nstS
ZIUiIMfC2HnLPndiThh+HxH9aSkrVZed/yK/0gbvmthxbe07dMre2VA/zw==
-----END PUBLIC KEY-----
07070100000084000041ED000000000000000000000002683E350C00000000000000000000000000000000000000000000001A00000000jenkins-x-cli-3.11.92/pkg07070100000085000041ED000000000000000000000002683E350C00000000000000000000000000000000000000000000001E00000000jenkins-x-cli-3.11.92/pkg/cmd07070100000086000041ED000000000000000000000002683E350C00000000000000000000000000000000000000000000002800000000jenkins-x-cli-3.11.92/pkg/cmd/dashboard07070100000087000081A4000000000000000000000001683E350C0000101E000000000000000000000000000000000000003500000000jenkins-x-cli-3.11.92/pkg/cmd/dashboard/dashboard.gopackage dashboard

import (
	"context"
	"fmt"
	"net/url"

	"github.com/jenkins-x/jx-helpers/v3/pkg/cobras/helper"
	"github.com/jenkins-x/jx-helpers/v3/pkg/cobras/templates"
	"github.com/jenkins-x/jx-helpers/v3/pkg/kube/services"
	"github.com/jenkins-x/jx-helpers/v3/pkg/options"
	"github.com/jenkins-x/jx-logging/v3/pkg/log"

	"github.com/spf13/cobra"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

	"github.com/jenkins-x/jx-helpers/v3/pkg/kube"

	"github.com/jenkins-x/jx-helpers/v3/pkg/termcolor"
	"github.com/pkg/browser"
	apierrors "k8s.io/apimachinery/pkg/api/errors"
	"k8s.io/client-go/kubernetes"
)

type Options struct {
	options.BaseOptions
	KubeClient          kubernetes.Interface
	Namespace           string
	ServiceName         string
	BasicAuthSecretName string
	NoBrowser           bool
	Quiet               bool
	BrowserHandler      Opener
}

type Opener interface {
	Open() error
}

type Browser struct {
	URL string
}

func (b *Browser) Open() error {
	err := browser.OpenURL(b.URL)
	if err != nil {
		return err
	}
	return nil
}

var (
	cmdLong = templates.LongDesc(`
		View the Jenkins X Pipelines Dashboard.`)

	cmdExample = templates.Examples(`
		# open the dashboard
		jx dashboard

		# display the URL only without opening a browser
		jx --no-open
`)

	info = termcolor.ColorInfo
)

// NewCmdDashboard opens the dashboard
func NewCmdDashboard() (*cobra.Command, *Options) {
	o := &Options{}
	cmd := &cobra.Command{
		Use:     "dashboard",
		Aliases: []string{"dash"},
		Short:   "View the Jenkins X Pipelines Dashboard",
		Long:    cmdLong,
		Example: cmdExample,
		Run: func(_ *cobra.Command, _ []string) {
			err := o.Run()
			helper.CheckErr(err)
		},
	}

	cmd.Flags().BoolVarP(&o.NoBrowser, "no-open", "", false, "Disable opening the URL; just show it on the console")
	cmd.Flags().StringVarP(&o.ServiceName, "name", "n", "jx-pipelines-visualizer", "The name of the dashboard service")
	cmd.Flags().StringVarP(&o.BasicAuthSecretName, "secret", "s", "jx-basic-auth-user-password", "The name of the Secret containing the basic auth login/password")
	o.BaseOptions.AddBaseFlags(cmd)
	return cmd, o
}

func (o *Options) Run() error {
	var err error
	o.KubeClient, o.Namespace, err = kube.LazyCreateKubeClientAndNamespace(o.KubeClient, o.Namespace)
	if err != nil {
		return fmt.Errorf("creating kubernetes client: %w", err)
	}
	client := o.KubeClient

	u, err := services.FindServiceURL(client, o.Namespace, o.ServiceName)
	if err != nil {
		return fmt.Errorf("failed to find dashboard URL. Check you have 'chart: jxgh/jx-pipelines-visualizer' in your helmfile.yaml: %w", err)
	}
	if u == "" {
		return fmt.Errorf("no dashboard URL. Check you have 'chart: jxgh/jx-pipelines-visualizer' in your helmfile.yaml")
	}

	log.Logger().Infof("Jenkins X dashboard is running at: %s", info(u))

	if o.NoBrowser {
		return nil
	}

	u, err = o.addUserPasswordToURL(u)
	if err != nil {
		return fmt.Errorf("failed to enrich dashboard URL %s: %w", u, err)
	}

	log.Logger().Debugf("opening: %s", info(u))

	if o.BrowserHandler == nil {
		o.BrowserHandler = &Browser{u}
	}
	err = o.BrowserHandler.Open()
	if err != nil {
		return err
	}
	return nil
}

func (o *Options) addUserPasswordToURL(urlText string) (string, error) {
	name := o.BasicAuthSecretName
	ns := o.Namespace
	secret, err := o.KubeClient.CoreV1().Secrets(ns).Get(context.Background(), name, metav1.GetOptions{})
	if err != nil && !apierrors.IsNotFound(err) {
		return urlText, fmt.Errorf("failed to load Secret %s in namespace %s: %w", name, ns, err)
	}
	if secret.Data == nil {
		secret.Data = map[string][]byte{}
	}
	username := string(secret.Data["username"])
	password := string(secret.Data["password"])

	if username == "" {
		log.Logger().Warnf("secret %s in namespace %s has no username", name, ns)
		return urlText, nil
	}
	if password == "" {
		log.Logger().Warnf("secret %s in namespace %s has no password", name, ns)
		return urlText, nil
	}

	u, err := url.Parse(urlText)
	if err != nil {
		return urlText, fmt.Errorf("failed to parse URL %s: %w", urlText, err)
	}
	u.User = url.UserPassword(username, password)
	return u.String(), nil
}
07070100000088000081A4000000000000000000000001683E350C00000CD8000000000000000000000000000000000000003A00000000jenkins-x-cli-3.11.92/pkg/cmd/dashboard/dashboard_test.gopackage dashboard_test

import (
	"os"
	"testing"

	"github.com/jenkins-x/jx/pkg/cmd/dashboard"
	"github.com/stretchr/testify/assert"
	v1 "k8s.io/api/core/v1"
	nv1 "k8s.io/api/networking/v1"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/client-go/kubernetes/fake"
)

type FakeBrowser struct{}

func (*FakeBrowser) Open() error {
	return nil
}

const testNamespace = "jx"

func TestNewCmdDashboard(t *testing.T) {
	testCases := []struct {
		description string
		hasError    bool
		NoBrowser   bool
		secret      map[string][]byte
		host        string
	}{
		{
			description: "Test Case 1 - do not open browser",
			hasError:    false,
			NoBrowser:   true,
			host:        "hook-jx.1.2.3.4.nip.io",
		},
		{
			description: "Test Case 2 - open browser",
			hasError:    false,
			NoBrowser:   false,
			secret: map[string][]byte{
				"username": []byte("username"),
				"password": []byte("password"),
			},
			host: "hook-jx.1.2.3.4.nip.io",
		},
		{
			description: "Test Case 3 - nil secret",
			hasError:    false,
			NoBrowser:   false,
			secret:      nil,
			host:        "hook-jx.1.2.3.4.nip.io",
		},
		{
			description: "Test Case 4 - empty username in secret",
			hasError:    false,
			NoBrowser:   false,
			secret: map[string][]byte{
				"username": []byte(""),
				"password": []byte("password"),
			},
			host: "hook-jx.1.2.3.4.nip.io",
		},
		{
			description: "Test Case 5 - empty password in secret",
			hasError:    false,
			NoBrowser:   false,
			secret: map[string][]byte{
				"username": []byte("username"),
				"password": []byte(""),
			},
			host: "hook-jx.1.2.3.4.nip.io",
		},
		{
			description: "Test Case 6 - invalid url",
			hasError:    true,
			NoBrowser:   false,
			secret: map[string][]byte{
				"username": []byte("username"),
				"password": []byte("password"),
			},
			host: "invalid url",
		},
	}

	for _, tt := range testCases {
		t.Logf("Running Test case %s", tt.description)
		kubeClient := fake.NewSimpleClientset(
			&v1.Namespace{
				ObjectMeta: metav1.ObjectMeta{
					Name: testNamespace,
				},
			},
			&nv1.Ingress{
				ObjectMeta: metav1.ObjectMeta{
					Name:      "jx-pipelines-visualizer",
					Namespace: testNamespace,
				},
				Spec: nv1.IngressSpec{
					Rules: []nv1.IngressRule{
						{
							Host: tt.host,
							IngressRuleValue: nv1.IngressRuleValue{
								HTTP: &nv1.HTTPIngressRuleValue{
									Paths: []nv1.HTTPIngressPath{
										{
											Path: "",
											Backend: nv1.IngressBackend{
												Service: &nv1.IngressServiceBackend{
													Name: "hook",
													Port: nv1.ServiceBackendPort{
														Number: 80,
													},
												},
											},
										},
									},
								},
							},
						},
					},
				},
			},
			&v1.Secret{
				TypeMeta: metav1.TypeMeta{},
				ObjectMeta: metav1.ObjectMeta{
					Name:      "jx-basic-auth-user-password",
					Namespace: testNamespace,
				},
				Data: tt.secret,
			})
		os.Setenv("KUBECONFIG", "testdata/kubeconfig")

		_, o := dashboard.NewCmdDashboard()
		o.KubeClient = kubeClient
		o.Namespace = testNamespace
		o.NoBrowser = tt.NoBrowser
		if !o.NoBrowser {
			o.BrowserHandler = &FakeBrowser{}
		}
		err := o.Run()
		if tt.hasError {
			assert.Error(t, err)
		} else {
			assert.NoError(t, err)
		}
	}
}
07070100000089000041ED000000000000000000000002683E350C00000000000000000000000000000000000000000000003100000000jenkins-x-cli-3.11.92/pkg/cmd/dashboard/testdata0707010000008A000081A4000000000000000000000001683E350C000001C8000000000000000000000000000000000000003C00000000jenkins-x-cli-3.11.92/pkg/cmd/dashboard/testdata/kubeconfigapiVersion: v1
clusters:
- cluster:
    certificate-authority-data: Y2VydGlmaWNhdGUtYXV0aG9yaXR5LWRhdGEK
    server: https://jx-rocks:6443
  name: jx-test
contexts:
- context:
    cluster: jx-test
    namespace: jx
    user: default
  name: namespace-test
current-context: namespace-test
kind: Config
preferences: {}
users:
- name: default
  user:
    client-certificate-data: Y2xpZW50LWNlcnRpZmljYXRlLWRhdGEK
    client-key-data: Y2xpZW50LWtleS1kYXRhCg==
0707010000008B000041ED000000000000000000000002683E350C00000000000000000000000000000000000000000000002800000000jenkins-x-cli-3.11.92/pkg/cmd/namespace0707010000008C000081A4000000000000000000000001683E350C000027EA000000000000000000000000000000000000003500000000jenkins-x-cli-3.11.92/pkg/cmd/namespace/namespace.gopackage namespace

import (
	"context"
	"fmt"
	"os"
	"sort"
	"strings"

	"github.com/jenkins-x/jx-helpers/v3/pkg/cobras/helper"
	"github.com/jenkins-x/jx-helpers/v3/pkg/cobras/templates"
	"github.com/jenkins-x/jx-helpers/v3/pkg/input"
	"github.com/jenkins-x/jx-helpers/v3/pkg/input/survey"
	"github.com/jenkins-x/jx-helpers/v3/pkg/kube/jxclient"
	"github.com/jenkins-x/jx-helpers/v3/pkg/kube/jxenv"
	"github.com/jenkins-x/jx-helpers/v3/pkg/options"
	"github.com/jenkins-x/jx-kube-client/v3/pkg/kubeclient"
	"github.com/jenkins-x/jx-logging/v3/pkg/log"
	"github.com/spf13/cobra"
	"k8s.io/client-go/rest"

	"github.com/jenkins-x/jx-helpers/v3/pkg/kube"

	jxc "github.com/jenkins-x/jx-api/v4/pkg/client/clientset/versioned"
	corev1 "k8s.io/api/core/v1"
	apierrors "k8s.io/apimachinery/pkg/api/errors"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/client-go/tools/clientcmd"

	"github.com/jenkins-x/jx-helpers/v3/pkg/termcolor"
	"k8s.io/client-go/kubernetes"
	"k8s.io/client-go/tools/clientcmd/api"
)

type Options struct {
	KubeClient kubernetes.Interface
	Input      input.Interface
	JXClient   jxc.Interface
	Args       []string
	Env        string
	PickEnv    bool
	Create     bool
	QuiteMode  bool
	BatchMode  bool
}

var (
	cmdLong = templates.LongDesc(`
		Displays or changes the current namespace.`)
	cmdExample = templates.Examples(`
		# view the current namespace
		jx --batch-mode ns

		# interactively select the namespace to switch to
		jx ns

		# change the current namespace to 'cheese'
		jx ns cheese

		# change the current namespace to 'brie' creating it if necessary
	    jx ns --create brie

		# switch to the namespace of the staging environment
		jx ns --env staging

		# switch back to the dev environment namespace
		jx ns --e dev

		# interactively select the Environment to switch to
		jx ns --pick
`)

	info = termcolor.ColorInfo
)

func NewCmdNamespace() (*cobra.Command, *Options) {
	o := &Options{}
	cmd := &cobra.Command{
		Use:     "namespace",
		Aliases: []string{"ns"},
		Args:    cobra.MaximumNArgs(1),
		Short:   "View or change the current namespace context in the current Kubernetes cluster",
		Long:    cmdLong,
		Example: cmdExample,
		ValidArgsFunction: func(_ *cobra.Command, _ []string, toComplete string) ([]string, cobra.ShellCompDirective) {
			client, _, err := kube.LazyCreateKubeClientAndNamespace(o.KubeClient, "")
			if err != nil {
				return nil, cobra.ShellCompDirectiveError
			}
			names, err := getNamespaceNames(client)

			if err != nil {
				return nil, cobra.ShellCompDirectiveError
			}
			var contextNames []string
			for _, v := range names {
				if strings.HasPrefix(v, toComplete) {
					contextNames = append(contextNames, v)
				}
			}
			return contextNames, cobra.ShellCompDirectiveNoFileComp
		},
		Run: func(_ *cobra.Command, args []string) {
			o.Args = args
			err := o.Run()
			helper.CheckErr(err)
		},
	}

	cmd.Flags().BoolVarP(&o.Create, "create", "c", false, "Creates the specified namespace if it does not exist")
	cmd.Flags().BoolVarP(&o.BatchMode, "batch-mode", "b", false, "Enables batch mode")
	cmd.Flags().BoolVarP(&o.QuiteMode, "quiet", "q", false, "Do not fail if the namespace does not exist")
	cmd.Flags().BoolVarP(&o.PickEnv, "pick", "v", false, "Pick the Environment to switch to")
	cmd.Flags().StringVarP(&o.Env, "env", "e", "", "The Environment name to switch to the namepsace")
	return cmd, o
}

func (o *Options) Run() error {
	var err error
	currentNS := ""
	o.KubeClient, currentNS, err = kube.LazyCreateKubeClientAndNamespace(o.KubeClient, "")
	if err != nil {
		return fmt.Errorf("creating kubernetes client: %w", err)
	}
	client := o.KubeClient

	f := kubeclient.NewFactory()
	config, err := f.CreateKubeConfig()
	if err != nil {
		return fmt.Errorf("creating kubernetes configuration: %w", err)
	}
	cfg, pathOptions, err := kubeclient.LoadConfig()
	if err != nil {
		return fmt.Errorf("loading Kubernetes configuration: %w", err)
	}

	ns := ""
	if o.Env != "" || o.PickEnv {
		ns, err = o.findNamespaceFromEnv(currentNS, o.Env)
		if err != nil {
			return fmt.Errorf("failed to find Jenkins X environment: %s: %w", o.Env, err)
		}
		if ns == "" {
			return nil
		}
	}
	if ns == "" {
		ns = namespace(o)
	}

	if ns == "" && !o.BatchMode {
		ns, err = pickNamespace(o, client, currentNS)
		if err != nil {
			return err
		}
	}

	if ns != "" && ns != currentNS {
		ctx, err := changeNamespace(client, cfg, pathOptions, ns, o.Create, o.QuiteMode)
		if err != nil {
			return err
		}
		if ctx == nil {
			log.Logger().Infof("No kube context - probably in a unit test or pod?\n")
		} else {
			log.Logger().Infof("Now using namespace '%s' on server '%s'.\n", info(ctx.Namespace), info(kube.Server(cfg, ctx)))
		}
	} else {
		if currentNS != "" {
			ns = currentNS
		}
		server := kube.CurrentServer(cfg)
		if config == nil {
			log.Logger().Infof("Using namespace '%s' on server '%s'. No context - probably a unit test or pod?\n", info(ns), info(server))
		} else {
			log.Logger().Infof("Using namespace '%s' from context named '%s' on server '%s'.\n", info(ns), info(cfg.CurrentContext), info(server))
		}
	}
	return nil
}

func (o *Options) findNamespaceFromEnv(ns, name string) (string, error) {
	var err error
	o.JXClient, ns, err = jxclient.LazyCreateJXClientAndNamespace(o.JXClient, ns)
	if err != nil {
		return "", fmt.Errorf("failed to create jx client: %w", err)
	}

	names, err := o.GetEnvironmentNames(ns)
	if err != nil {
		return "", err
	}

	if len(names) == 0 {
		// lets find the dev namespace to use that to find environments
		devNS := ""
		devNS, _, err = jxenv.GetDevNamespace(o.KubeClient, ns)
		if err != nil {
			return "", fmt.Errorf("failed to find current dev namespace from %s: %w", ns, err)
		}
		if devNS != ns {
			log.Logger().Infof("using the team namespace %s to find Environments", info(devNS))
			ns = devNS
			names, err = o.GetEnvironmentNames(ns)
			if err != nil {
				return "", err
			}
		}
	}
	if name == "" {
		name, err = o.pickName(names, "", "Pick environment:", "pick the kubernetes namespace for the current kubernetes cluster")
		if err != nil {
			return "", fmt.Errorf("failed to pick environment: %w", err)
		}
		if name == "" {
			return "", nil
		}
	}

	env, err := o.JXClient.JenkinsV1().Environments(ns).Get(context.TODO(), name, metav1.GetOptions{})
	if err != nil {
		if apierrors.IsNotFound(err) {
			return "", options.InvalidArg(name, names)
		}
		return "", fmt.Errorf("failed to load Environment %s in namespace %s: %w", name, ns, err)
	}
	return env.Spec.Namespace, nil
}

// GetEnvironmentNames returns the environment names in te given namespace
func (o *Options) GetEnvironmentNames(ns string) ([]string, error) {
	names, err := jxenv.GetEnvironmentNames(o.JXClient, ns)
	if err != nil && apierrors.IsNotFound(err) {
		err = nil
	}
	if err != nil {
		return names, fmt.Errorf("failed to find Environment names in namespace %s: %w", ns, err)
	}
	return names, err
}

func namespace(o *Options) string {
	ns := ""
	args := o.Args
	if len(args) > 0 {
		ns = args[0]
	}
	return ns
}

func changeNamespace(client kubernetes.Interface, config *api.Config, pathOptions clientcmd.ConfigAccess, ns string, create, quietMode bool) (*api.Context, error) {
	_, err := client.CoreV1().Namespaces().Get(context.TODO(), ns, metav1.GetOptions{})
	if err != nil {
		switch err.(type) {
		case *apierrors.StatusError:
			err = handleStatusError(err, client, ns, create, quietMode)
			if err != nil {
				return nil, err
			}
		default:
			return nil, fmt.Errorf("getting namespace %q: %w", ns, err)
		}
	}
	ctx := kube.CurrentContext(config)

	if ctx == nil {
		ctx = &api.Context{}
		name := "pod"
		config.Contexts[name] = ctx
		config.CurrentContext = name
	}

	if ctx.Namespace == ns {
		return ctx, nil
	}
	ctx.Namespace = ns

	newConfig := *config
	err = clientcmd.ModifyConfig(pathOptions, newConfig, false)
	if err != nil {
		return nil, fmt.Errorf("failed to update the kube config %s", err)
	}
	return ctx, nil
}

func handleStatusError(err error, client kubernetes.Interface, ns string, create, quietMode bool) error {
	statusErr, _ := err.(*apierrors.StatusError)
	if statusErr.Status().Reason == metav1.StatusReasonNotFound {
		if quietMode {
			log.Logger().Infof("namespace %s does not exist yet", ns)
			os.Exit(0)
			return nil
		}
		if create {
			err = createNamespace(client, ns)
			if err != nil {
				return err
			}
			return nil
		}
		return err
	}
	return err
}

func createNamespace(client kubernetes.Interface, ns string) error {
	namespace := corev1.Namespace{
		ObjectMeta: metav1.ObjectMeta{
			Name: ns,
		},
	}
	_, err := client.CoreV1().Namespaces().Create(context.TODO(), &namespace, metav1.CreateOptions{})
	if err != nil {
		return fmt.Errorf("unable to create namespace %s: %w", ns, err)
	}
	return nil
}

func pickNamespace(o *Options, client kubernetes.Interface, defaultNamespace string) (string, error) {
	names, err := getNamespaceNames(client)
	if err != nil {
		return "", fmt.Errorf("retrieving namespace the names of the namespaces: %w", err)
	}

	selectedNamespace, err := o.pickName(names, defaultNamespace, "Change namespace:", "pick the kubernetes namespace for the current kubernetes cluster")
	if err != nil {
		return "", fmt.Errorf("picking the namespace: %w", err)
	}
	return selectedNamespace, nil
}

// getNamespaceNames returns the sorted list of environment names
func getNamespaceNames(client kubernetes.Interface) ([]string, error) {
	var names []string
	list, err := client.CoreV1().Namespaces().List(context.TODO(), metav1.ListOptions{})
	if err != nil {
		return names, fmt.Errorf("loading namespaces %s", err)
	}
	for k := range list.Items {
		names = append(names, list.Items[k].Name)
	}
	sort.Strings(names)
	return names, nil
}

func (o *Options) pickName(names []string, defaultValue, message, help string) (string, error) {
	if len(names) == 0 {
		return "", nil
	}
	if len(names) == 1 {
		return names[0], nil
	}
	if o.Input == nil {
		o.Input = survey.NewInput()
	}
	name, err := o.Input.PickNameWithDefault(names, message, defaultValue, help)
	return name, err
}

// IsInCluster tells if we are running incluster
func IsInCluster() bool {
	_, err := rest.InClusterConfig()
	return err == nil
}
0707010000008D000081A4000000000000000000000001683E350C000008C2000000000000000000000000000000000000003A00000000jenkins-x-cli-3.11.92/pkg/cmd/namespace/namespace_test.gopackage namespace_test

// ToDo (@ankitm123): need to figure out how to test this
// import (
// 	"os"
// 	"testing"

// 	jxv1 "github.com/jenkins-x/jx-api/v4/pkg/apis/jenkins.io/v1"
// 	jxfake "github.com/jenkins-x/jx-api/v4/pkg/client/clientset/versioned/fake"
// 	"github.com/jenkins-x/jx/pkg/cmd/namespace"
// 	"github.com/stretchr/testify/assert"
// 	v1 "k8s.io/api/core/v1"
// 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
// 	"k8s.io/client-go/kubernetes/fake"
// )

// func TestNewCmdNamespace(t *testing.T) {
// 	testCases := []struct {
// 		description string
// 		env         string
// 		args        []string
// 		ns          string
// 	}{
// 		{
// 			description: "Test case 1",
// 			env:         "",
// 			args:        []string{""},
// 			ns:          "jx",
// 		},
// 		{
// 			description: "Test case 2",
// 			env:         "dev",
// 			args:        []string{""},
// 			ns:          "jx",
// 		},
// 		{
// 			description: "Test case 3",
// 			env:         "dev",
// 			args:        []string{"jx-staging"},
// 			ns:          "jx",
// 		},
// 		{
// 			description: "Test case 4",
// 			env:         "",
// 			args:        []string{""},
// 			ns:          "jx-test",
// 		},
// 		{
// 			description: "Test case 5",
// 			env:         "",
// 			args:        []string{"default"},
// 			ns:          "jx",
// 		},
// 	}
// 	for k, tt := range testCases {
// 		t.Logf("Running test case #%d: %s", k+1, tt.description)
// 		kubeClient := fake.NewSimpleClientset(&v1.Namespace{
// 			ObjectMeta: metav1.ObjectMeta{
// 				Name: "jx",
// 			},
// 		}, &v1.Namespace{
// 			ObjectMeta: metav1.ObjectMeta{
// 				Name: "default",
// 			},
// 		})
// 		jxClient := jxfake.NewSimpleClientset(&jxv1.Environment{
// 			TypeMeta: metav1.TypeMeta{},
// 			ObjectMeta: metav1.ObjectMeta{
// 				Name:      "dev",
// 				Namespace: tt.ns,
// 			},
// 			Spec: jxv1.EnvironmentSpec{
// 				Namespace: tt.ns,
// 			},
// 			Status: jxv1.EnvironmentStatus{},
// 		})
// 		os.Setenv("KUBECONFIG", "testdata/kubeconfig")
// 		_, o := namespace.NewCmdNamespace()
// 		o.KubeClient = kubeClient
// 		o.JXClient = jxClient
// 		o.Env = tt.env
// 		o.Args = tt.args
// 		o.BatchMode = true
// 		err := o.Run()
// 		assert.NoError(t, err)
// 	}
// }
0707010000008E000041ED000000000000000000000002683E350C00000000000000000000000000000000000000000000003100000000jenkins-x-cli-3.11.92/pkg/cmd/namespace/testdata0707010000008F000081A4000000000000000000000001683E350C000001CD000000000000000000000000000000000000003C00000000jenkins-x-cli-3.11.92/pkg/cmd/namespace/testdata/kubeconfigapiVersion: v1
clusters:
- cluster:
    certificate-authority-data: Y2VydGlmaWNhdGUtYXV0aG9yaXR5LWRhdGEK
    server: https://jx-rocks:6443
  name: jx-test
contexts:
- context:
    cluster: jx-test
    namespace: default
    user: default
  name: namespace-test
current-context: namespace-test
kind: Config
preferences: {}
users:
- name: default
  user:
    client-certificate-data: Y2xpZW50LWNlcnRpZmljYXRlLWRhdGEK
    client-key-data: Y2xpZW50LWtleS1kYXRhCg==
07070100000090000081A4000000000000000000000001683E350C00002352000000000000000000000000000000000000002600000000jenkins-x-cli-3.11.92/pkg/cmd/root.gopackage cmd

import (
	"fmt"
	"os"
	"strings"

	"github.com/jenkins-x/jx-helpers/v3/pkg/cobras"
	"github.com/jenkins-x/jx-helpers/v3/pkg/cobras/helper"
	"github.com/jenkins-x/jx-helpers/v3/pkg/cobras/templates"
	"github.com/jenkins-x/jx-helpers/v3/pkg/extensions"
	"github.com/jenkins-x/jx-helpers/v3/pkg/homedir"
	"github.com/jenkins-x/jx-helpers/v3/pkg/termcolor"
	"github.com/jenkins-x/jx-logging/v3/pkg/log"
	"github.com/jenkins-x/jx/pkg/cmd/dashboard"
	"github.com/jenkins-x/jx/pkg/cmd/namespace"
	"github.com/jenkins-x/jx/pkg/cmd/ui"
	"github.com/jenkins-x/jx/pkg/cmd/upgrade"
	"github.com/jenkins-x/jx/pkg/cmd/version"
	"github.com/jenkins-x/jx/pkg/plugins"
	"github.com/spf13/cobra"
)

// Main creates the new command
func Main(args []string) *cobra.Command {
	cmd := &cobra.Command{
		Use:   "jx",
		Short: "Jenkins X 3.x command line",
		Run:   runHelp,
		// Hook before and after Run initialize and write profiles to disk,
		// respectively.
		PersistentPreRunE: func(cmd *cobra.Command, args []string) error {

			if cmd.Name() == cobra.ShellCompRequestCmd || cmd.Name() == cobra.ShellCompNoDescRequestCmd {
				// This is the __complete or __completeNoDesc command which
				// indicates shell completion has been requested.
				plugins.SetupPluginCompletion(cmd, args)
			}
			return nil
		},
	}

	po := &templates.Options{}
	getPluginCommandGroups := func() (templates.PluginCommandGroups, bool) {
		verifier := &extensions.CommandOverrideVerifier{
			Root:        cmd,
			SeenPlugins: make(map[string]string),
		}
		pluginCommandGroups, err := po.GetPluginCommandGroups(verifier, plugins.Plugins)
		if err != nil {
			log.Logger().Errorf("%v", err)
		}
		return pluginCommandGroups, false
	}
	doCmd := func(cmd *cobra.Command, args []string) {
		handleCommand(cmd, args)
	}

	generalCommands := []*cobra.Command{
		cobras.SplitCommand(dashboard.NewCmdDashboard()),
		cobras.SplitCommand(namespace.NewCmdNamespace()),
		cobras.SplitCommand(ui.NewCmdUI()),
		cobras.SplitCommand(upgrade.NewCmdUpgrade()),
		cobras.SplitCommand(version.NewCmdVersion()),
	}

	// aliases to classic jx commands...
	getCmd := &cobra.Command{
		Use:   "get TYPE [flags]",
		Short: "Display one or more resources",
		Run: func(cmd *cobra.Command, _ []string) {
			err := cmd.Help()
			helper.CheckErr(err)
		},
		SuggestFor: []string{"list", "ps"},
	}
	addCmd := &cobra.Command{
		Use:   "add TYPE [flags]",
		Short: "Adds one or more resources",
		Run: func(cmd *cobra.Command, _ []string) {
			err := cmd.Help()
			helper.CheckErr(err)
		},
	}
	getBuildCmd := &cobra.Command{
		Use:     "build TYPE [flags]",
		Short:   "Display one or more resources relating to a pipeline build",
		Aliases: []string{"builds"},
		Run: func(cmd *cobra.Command, _ []string) {
			err := cmd.Help()
			helper.CheckErr(err)
		},
	}
	createCmd := &cobra.Command{
		Use:   "create TYPE [flags]",
		Short: "Create one or more resources",
		Run: func(cmd *cobra.Command, _ []string) {
			err := cmd.Help()
			helper.CheckErr(err)
		},
		SuggestFor: []string{"new", "make"},
	}
	startCmd := &cobra.Command{
		Use:   "start TYPE [flags]",
		Short: "Starts a resource",
		Run: func(cmd *cobra.Command, _ []string) {
			err := cmd.Help()
			helper.CheckErr(err)
		},
	}
	stopCmd := &cobra.Command{
		Use:   "stop TYPE [flags]",
		Short: "Stops a resource",
		Run: func(cmd *cobra.Command, _ []string) {
			err := cmd.Help()
			helper.CheckErr(err)
		},
	}
	addCmd.AddCommand(
		aliasCommand(cmd, doCmd, "app", []string{"gitops", "helmfile", "add"}, "chart"),
	)
	getCmd.AddCommand(
		getBuildCmd,
		aliasCommand(cmd, doCmd, "activities", []string{"pipeline", "activities"}, "act", "activity"),
		aliasCommand(cmd, doCmd, "application", []string{"application", "get"}, "app", "apps", "applications"),
		aliasCommand(cmd, doCmd, "pipelines", []string{"pipeline", "get"}, "pipeline"),
		aliasCommand(cmd, doCmd, "previews", []string{"preview", "get"}, "preview"),
	)
	getBuildCmd.AddCommand(
		aliasCommand(cmd, doCmd, "logs", []string{"pipeline", "logs"}, "log"),
		aliasCommand(cmd, doCmd, "pods", []string{"pipeline", "pods"}, "pod"),
	)
	createCmd.AddCommand(
		aliasCommand(cmd, doCmd, "quickstart", []string{"project", "quickstart"}, "qs"),
		aliasCommand(cmd, doCmd, "spring", []string{"project", "spring"}, "sb"),
		aliasCommand(cmd, doCmd, "project", []string{"project"}),
		aliasCommand(cmd, doCmd, "pullrequest", []string{"project", "pullrequest"}, "pr"),
	)
	startCmd.AddCommand(
		aliasCommand(cmd, doCmd, "pipeline", []string{"pipeline", "start"}, "pipelines"),
	)
	stopCmd.AddCommand(
		aliasCommand(cmd, doCmd, "pipeline", []string{"pipeline", "stop"}, "pipelines"),
	)
	generalCommands = append(generalCommands, addCmd, getCmd, createCmd, startCmd, stopCmd,
		aliasCommand(cmd, doCmd, "import", []string{"project", "import"}),
		aliasCommand(cmd, doCmd, "ctx", []string{"context"}),
	)

	cmd.AddCommand(generalCommands...)

	var groups templates.CommandGroups
	command := templates.CommandGroup{

		Message:  "General:",
		Commands: generalCommands,
	}
	groups = append(groups, command)

	groups.Add(cmd)
	filters := []string{"options"}

	templates.ActsAsRootCommand(cmd, filters, getPluginCommandGroups, groups...)
	handleCommand(cmd, args)
	return cmd
}

func handleCommand(cmd *cobra.Command, args []string) {

	if len(args) == 0 {
		args = os.Args
	}
	if len(args) > 1 {
		cmdPathPieces := args[1:]
		pluginDir, err := homedir.DefaultPluginBinDir()
		if err != nil {
			log.Logger().Errorf("%v", err)
			os.Exit(1)
		}

		// only look for suitable executables if
		// the specified command does not already exist
		if _, _, err := cmd.Find(cmdPathPieces); err != nil {
			var cmdName string // first "non-flag" arguments
			for _, arg := range cmdPathPieces {
				if !strings.HasPrefix(arg, "-") {
					cmdName = arg
					break
				}
			}
			switch cmdName {
			case "help", cobra.ShellCompRequestCmd, cobra.ShellCompNoDescRequestCmd, "completion":
				// Don't search for a plugin
			default:
				if err := handleEndpointExtensions(cmdPathPieces, pluginDir); err != nil {
					log.Logger().Errorf("%v", err)
					os.Exit(1)
				}
			}
		}
	}
}

func aliasCommand(rootCmd *cobra.Command, fn func(cmd *cobra.Command, args []string), name string, args []string, aliases ...string) *cobra.Command {
	realArgs := append([]string{"jx"}, args...)
	cmd := &cobra.Command{
		Use:     name,
		Short:   "alias for: " + strings.Join(realArgs, " "),
		Aliases: aliases,
		ValidArgsFunction: func(_ *cobra.Command, completeArgs []string, toComplete string) ([]string, cobra.ShellCompDirective) {
			cmd, pluginArgs, err := rootCmd.Find(args)
			if err != nil {
				return nil, cobra.ShellCompDirectiveNoFileComp
			}
			return plugins.PluginCompletion(cmd, append(pluginArgs, completeArgs...), toComplete)
		},
		Run: func(_ *cobra.Command, args []string) {
			realArgs = append(realArgs, args...)
			log.Logger().Debugf("about to invoke alias: %s", strings.Join(realArgs, " "))
			fn(rootCmd, realArgs)
		},
		DisableFlagParsing: true,
	}
	return cmd
}

func runHelp(cmd *cobra.Command, _ []string) {
	cmd.Help() //nolint:errcheck
}

func handleEndpointExtensions(cmdArgs []string, pluginBinDir string) error {
	var remainingArgs []string // all "non-flag" arguments

	for idx := range cmdArgs {
		if strings.HasPrefix(cmdArgs[idx], "-") {
			break
		}
		remainingArgs = append(remainingArgs, strings.ReplaceAll(cmdArgs[idx], "-", "_"))
	}

	foundBinaryPath := ""

	// attempt to find binary, starting at longest possible name with given cmdArgs
	var err error
	for len(remainingArgs) > 0 {
		commandName := fmt.Sprintf("jx-%s", strings.Join(remainingArgs, "-"))

		// lets try the correct plugin versions first
		path := ""
		if plugins.PluginMap[commandName] != nil {
			p := *plugins.PluginMap[commandName]
			path, err = extensions.EnsurePluginInstalled(p, pluginBinDir)
			if err != nil {
				return fmt.Errorf("failed to install binary plugin %s version %s to %s: %w", commandName, p.Spec.Version, pluginBinDir, err)
			}
		}

		// lets see if there's a local build of the plugin on the PATH for developers...
		if path == "" {
			path, err = plugins.Lookup(commandName, pluginBinDir)
		}
		if path != "" {
			foundBinaryPath = path
			break
		}
		remainingArgs = remainingArgs[:len(remainingArgs)-1]
	}

	if foundBinaryPath == "" {
		return err
	}

	nextArgs := cmdArgs[len(remainingArgs):]
	log.Logger().Debugf("using the plugin command: %s", termcolor.ColorInfo(foundBinaryPath+" "+strings.Join(nextArgs, " ")))

	// Giving plugin information about how it was invoked, so it can give correct help
	pluginCommandName := os.Args[0] + " " + strings.Join(remainingArgs, " ")
	environ := append(os.Environ(),
		fmt.Sprintf("BINARY_NAME=%s", pluginCommandName),
		fmt.Sprintf("TOP_LEVEL_COMMAND=%s", pluginCommandName))
	// invoke cmd binary relaying the current environment and args given
	// remainingArgs will always have at least one element.
	// execute will make remainingArgs[0] the "binary name".
	return plugins.Execute(foundBinaryPath, nextArgs, environ)
}
07070100000091000081A4000000000000000000000001683E350C000000E8000000000000000000000000000000000000002B00000000jenkins-x-cli-3.11.92/pkg/cmd/root_test.gopackage cmd_test

import (
	"testing"

	"github.com/jenkins-x/jx/pkg/cmd"
	"github.com/stretchr/testify/assert"
)

func TestMain(t *testing.T) {
	rootCmd := cmd.Main([]string{""})
	err := rootCmd.Execute()
	assert.NoError(t, err)
}
07070100000092000041ED000000000000000000000002683E350C00000000000000000000000000000000000000000000002100000000jenkins-x-cli-3.11.92/pkg/cmd/ui07070100000093000081A4000000000000000000000001683E350C000012E1000000000000000000000000000000000000002700000000jenkins-x-cli-3.11.92/pkg/cmd/ui/ui.gopackage ui

import (
	"fmt"
	"os"
	"path/filepath"
	"strings"

	"github.com/jenkins-x/jx-api/v4/pkg/util"
	"github.com/jenkins-x/jx-helpers/v3/pkg/cmdrunner"
	"github.com/jenkins-x/jx-helpers/v3/pkg/cobras/helper"
	"github.com/jenkins-x/jx-helpers/v3/pkg/cobras/templates"
	"github.com/jenkins-x/jx-helpers/v3/pkg/files"
	"github.com/jenkins-x/jx-helpers/v3/pkg/options"
	"github.com/jenkins-x/jx-logging/v3/pkg/log"
	"github.com/jenkins-x/jx/pkg/plugins"

	"github.com/spf13/cobra"
	"k8s.io/client-go/util/homedir"

	"github.com/jenkins-x/jx-helpers/v3/pkg/termcolor"
)

type Options struct {
	options.BaseOptions
	CommandRunner cmdrunner.CommandRunner
	BrowserPath   string
	Host          string
	Port          int
	OctantArgs    []string
}

var (
	info = termcolor.ColorInfo

	cmdLong = templates.LongDesc(`
		Views the Jenkins X UI (octant).`)

	cmdExample = templates.Examples(`
		# open the UI
		jx ui
        # To pass arguments to octant
  		jx ui -o --namespace=jx -o -v -o --browser-path="/#/jx/pipelines"
`)
)

// NewCmdUI opens the octant UI
func NewCmdUI() (*cobra.Command, *Options) {
	o := &Options{}
	cmd := &cobra.Command{
		Use:     "ui",
		Short:   "Views the Jenkins X UI (octant)",
		Long:    cmdLong,
		Example: cmdExample,
		Run: func(_ *cobra.Command, _ []string) {
			err := o.Run()
			helper.CheckErr(err)
		},
	}

	cmd.Flags().StringVarP(&o.BrowserPath, "browser-path", "p", "/#/jx/pipelines-recent", "The browser path inside octant to open")
	cmd.Flags().StringVarP(&o.Host, "host", "", "", "The host to listen on")
	cmd.Flags().IntVarP(&o.Port, "port", "", 0, "The port for octant to listen on")
	cmd.Flags().StringSliceVarP(&o.OctantArgs, "octant-args", "o", []string{"--namespace=jx"}, "Extra arguments passed to the octant binary")
	o.BaseOptions.AddBaseFlags(cmd)
	return cmd, o
}

func (o *Options) Run() error {
	if o.CommandRunner == nil {
		o.CommandRunner = cmdrunner.QuietCommandRunner
	}
	// lets find the octant binary...
	octantBin, err := plugins.GetOctantBinary("")
	if err != nil {
		return fmt.Errorf("failed to download the octant binary: %w", err)
	}

	err = VerifyOctantPlugins(o.CommandRunner)
	if err != nil {
		return fmt.Errorf("failed to download the Jenkins X octant plugins: %w", err)
	}

	args := append([]string{"--browser-path", o.BrowserPath}, o.OctantArgs...)

	if o.Port != 0 || o.Host != "" {
		if o.Port == 0 {
			o.Port = 8080
		}
		if o.Host == "" {
			o.Host = "localhost"
		}
		args = append(args, "--listener-addr", fmt.Sprintf("%s:%d", o.Host, o.Port))
	}

	c := &cmdrunner.Command{
		Name: octantBin,
		Args: args,
		Out:  os.Stdout,
		Err:  os.Stderr,
		In:   os.Stdin,
	}
	_, err = o.CommandRunner(c)
	if err != nil {
		return fmt.Errorf("failed to start octant via: %s: %w", c.CLI(), err)
	}
	return nil
}

func VerifyOctantPlugins(runner cmdrunner.CommandRunner) error {
	err := VerifyOctantPluginVersion(runner, "octant-jx", plugins.OctantJXVersion, func() (string, error) {
		return plugins.GetOctantJXBinary(plugins.OctantJXVersion)
	})
	if err != nil {
		return err
	}
	return VerifyOctantPluginVersion(runner, "octant-jxo", plugins.OctantJXVersion, func() (string, error) {
		return plugins.GetOctantJXOBinary(plugins.OctantJXVersion)
	})
}

func VerifyOctantPluginVersion(runner cmdrunner.CommandRunner, pluginName, requiredVersion string, fn func() (string, error)) error {
	pluginDir := OctantPluginsDir()
	octantJxBin := filepath.Join(pluginDir, pluginName)

	version := ""
	exists, err := util.FileExists(octantJxBin)
	if err != nil {
		return fmt.Errorf("failed to check if file exists %s: %w", octantJxBin, err)
	}

	if exists {
		c := &cmdrunner.Command{
			Name: octantJxBin,
			Args: []string{"version"},
		}
		// lets try check the version
		out, err := runner(c)
		if err != nil {
			log.Logger().Warnf("failed to run command %s version: %s", octantJxBin, err.Error())
		} else {
			version = strings.TrimSpace(out)
		}
	}

	if version == requiredVersion {
		log.Logger().Debugf("the %s plugin is already on version %s", info(pluginName), info(version))
		return nil
	}
	if version != "" {
		log.Logger().Infof("the %s plugin %s is being upgraded to %s", info(pluginName), info(version), info(requiredVersion))
	}
	jxBin, err := fn()
	if err != nil {
		return err
	}

	err = os.MkdirAll(pluginDir, util.DefaultWritePermissions)
	if err != nil {
		return fmt.Errorf("failed to create octant plugin directory %s: %w", pluginDir, err)
	}
	err = files.CopyFile(jxBin, octantJxBin)
	if err != nil {
		return fmt.Errorf("failed to copy new plugin version %s to %s: %w", jxBin, octantJxBin, err)
	}

	log.Logger().Debugf("updated plugin file %s", info(octantJxBin))
	return nil
}

// OctantPluginsDir returns the location of octant plugins
func OctantPluginsDir() string {
	return filepath.Join(homedir.HomeDir(), ".config", "octant", "plugins")
}
07070100000094000041ED000000000000000000000002683E350C00000000000000000000000000000000000000000000002600000000jenkins-x-cli-3.11.92/pkg/cmd/upgrade07070100000095000041ED000000000000000000000002683E350C00000000000000000000000000000000000000000000002F00000000jenkins-x-cli-3.11.92/pkg/cmd/upgrade/testdata07070100000096000081A4000000000000000000000001683E350C000001C8000000000000000000000000000000000000003A00000000jenkins-x-cli-3.11.92/pkg/cmd/upgrade/testdata/kubeconfigapiVersion: v1
clusters:
- cluster:
    certificate-authority-data: Y2VydGlmaWNhdGUtYXV0aG9yaXR5LWRhdGEK
    server: https://jx-rocks:6443
  name: jx-test
contexts:
- context:
    cluster: jx-test
    namespace: jx
    user: default
  name: namespace-test
current-context: namespace-test
kind: Config
preferences: {}
users:
- name: default
  user:
    client-certificate-data: Y2xpZW50LWNlcnRpZmljYXRlLWRhdGEK
    client-key-data: Y2xpZW50LWtleS1kYXRhCg==
07070100000097000081A4000000000000000000000001683E350C00000438000000000000000000000000000000000000003100000000jenkins-x-cli-3.11.92/pkg/cmd/upgrade/upgrade.gopackage upgrade

import (
	"github.com/jenkins-x/jx-helpers/v3/pkg/cobras"
	"github.com/jenkins-x/jx-helpers/v3/pkg/cobras/helper"
	"github.com/jenkins-x/jx-helpers/v3/pkg/cobras/templates"
	"github.com/spf13/cobra"
)

var (
	cmdLong = templates.LongDesc(`
		Upgrades all of the plugins in your local Jenkins X CLI
`)

	cmdExample = templates.Examples(`
		# upgrades your plugin binaries
		jx upgrade
	`)
)

// UpgradeOptions the options for upgrading a cluster
type Options struct {
	Cmd *cobra.Command
}

// NewCmdUpgrade creates a command object for the command
func NewCmdUpgrade() (*cobra.Command, *Options) {
	o := &Options{}

	o.Cmd = &cobra.Command{
		Use:     "upgrade",
		Short:   "Upgrades resources",
		Long:    cmdLong,
		Example: cmdExample,
		Run: func(_ *cobra.Command, _ []string) {
			err := o.Run()
			helper.CheckErr(err)
		},
	}

	o.Cmd.AddCommand(cobras.SplitCommand(NewCmdUpgradeCLI()))
	o.Cmd.AddCommand(cobras.SplitCommand(NewCmdUpgradePlugins()))

	return o.Cmd, o
}

// Run implements this command
func (o *Options) Run() error {
	return o.Cmd.Help()
}
07070100000098000081A4000000000000000000000001683E350C0000288B000000000000000000000000000000000000003500000000jenkins-x-cli-3.11.92/pkg/cmd/upgrade/upgrade_cli.gopackage upgrade

import (
	"errors"
	"fmt"
	"os"
	"os/exec"
	"path/filepath"
	"runtime"
	"strings"

	"github.com/jenkins-x/jx-helpers/v3/pkg/kube/jxenv"

	"github.com/jenkins-x/jx-helpers/v3/pkg/kube/jxclient"

	"sigs.k8s.io/kustomize/kyaml/yaml"

	"github.com/jenkins-x/jx-api/v4/pkg/util"
	"github.com/jenkins-x/jx-helpers/v3/pkg/files"

	"github.com/jenkins-x/jx/pkg/cmd/version"

	jxcore "github.com/jenkins-x/jx-api/v4/pkg/apis/core/v4beta1"
	"github.com/jenkins-x/jx-helpers/v3/pkg/termcolor"
	"github.com/rhysd/go-github-selfupdate/selfupdate"

	"github.com/blang/semver"
	"github.com/jenkins-x/jx-helpers/v3/pkg/versionstream"

	"github.com/jenkins-x/jx-helpers/v3/pkg/cmdrunner"
	"github.com/jenkins-x/jx-helpers/v3/pkg/cobras/helper"
	"github.com/jenkins-x/jx-helpers/v3/pkg/cobras/templates"
	"github.com/jenkins-x/jx-helpers/v3/pkg/gitclient"
	"github.com/jenkins-x/jx-helpers/v3/pkg/gitclient/cli"
	"github.com/jenkins-x/jx-logging/v3/pkg/log"

	"github.com/spf13/cobra"
)

var (
	cmdCLILong = templates.LongDesc(`
		Upgrades your local Jenkins X CLI
`)

	cmdCLIExample = templates.Examples(`
		# upgrades your jx CLI
		jx upgrade cli
	`)
)

const (
	// BinaryDownloadBaseURL the base URL for downloading the binary from - will always have "VERSION/jx-OS-ARCH.EXTENSION" appended to it when used
	BinaryDownloadBaseURL  = "https://github.com/jenkins-x/jx/releases/download/v"
	LatestVersionstreamURL = "https://github.com/jenkins-x/jx3-versions.git"
)

// UpgradeOptions the options for upgrading a cluster
type CLIOptions struct {
	CommandRunner       cmdrunner.CommandRunner
	GitClient           gitclient.Interface
	Version             string
	VersionStreamGitURL string
	FromEnvironment     bool
}

// NewCmdUpgrade creates a command object for the command
func NewCmdUpgradeCLI() (*cobra.Command, *CLIOptions) {
	o := &CLIOptions{}

	cmd := &cobra.Command{
		Use:     "cli",
		Short:   "Upgrades your local Jenkins X CLI",
		Long:    cmdCLILong,
		Example: cmdCLIExample,
		Run: func(_ *cobra.Command, _ []string) {
			err := o.Run()
			helper.CheckErr(err)
		},
	}
	cmd.Flags().StringVarP(&o.Version, "version", "v", "", "The specific version to upgrade to (requires --brew=false on macOS)")
	cmd.Flags().StringVarP(&o.VersionStreamGitURL, "version-stream-git-url", "", "", "The version stream git URL to lookup the jx cli version to upgrade to")
	cmd.Flags().BoolVarP(&o.FromEnvironment, "from-environment", "e", false, "Use the clusters dev environment to obtain the version stream URL to find correct version to upgrade the jx cli, this overrides version-stream-git-url")
	return cmd, o
}

// Run implements the command
func (o *CLIOptions) Run() error {
	var err error

	candidateInstallVersion, err := o.candidateInstallVersion()
	if err != nil {
		return fmt.Errorf("failed to find jx cli version: %w", err)
	}

	currentVersion, err := version.GetSemverVersion()
	if err != nil {
		return fmt.Errorf("failed to determine version of currently install jx release: %w", err)
	}

	log.Logger().Debugf("Current version of jx: %s", termcolor.ColorInfo(currentVersion))

	if o.NeedsUpgrade(currentVersion, candidateInstallVersion) {
		shouldUpgrade, err := o.ShouldUpdate(candidateInstallVersion)
		if err != nil {
			return fmt.Errorf("failed to determine if we should upgrade: %w", err)
		}
		if shouldUpgrade {
			return o.InstallJx(true, candidateInstallVersion.String())
		}
	}

	return nil
}

func (o *CLIOptions) candidateInstallVersion() (semver.Version, error) {
	var err error
	if o.Version == "" {
		// if version stream URL is set via a flag use this
		gitURL := o.VersionStreamGitURL
		if gitURL == "" {
			// get the versionstream URL used to find what jx version to upgrade to
			gitURL, err = o.getVersionStreamURL(gitURL)
			if err != nil {
				return semver.Version{}, fmt.Errorf("failed to get version stream : %w", err)
			}
		}

		if gitURL == "" {
			return semver.Version{}, errors.New("no version stream URL to get correct jx version")
		}

		o.Version, err = o.getJXVersion(gitURL)
		if err != nil {
			return semver.Version{}, fmt.Errorf("failed to get jx cli version from %s: %w", gitURL, err)
		}
	}

	requestedVersion, err := semver.New(o.Version)
	if err != nil {
		return semver.Version{}, fmt.Errorf("invalid version requested: %s: %w", o.Version, err)
	}
	return *requestedVersion, nil
}

// get the versionstream URL used to find what jx version to upgrade to
func (o *CLIOptions) getVersionStreamURL(gitURL string) (string, error) {
	// lookup the version stream URL from the Kptfile
	// we do this in case we are switching version streams and need to update CLI before running jx gitops upgrade

	path := filepath.Join("versionStream", "Kptfile")
	exists, err := files.FileExists(path)

	if o.FromEnvironment && exists {
		return "", errors.New("local %s found in current directory and from-environment flag set, pick only one")
	}

	// if there's a local kptfile found use the versionstream git details in that, if not use the cluster git repo
	if err == nil && exists {
		node, err := yaml.ReadFile(path)
		if err == nil {
			refNode, err := node.Pipe(yaml.Lookup("upstream", "git", "repo"))
			if err == nil {
				gitURL, err = refNode.String()
				if err != nil {
					return "", fmt.Errorf("failed to get a string value of the Kptfile git repo: %w", err)
				}
				gitURL = strings.TrimSpace(gitURL)

				log.Logger().Infof("using local versionstream URL %s from Kptfile to resolve jx version", gitURL)
			}
		}
	}
	if o.FromEnvironment {
		// lookup the cluster git repo from the dev environment and use that as the versionstream
		jXClient, err := jxclient.LazyCreateJXClient(nil)
		if err != nil {
			return "", fmt.Errorf("failed to create jx client: %w", err)
		}

		env, err := jxenv.GetDevEnvironment(jXClient, jxcore.DefaultNamespace)
		if err == nil {
			if env.Spec.Source.URL != "" {
				gitURL = env.Spec.Source.URL
				log.Logger().Infof("using clusters dev environent versionstream URL %s from Kptfile to resolve jx version", gitURL)
			}
		}
	}
	if gitURL == "" {
		// if none of the options above find a git url lets default to the latest upstream version stream
		gitURL = LatestVersionstreamURL
		log.Logger().Infof("using latest upstream versionstream URL %s from Kptfile to resolve jx version", gitURL)
	}
	return gitURL, nil
}

func (*CLIOptions) NeedsUpgrade(currentVersion, latestVersion semver.Version) bool {
	if latestVersion.EQ(currentVersion) {
		log.Logger().Infof("You are already on the latest version of jx %s", termcolor.ColorInfo(currentVersion.String()))
		return false
	}
	return true
}

// ShouldUpdate checks if CLI version should be updated
func (*CLIOptions) ShouldUpdate(newVersion semver.Version) (bool, error) {
	log.Logger().Debugf("Checking if should upgrade %s", newVersion)
	currentVersion, err := version.GetSemverVersion()
	if err != nil {
		return false, err
	}

	if newVersion.GT(currentVersion) {
		// Do not ask to update if we are using a dev build...
		for _, x := range currentVersion.Pre {
			if x.VersionStr == "dev" {
				log.Logger().Debugf("Ignoring possible update as it appears you are using a dev build - %s", currentVersion)
				return false, nil
			}
		}
		return true, nil
	}
	return false, nil
}

// InstallJx installs jx cli
func (*CLIOptions) InstallJx(upgrade bool, version string) error {
	log.Logger().Debugf("installing jx %s", version)
	binary := "jx"
	if !upgrade {
		flag, err := shouldInstallBinary(binary)
		if err != nil || !flag {
			return err
		}
	}

	extension := "tar.gz"
	if runtime.GOOS == "windows" {
		extension = "zip"
	}
	log.Logger().Infof("downloading version %s...", version)
	clientURL := fmt.Sprintf("%s%s/"+binary+"-%s-%s.%s", BinaryDownloadBaseURL, version, runtime.GOOS, runtime.GOARCH, extension)
	exe, err := os.Executable()
	if err != nil {
		return fmt.Errorf("failed to get the jx executable which is running this command: %w", err)
	}

	err = selfupdate.UpdateTo(clientURL, exe)
	if err != nil {
		return fmt.Errorf("failed to upgrade jx cli to version %s: %w", version, err)
	}
	log.Logger().Infof("Jenkins X client has been upgraded to version %s", version)
	return nil
}

func (o *CLIOptions) getJXVersion(gitURL string) (string, error) {
	if o.GitClient == nil {
		o.GitClient = cli.NewCLIClient("", cmdrunner.QuietCommandRunner)
	}

	versionStreamDir, err := gitclient.CloneToDir(o.GitClient, gitURL, "")
	if err != nil {
		return "", fmt.Errorf("failed to clone git repo %s: %w", gitURL, err)
	}

	exists, _ := files.DirExists(filepath.Join(versionStreamDir, "versionStream"))
	if exists {
		versionStreamDir = filepath.Join(versionStreamDir, "versionStream")
	}

	resolver := &versionstream.VersionResolver{
		VersionsDir: versionStreamDir,
	}

	data, err := resolver.StableVersion(versionstream.KindPackage, "jx")
	if err != nil {
		return "", fmt.Errorf("failed to get stable version for %s from versionstream %s: %w", "jx", gitURL, err)
	}
	return data.Version, nil
}

// shouldInstallBinary checks if the given binary should be installed
func shouldInstallBinary(name string) (bool, error) {
	fileName := BinaryWithExtension(name)
	download := false

	binDir, err := util.JXBinLocation()
	if err != nil {
		return download, fmt.Errorf("unable to find JXBinLocation at %s: %w", binDir, err)
	}

	if contains(GlobalBinaryPathAllowlist, name) {
		_, err = exec.LookPath(fileName)
		if err != nil {
			log.Logger().Warnf("%s is not available on your PATH", termcolor.ColorInfo(fileName))
			return true, nil
		}
		return false, nil
	}

	exists, err := files.FileExists(filepath.Join(binDir, fileName))
	if exists {
		log.Logger().Debugf("%s is already available in your JXBIN at %s", termcolor.ColorInfo(fileName), termcolor.ColorInfo(binDir))
		return download, nil
	}
	if err != nil {
		return download, fmt.Errorf("unable to check files on %s: %w", binDir, err)
	}

	download = true
	return download, nil
}

func BinaryWithExtension(binary string) string {
	if runtime.GOOS == "windows" {
		if binary == "gcloud" {
			return binary + ".cmd"
		}
		return binary + ".exe"
	}
	return binary
}

func contains(arr []string, str string) bool {
	for _, a := range arr {
		if a == str {
			return true
		}
	}
	return false
}

// GlobalBinaryPathAllowlist binaries that require to be on the path but do not need to exist in JX_HOME/bin
var GlobalBinaryPathAllowlist = []string{
	"az",
	"gcloud",
	"oc",
	"brew",
}
07070100000099000081A4000000000000000000000001683E350C00000E8D000000000000000000000000000000000000003A00000000jenkins-x-cli-3.11.92/pkg/cmd/upgrade/upgrade_cli_test.gopackage upgrade_test

import (
	"fmt"
	"testing"

	"github.com/jenkins-x/jx-logging/v3/pkg/log"
	"github.com/jenkins-x/jx/pkg/cmd/upgrade"
	"github.com/jenkins-x/jx/pkg/cmd/version"

	"github.com/blang/semver"

	"github.com/stretchr/testify/assert"
	// typev1 "github.com/jenkins-x/jx-api/v4/pkg/client/clientset/versioned/typed/jenkins.io/v1"
)

func TestNeedsUpgrade(t *testing.T) {
	type testData struct {
		current               string
		latest                string
		expectedUpgradeNeeded bool
		expectedMessage       string
	}

	testCases := []testData{
		{
			"1.0.0", "1.0.0", false, "You are already on the latest version of jx 1.0.0\n",
		},
		{
			"1.0.0", "1.0.1", true, "",
		},
		{
			"1.0.0", "0.0.99", true, "",
		},
	}

	o := upgrade.CLIOptions{}
	for _, data := range testCases {
		currentVersion, _ := semver.New(data.current)
		latestVersion, _ := semver.New(data.latest)
		actualMessage := log.CaptureOutput(func() {
			actualUpgradeNeeded := o.NeedsUpgrade(*currentVersion, *latestVersion)
			assert.Equal(t, data.expectedUpgradeNeeded, actualUpgradeNeeded, fmt.Sprintf("Unexpected upgrade flag for %v", data))
		})
		assert.Equal(t, data.expectedMessage, actualMessage, fmt.Sprintf("Unexpected message for %v", data))
	}
}

func TestNewCmdUpgradeCLI(t *testing.T) {
	cmd, o := upgrade.NewCmdUpgradeCLI()
	o.Version = "3.2.238"
	err := cmd.Execute()
	assert.NoError(t, err)
}

func TestVersionCheckWhenCurrentVersionIsGreaterThanReleaseVersion(t *testing.T) {
	jxVersion := semver.Version{Major: 1, Minor: 3, Patch: 153}
	version.Version = "1.4.0"
	opts := &upgrade.CLIOptions{}
	update, err := opts.ShouldUpdate(jxVersion)
	assert.NoError(t, err, "should check version without failure")
	assert.False(t, update, "should not update")
}

func TestVersionCheckWhenCurrentVersionIsEqualToReleaseVersion(t *testing.T) {
	jxVersion := semver.Version{Major: 1, Minor: 2, Patch: 3}
	version.Version = "1.2.3"
	opts := &upgrade.CLIOptions{}
	update, err := opts.ShouldUpdate(jxVersion)
	assert.NoError(t, err, "should check version without failure")
	assert.False(t, update, "should not update")
}

func TestVersionCheckWhenCurrentVersionIsLessThanReleaseVersion(t *testing.T) {
	jxVersion := semver.Version{Major: 1, Minor: 3, Patch: 153}
	version.Version = "1.0.0"
	opts := &upgrade.CLIOptions{}
	update, err := opts.ShouldUpdate(jxVersion)
	assert.NoError(t, err, "should check version without failure")
	assert.True(t, update, "should update")
}

func TestVersionCheckWhenCurrentVersionIsEqualToReleaseVersionWithPatch(t *testing.T) {
	var prVersions []semver.PRVersion
	prVersions = append(prVersions, semver.PRVersion{VersionStr: "dev"})
	jxVersion := semver.Version{Major: 1, Minor: 2, Patch: 3, Pre: prVersions, Build: []string(nil)}
	version.Version = "1.2.3"
	opts := &upgrade.CLIOptions{}
	update, err := opts.ShouldUpdate(jxVersion)
	assert.NoError(t, err, "should check version without failure")
	assert.False(t, update, "should not update")
}

func TestVersionCheckWhenCurrentVersionWithPatchIsEqualToReleaseVersion(t *testing.T) {
	jxVersion := semver.Version{Major: 1, Minor: 2, Patch: 3}
	version.Version = "1.2.3-dev+6a8285f4"
	opts := &upgrade.CLIOptions{}
	update, err := opts.ShouldUpdate(jxVersion)
	assert.NoError(t, err, "should check version without failure")
	assert.False(t, update, "should not update")
}

func TestVersionCheckWhenCurrentVersionWithPatchIsLessThanReleaseVersion(t *testing.T) {
	jxVersion := semver.Version{Major: 1, Minor: 2, Patch: 3}
	version.Version = "1.2.2-dev+6a8285f4"
	opts := &upgrade.CLIOptions{}
	update, err := opts.ShouldUpdate(jxVersion)
	assert.NoError(t, err, "should check version without failure")
	assert.False(t, update, "should not update")
}
0707010000009A000081A4000000000000000000000001683E350C00000FB0000000000000000000000000000000000000003900000000jenkins-x-cli-3.11.92/pkg/cmd/upgrade/upgrade_plugins.gopackage upgrade

import (
	"fmt"
	"os"
	"regexp"

	"github.com/jenkins-x/jx-helpers/v3/pkg/cmdrunner"
	"github.com/jenkins-x/jx-helpers/v3/pkg/cobras/helper"
	"github.com/jenkins-x/jx-helpers/v3/pkg/cobras/templates"
	"github.com/jenkins-x/jx-helpers/v3/pkg/extensions"
	"github.com/jenkins-x/jx-helpers/v3/pkg/homedir"
	"github.com/jenkins-x/jx-helpers/v3/pkg/termcolor"
	"github.com/jenkins-x/jx-logging/v3/pkg/log"
	"github.com/jenkins-x/jx/pkg/plugins"

	"github.com/spf13/cobra"
)

var (
	cmdPluginsLong = templates.LongDesc(`
		Upgrades all of the plugins in your local Jenkins X CLI
`)

	cmdPluginsExample = templates.Examples(`
		# upgrades your plugin binaries
		jx upgrade plugins
	`)

	bootPlugins = map[string]bool{
		"gitops":    true,
		"health":    true,
		"secret":    true,
		"verify":    true,
		"changelog": true,
	}
)

// UpgradeOptions the options for upgrading a cluster
type PluginOptions struct {
	CommandRunner cmdrunner.CommandRunner
	OnlyMandatory bool
	Boot          bool
	Path          string
}

// NewCmdUpgrade creates a command object for the command
func NewCmdUpgradePlugins() (*cobra.Command, *PluginOptions) {
	o := &PluginOptions{}

	cmd := &cobra.Command{
		Use:     "plugins",
		Short:   "Upgrades all of the plugins in your local Jenkins X CLI",
		Long:    cmdPluginsLong,
		Example: cmdPluginsExample,
		Run: func(_ *cobra.Command, _ []string) {
			err := o.Run()
			helper.CheckErr(err)
		},
	}
	cmd.Flags().BoolVarP(&o.OnlyMandatory, "mandatory", "m", false, "if set lets ignore optional plugins")
	cmd.Flags().BoolVarP(&o.Boot, "boot", "", false, "only install plugins required for boot")
	cmd.Flags().StringVarP(&o.Path, "path", "", "/usr/bin", "creates a symlink to the binary plugins in this bin path dir")

	return cmd, o
}

// Run implements the command
func (o *PluginOptions) Run() error {
	pluginBinDir, err := homedir.DefaultPluginBinDir()
	if err != nil {
		return fmt.Errorf("failed to find plugin bin directory: %w", err)
	}

	if o.CommandRunner == nil {
		o.CommandRunner = cmdrunner.DefaultCommandRunner
	}
	for k := range plugins.Plugins {
		p := plugins.Plugins[k]
		if o.Boot && !bootPlugins[p.Name] {
			continue
		}
		log.Logger().Infof("checking binary jx plugin %s version %s is installed", termcolor.ColorInfo(p.Name), termcolor.ColorInfo(p.Spec.Version))
		fileName, err := extensions.EnsurePluginInstalled(p, pluginBinDir)
		if err != nil {
			return fmt.Errorf("failed to ensure plugin is installed %s: %w", p.Name, err)
		}

		if o.Boot {
			if p.Name == "gitops" {
				c := &cmdrunner.Command{
					Name: fileName,
					Args: []string{"plugin", "upgrade", "--path", o.Path},
				}
				_, err = o.CommandRunner(c)
				if err != nil {
					return fmt.Errorf("failed to upgrade gitops plugin %s: %w", p.Name, err)
				}
			}
			continue
		}

		// TODO we could use metadata on the plugin for this?
		if p.Name == "secret" {
			c := &cmdrunner.Command{
				Name: fileName,
				Args: []string{"plugins", "upgrade"},
			}
			_, err = o.CommandRunner(c)
			if err != nil {
				return fmt.Errorf("failed to upgrade plugin %s: %w", p.Name, err)
			}
		}
	}
	if !(o.OnlyMandatory || o.Boot) {
		// Upgrade the rest
		file, err := os.Open(pluginBinDir)
		if err != nil {
			return fmt.Errorf("failed to read plugin dir %s: %w", pluginBinDir, err)
		}
		defer file.Close()
		files, err := file.Readdirnames(0)
		if err != nil {
			return fmt.Errorf("failed to read plugin dir %s: %w", pluginBinDir, err)
		}
		pluginPattern := regexp.MustCompile("^(jx-.*)-[0-9.]+$")
		extraPlugins := make(map[string]bool)
		for _, plugin := range files {
			res := pluginPattern.FindStringSubmatch(plugin)
			if len(res) > 1 {
				cleanPlugin := res[1]
				if plugins.PluginMap[cleanPlugin] == nil {
					extraPlugins[cleanPlugin] = true
				}
			}
		}
		for plugin := range extraPlugins {
			_, err = plugins.InstallStandardPlugin(pluginBinDir, plugin)
			if err != nil {
				log.Logger().Warnf("Failed to upgrade plugin %s: %+v", plugin, err)
			}
		}
	}

	return nil
}
0707010000009B000081A4000000000000000000000001683E350C0000012D000000000000000000000000000000000000003E00000000jenkins-x-cli-3.11.92/pkg/cmd/upgrade/upgrade_plugins_test.gopackage upgrade_test

import (
	"testing"

	"github.com/jenkins-x/jx/pkg/cmd/upgrade"
	"github.com/stretchr/testify/require"
)

func TestUpgrade(t *testing.T) {
	t.Parallel()

	cmd, _ := upgrade.NewCmdUpgradePlugins()

	err := cmd.Execute()
	require.NoError(t, err, "failed to run upgrade command")
}
0707010000009C000081A4000000000000000000000001683E350C000000F9000000000000000000000000000000000000003600000000jenkins-x-cli-3.11.92/pkg/cmd/upgrade/upgrade_test.gopackage upgrade_test

import (
	"testing"

	"github.com/jenkins-x/jx/pkg/cmd/upgrade"
	"github.com/stretchr/testify/assert"
)

func TestNewCmdUpgrade(t *testing.T) {
	cmd, _ := upgrade.NewCmdUpgrade()
	err := cmd.Execute()
	assert.NoError(t, err)
}
0707010000009D000041ED000000000000000000000002683E350C00000000000000000000000000000000000000000000002600000000jenkins-x-cli-3.11.92/pkg/cmd/version0707010000009E000081A4000000000000000000000001683E350C00000E32000000000000000000000000000000000000003100000000jenkins-x-cli-3.11.92/pkg/cmd/version/version.gopackage version

import (
	"fmt"
	"io"
	"os"

	"github.com/blang/semver"

	"github.com/spf13/cobra"
)

// Build information. Populated at build-time.
type buildInfo struct {
	Version      string
	Revision     string
	Branch       string
	GitTreeState string
	BuildDate    string
	GoVersion    string
}

// Build information. Populated at build-time.
var (
	Version      string
	Revision     string
	BuildDate    string
	GoVersion    string
	Branch       string
	GitTreeState string
)

const (

	// TestVersion used in test cases for the current version if no
	// version can be found - such as if the version property is not properly
	// included in the go test flags.
	TestVersion = "3.2.238"

	// TestRevision can be used in tests if no revision is passed in the test flags
	TestRevision = "04b628f48"

	// TestBranch can be used in tests if no tree state is passed in the test flags
	TestBranch = "main"

	// TestTreeState can be used in tests if no tree state is passed in the test flags
	TestTreeState = "clean"

	// TestBuildDate can be used in tests if no build date is passed in the test flags
	TestBuildDate = "2022-05-31T14:51:38Z"

	// TestGoVersion can be used in tests if no version is passed in the test flags
	TestGoVersion = "1.17.8"
)

// ShowOptions the options for viewing running PRs
type Options struct {
	Verbose bool
	Quiet   bool
	Short   bool
	Out     io.Writer
}

// NewCmdVersion creates a command object for the "version" command
func NewCmdVersion() (*cobra.Command, *Options) {
	o := &Options{}

	cmd := &cobra.Command{
		Use:   "version",
		Short: "Displays the version of this command",
		Run: func(_ *cobra.Command, _ []string) {
			o.run()
		},
	}
	cmd.Flags().BoolVarP(&o.Quiet, "quiet", "q", false, "uses the quiet format of just outputting the version number only")
	cmd.Flags().BoolVarP(&o.Short, "short", "s", false, "uses the short format of just outputting the version number only")
	return cmd, o
}

// Run implements the command
func (o *Options) run() {
	v := getBuildInfo()
	if o.Out == nil {
		o.Out = os.Stdout
	}
	if o.Quiet {
		fmt.Fprintln(o.Out, "The --quit, -q flag is being deprecated from JX on Oct 2022\nUse --short, -s instead")
		fmt.Fprintf(o.Out, "%s\n", v.Version)
		return
	}
	if o.Short {
		fmt.Fprintf(o.Out, "%s\n", v.Version)
		return
	}
	fmt.Fprintf(o.Out, "version: %s\n", v.Version)
	fmt.Fprintf(o.Out, "shaCommit: %s\n", v.Revision)
	fmt.Fprintf(o.Out, "buildDate: %s\n", v.BuildDate)
	fmt.Fprintf(o.Out, "goVersion: %s\n", v.GoVersion)
	fmt.Fprintf(o.Out, "branch: %s\n", v.Branch)
	fmt.Fprintf(o.Out, "gitTreeState: %s\n", v.GitTreeState)
}

func getBuildInfo() buildInfo {
	return buildInfo{
		Version:      getVersion(),
		Revision:     getCommitSha(),
		Branch:       getBranch(),
		GitTreeState: getTreeState(),
		BuildDate:    getBuildDate(),
		GoVersion:    getGoVersion(),
	}
}

func getVersion() string {
	if Version != "" {
		return Version
	}
	return TestVersion
}

func getGoVersion() string {
	if GoVersion != "" {
		return GoVersion
	}
	return TestGoVersion
}

func getCommitSha() string {
	if Revision != "" {
		return Revision
	}
	return TestRevision
}

func getBuildDate() string {
	if BuildDate != "" {
		return BuildDate
	}
	return TestBuildDate
}

func getBranch() string {
	if Branch != "" {
		return Branch
	}
	return TestBranch
}

func getTreeState() string {
	if GitTreeState != "" {
		return GitTreeState
	}
	return TestTreeState
}

func GetSemverVersion() (semver.Version, error) {
	text := getVersion()
	v, err := semver.Make(text)
	if err != nil {
		return v, fmt.Errorf("failed to parse version %s: %w", text, err)
	}
	return v, nil
}
0707010000009F000081A4000000000000000000000001683E350C0000066D000000000000000000000000000000000000003600000000jenkins-x-cli-3.11.92/pkg/cmd/version/version_test.gopackage version_test

import (
	"bytes"
	"fmt"
	"testing"

	"github.com/jenkins-x/jx/pkg/cmd/version"
	"github.com/stretchr/testify/assert"
)

// define a strtuct for test cases for the version command
type TestCase struct {
	args        []string
	err         error
	description string
	out         string
}

var testCases = []TestCase{
	{
		args:        nil,
		err:         nil,
		description: "This is to test without flags",
		out:         "version: 3.2.238\nshaCommit: 04b628f48\nbuildDate: 2022-05-31T14:51:38Z\ngoVersion: 1.17.8\nbranch: main\ngitTreeState: clean\n",
	},
	{
		args:        []string{"-q"},
		err:         nil,
		description: "This is to test -q flag",
		out:         "The --quit, -q flag is being deprecated from JX on Oct 2022\nUse --short, -s instead\n3.2.238\n",
	},
	{
		args:        []string{"--quiet"},
		err:         nil,
		description: "This is to test --quiet flag",
		out:         "The --quit, -q flag is being deprecated from JX on Oct 2022\nUse --short, -s instead\n3.2.238\n",
	},
	{
		args:        []string{"-s"},
		err:         nil,
		description: "This is to test -s flag",
		out:         "3.2.238\n",
	},
	{
		args:        []string{"--short"},
		err:         nil,
		description: "This is to test --short flag",
		out:         "3.2.238\n",
	},
}

func TestNewCmdVersion(t *testing.T) {
	for _, testCase := range testCases {
		var buf bytes.Buffer
		cmd, options := version.NewCmdVersion()
		options.Out = &buf
		cmd.SetArgs(testCase.args)
		err := cmd.Execute()

		fmt.Println(testCase.description)
		assert.NoError(t, err)
		if testCase.err == nil {
			assert.Equal(t, testCase.out, buf.String())
		}
	}
}
070701000000A0000041ED000000000000000000000002683E350C00000000000000000000000000000000000000000000002100000000jenkins-x-cli-3.11.92/pkg/common070701000000A1000081A4000000000000000000000001683E350C0000000F000000000000000000000000000000000000002E00000000jenkins-x-cli-3.11.92/pkg/common/constants.gopackage common
070701000000A2000041ED000000000000000000000002683E350C00000000000000000000000000000000000000000000002200000000jenkins-x-cli-3.11.92/pkg/plugins070701000000A3000081A4000000000000000000000001683E350C0000374D000000000000000000000000000000000000002D00000000jenkins-x-cli-3.11.92/pkg/plugins/helpers.gopackage plugins

import (
	"bytes"
	"fmt"
	"io"
	"net/http"
	"os"
	"os/exec"
	"path/filepath"
	"regexp"
	"runtime"
	"sort"
	"strconv"
	"strings"
	"syscall"

	"github.com/blang/semver"
	"github.com/spf13/cobra"

	jenkinsv1 "github.com/jenkins-x/jx-api/v4/pkg/apis/jenkins.io/v1"
	"github.com/jenkins-x/jx-helpers/v3/pkg/extensions"
	"github.com/jenkins-x/jx-helpers/v3/pkg/homedir"
	"github.com/jenkins-x/jx-helpers/v3/pkg/httphelpers"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/apimachinery/pkg/util/json"
)

const (
	jenkinsxOrganisation        = "jenkins-x"
	jenkinsxPluginsOrganisation = "jenkins-x-plugins"

	// OctantPluginName the default name of the octant plugin
	OctantPluginName = "octant"

	// OctantJXPluginName the name of the octant-jx plugin
	OctantJXPluginName = "octant-jx"

	// OctantJXOPluginName the name of the octant-jxo plugin
	OctantJXOPluginName = "octant-jxo"
)

// GetJXPlugin returns the path to the locally installed jx plugin
func GetJXPlugin(name, version string) (string, error) {
	pluginBinDir, err := homedir.DefaultPluginBinDir()
	if err != nil {
		return "", err
	}
	plugin := extensions.CreateJXPlugin(jenkinsxOrganisation, name, version)
	return extensions.EnsurePluginInstalled(plugin, pluginBinDir)
}

// GetOctantBinary returns the path to the locally installed octant plugin
func GetOctantBinary(version string) (string, error) {
	if version == "" {
		version = OctantVersion
	}
	pluginBinDir, err := homedir.DefaultPluginBinDir()
	if err != nil {
		return "", err
	}
	plugin := CreateOctantPlugin(version)
	return extensions.EnsurePluginInstalled(plugin, pluginBinDir)
}

// CreateOctantPlugin creates the helm 3 plugin
func CreateOctantPlugin(version string) jenkinsv1.Plugin {
	binaries := extensions.CreateBinaries(func(p extensions.Platform) string {
		kind := strings.ToLower(p.Goarch)
		if strings.HasSuffix(kind, "64") {
			kind = "64bit"
		}
		goos := p.Goos
		if goos == "Darwin" {
			goos = "macOS"
		}
		return fmt.Sprintf("https://github.com/vmware-tanzu/octant/releases/download/v%s/octant_%s_%s-%s.%s", version, version, goos, kind, p.Extension())
	})

	plugin := jenkinsv1.Plugin{
		ObjectMeta: metav1.ObjectMeta{
			Name: OctantPluginName,
		},
		Spec: jenkinsv1.PluginSpec{
			SubCommand:  "octant",
			Binaries:    binaries,
			Description: "octant binary",
			Name:        OctantPluginName,
			Version:     version,
		},
	}
	return plugin
}

// GetOctantJXBinary returns the path to the locally installed octant-jx extension
func GetOctantJXBinary(version string) (string, error) {
	if version == "" {
		version = OctantJXVersion
	}
	pluginBinDir, err := homedir.DefaultPluginBinDir()
	if err != nil {
		return "", err
	}
	plugin := CreateOctantJXPlugin(version)
	return extensions.EnsurePluginInstalled(plugin, pluginBinDir)
}

// CreateOctantJXPlugin creates the helm 3 plugin
func CreateOctantJXPlugin(version string) jenkinsv1.Plugin {
	binaries := extensions.CreateBinaries(func(p extensions.Platform) string {
		return fmt.Sprintf("https://github.com/jenkins-x-plugins/octant-jx/releases/download/v%s/octant-jx-%s-%s.%s", version, strings.ToLower(p.Goos), strings.ToLower(p.Goarch), p.Extension())
	})

	plugin := jenkinsv1.Plugin{
		ObjectMeta: metav1.ObjectMeta{
			Name: OctantJXPluginName,
		},
		Spec: jenkinsv1.PluginSpec{
			SubCommand:  "octant-jx",
			Binaries:    binaries,
			Description: "octant plugin for Jenkins X",
			Name:        OctantJXPluginName,
			Version:     version,
		},
	}
	return plugin
}

// GetOctantJXOBinary returns the path to the locally installed helmAnnotate extension
func GetOctantJXOBinary(version string) (string, error) {
	if version == "" {
		version = OctantJXVersion
	}
	pluginBinDir, err := homedir.DefaultPluginBinDir()
	if err != nil {
		return "", err
	}
	plugin := CreateOctantJXOPlugin(version)
	aliasFileName := "ha.tar.gz"
	if runtime.GOOS == "windows" {
		aliasFileName = "ha.zip"
	}
	return extensions.EnsurePluginInstalledForAliasFile(plugin, pluginBinDir, aliasFileName)
}

// CreateOctantJXOPlugin creates the octant-ojx plugin
func CreateOctantJXOPlugin(version string) jenkinsv1.Plugin {
	plugin := CreateOctantJXPlugin(version)
	plugin.Name = OctantJXOPluginName
	plugin.Spec.Name = OctantJXOPluginName
	plugin.Spec.SubCommand = OctantJXOPluginName
	return plugin
}

type githubRelease struct {
	TagName string `json:"tag_name"`
}

// InstallStandardPlugin makes sure that latest version of plugin is installed and returns the path to the binary
func InstallStandardPlugin(dir, name string) (string, error) {
	u := "https://api.github.com/repos/jenkins-x-plugins/" + name + "/releases/latest"

	client := httphelpers.GetClient()
	req, err := http.NewRequest("GET", u, http.NoBody)
	if err != nil {
		return "", fmt.Errorf("failed to create http request for %s: %w", u, err)
	}
	resp, err := client.Do(req)
	if err != nil {
		if resp != nil {
			return "", fmt.Errorf("failed to GET endpoint %s with status %s: %w", u, resp.Status, err)
		}
		return "", fmt.Errorf("failed to GET endpoint %s: %w", u, err)
	}
	defer resp.Body.Close()
	body, err := io.ReadAll(resp.Body)
	if err != nil {
		return "", fmt.Errorf("failed to read response from %s: %w", u, err)
	}

	release := &githubRelease{}
	err = json.Unmarshal(body, release)
	if err != nil {
		return "", fmt.Errorf("failed to unmarshal release from %s: %w", u, err)
	}
	latestVersion := strings.TrimPrefix(release.TagName, "v")
	if latestVersion == "" {
		return "", fmt.Errorf("can't find latest version of plugin: %s", body)
	}

	plugin := extensions.CreateJXPlugin("jenkins-x-plugins", strings.TrimPrefix(name, "jx-"), latestVersion)
	if err != nil {
		return "", err
	}
	return extensions.EnsurePluginInstalled(plugin, dir)
}

func AllPlugins() (validArgs []string) {
	pluginBinDir, err := homedir.DefaultPluginBinDir()
	for k := range Plugins {
		validArgs = append(validArgs, Plugins[k].Name)
	}
	if err != nil {
		return
	}
	file, err := os.Open(pluginBinDir)
	if err != nil {
		return
	}
	defer file.Close()
	files, err := file.Readdirnames(0)
	if err != nil {
		return
	}
	pluginPattern := regexp.MustCompile("^jx-(.*)-[0-9.]+$")
	for _, plugin := range files {
		res := pluginPattern.FindStringSubmatch(plugin)
		if len(res) > 1 && PluginMap["jx-"+res[1]] == nil {
			validArgs = append(validArgs, res[1])
		}
	}
	return
}

// SetupPluginCompletion adds a Cobra command to the command tree for each
// plugin.  This is only done when performing shell completion that relate
// to plugins.
func SetupPluginCompletion(cmd *cobra.Command, args []string) {
	root := cmd.Root()
	if len(args) == 0 {
		return
	}
	if strings.HasPrefix(args[0], "-") {
		// Plugins are not supported if the first argument is a flag,
		// so no need to add them in that case.
		return
	}

	registerPluginCommands(root, true)
}

// registerPluginCommand allows adding Cobra command to the command tree or extracting them for usage in
// e.g. the help function or for registering the completion function
func registerPluginCommands(rootCmd *cobra.Command, list bool) (cmds []*cobra.Command) {
	var userDefinedCommands []*cobra.Command

	for _, plugin := range AllPlugins() {
		var args []string

		rawPluginArgs := strings.Split(plugin, "-")
		pluginArgs := rawPluginArgs[:1]
		if list {
			pluginArgs = rawPluginArgs
		}

		// Iterate through all segments, for kubectl-my_plugin-sub_cmd, we will end up with
		// two iterations: one for my_plugin and one for sub_cmd.
		for _, arg := range pluginArgs {
			// Underscores (_) in plugin's filename are replaced with dashes(-)
			// e.g. foo_bar -> foo-bar
			args = append(args, strings.ReplaceAll(arg, "_", "-"))
		}

		// In order to avoid that the same plugin command is added more than once,
		// find the lowest command given args from the root command
		parentCmd, remainingArgs, _ := rootCmd.Find(args)
		if parentCmd == nil {
			parentCmd = rootCmd
		}

		for _, remainingArg := range remainingArgs {
			cmd := &cobra.Command{
				Use: remainingArg,
				// Add a description that will be shown with completion choices.
				// Make each one different by including the plugin name to avoid
				// all plugins being grouped in a single line during completion for zsh.
				Short:              fmt.Sprintf("The command %s is a plugin", remainingArg),
				DisableFlagParsing: true,
				// Allow plugins to provide their own completion choices
				ValidArgsFunction: PluginCompletion,
				// A Run is required for it to be a valid command
				Run: func(_ *cobra.Command, _ []string) {},
			}
			// Add the plugin command to the list of user defined commands
			userDefinedCommands = append(userDefinedCommands, cmd)

			if list {
				parentCmd.AddCommand(cmd)
				parentCmd = cmd
			}
		}
	}

	return userDefinedCommands
}

// PluginCompletion deals with shell completion beyond the plugin name, it allows to complete
// plugin arguments and flags.
// It will call the plugin with __complete as the first argument.
//
// This completion command should print the completion choices to stdout, which is suported by default
// for commands developed with Cobra.
// The rest of the arguments will be the arguments for the plugin currently
// on the command-line.  For example, if a user types:
//
//	jx myplugin arg1 arg2 a<TAB>
//
// the plugin executable will be called with arguments: "__complete" "arg1" "arg2" "a".
// And if a user types:
//
//	jx myplugin arg1 arg2 <TAB>
//
// the completion executable will be called with arguments: "__complete" "arg1" "arg2" "".  Notice the empty
// last argument which indicates that a new word should be completed but that the user has not
// typed anything for it yet.
//
// JX's plugin completion logic supports Cobra's ShellCompDirective system.  This means a plugin
// can optionally print :<value of a shell completion directive> as its very last line to provide
// directives to the shell on how to perform completion.  If this directive is not present, the
// cobra.ShellCompDirectiveDefault will be used. Please see Cobra's documentation for more details:
// https://github.com/spf13/cobra/blob/master/shell_completions.md#dynamic-completion-of-nouns
func PluginCompletion(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
	// Recreate the plugin name from the commandPath
	pluginName := strings.ReplaceAll(strings.ReplaceAll(cmd.CommandPath(), "-", "_"), " ", "-")

	pluginDir, err := homedir.DefaultPluginBinDir()
	if err != nil {
		return nil, cobra.ShellCompDirectiveNoFileComp
	}
	path, err := Lookup(pluginName, pluginDir)
	if err != nil {
		return nil, cobra.ShellCompDirectiveNoFileComp
	}

	newArgs := make([]string, len(args)+2) //nolint:mnd
	newArgs[0] = "__complete"
	for i, arg := range args {
		newArgs[i+1] = arg
	}
	newArgs[len(newArgs)-1] = toComplete
	cobra.CompDebugln(fmt.Sprintf("About to call: %s %s", path, strings.Join(args, " ")), true)
	return getPluginCompletions(path, newArgs, os.Environ())
}

// getPluginCompletions receives an executable's filepath, a slice
// of arguments, and a slice of environment variables
// to relay to the executable.
func getPluginCompletions(executablePath string, cmdArgs, environment []string) ([]string, cobra.ShellCompDirective) {
	buf := new(bytes.Buffer)

	prog := exec.Command(executablePath, cmdArgs...)
	prog.Stdin = os.Stdin
	prog.Stdout = buf
	prog.Stderr = os.Stderr
	prog.Env = environment

	var comps []string
	directive := cobra.ShellCompDirectiveNoFileComp
	if err := prog.Run(); err == nil {
		for _, comp := range strings.Split(buf.String(), "\n") {
			// Remove any empty lines
			if comp != "" {
				comps = append(comps, comp)
			}
		}

		// Check if the last line of output is of the form :<integer>, which
		// indicates a Cobra ShellCompDirective.  We do this for plugins
		// that use Cobra or the ones that wish to use this directive to
		// communicate a special behavior for the shell.
		if len(comps) > 0 {
			lastLine := comps[len(comps)-1]
			if len(lastLine) > 1 && lastLine[0] == ':' {
				if strInt, err := strconv.Atoi(lastLine[1:]); err == nil {
					directive = cobra.ShellCompDirective(strInt)
					comps = comps[:len(comps)-1]
				}
			}
		}
	}
	return comps, directive
}

func FindStandardPlugin(dir, name string) (string, error) {
	file, err := os.Open(dir)
	if err != nil {
		return "", fmt.Errorf("failed to read plugin dir %s: %w", dir, err)
	}
	defer file.Close()
	files, err := file.Readdirnames(0)
	if err != nil {
		return "", fmt.Errorf("failed to read plugin dir %s: %w", dir, err)
	}
	pluginPattern, err := regexp.Compile("^" + name + "-([0-9.]+)$")
	if err != nil {
		return "", err
	}

	vers := make([]string, 0)
	for _, plugin := range files {
		res := pluginPattern.FindStringSubmatch(plugin)
		if len(res) > 1 {
			vers = append(vers, res[1])
		}
	}

	if len(vers) > 0 {
		vs := make([]semver.Version, 0)
		for _, r := range vers {
			v, err := semver.Parse(r)
			if err == nil {
				vs = append(vs, v)
			}
		}

		sort.Sort(sort.Reverse(semver.Versions(vs)))
		if len(vs) > 0 {
			return filepath.Join(dir, name+"-"+vs[0].String()), nil
		}
	}
	return InstallStandardPlugin(dir, name)
}

func Lookup(filename, pluginBinDir string) (string, error) {
	path, err := exec.LookPath(filename)
	if err != nil {
		path, err = FindStandardPlugin(pluginBinDir, filename)
		if err != nil {
			return "", fmt.Errorf("failed to load plugin %s: %w", filename, err)
		}
	}
	return path, nil
}

func Execute(executablePath string, cmdArgs, environment []string) error {
	// Windows does not support exec syscall.
	if runtime.GOOS == "windows" {
		cmd := exec.Command(executablePath, cmdArgs...)
		cmd.Stdout = os.Stdout
		cmd.Stderr = os.Stderr
		cmd.Stdin = os.Stdin
		cmd.Env = environment
		err := cmd.Run()
		if err == nil {
			os.Exit(0)
		}
		return err
	}

	// invoke cmd binary relaying the environment and args given
	// append executablePath to cmdArgs, as execve will make first argument the "binary name".
	// ToDo: Look at sanitizing the inputs passed to syscall exec, may be move away from syscall as it's deprecated.
	return syscall.Exec(executablePath, append([]string{executablePath}, cmdArgs...), environment) //nolint
}
070701000000A4000081A4000000000000000000000001683E350C00000E16000000000000000000000000000000000000003200000000jenkins-x-cli-3.11.92/pkg/plugins/helpers_test.gopackage plugins_test

import (
	"testing"

	"github.com/jenkins-x/jx/pkg/plugins"
	"github.com/stretchr/testify/assert"
)

func TestPlugins(t *testing.T) {
	t.Parallel()

	list := plugins.Plugins

	for _, p := range list {
		if p.Name != "gitops" {
			continue
		}
		assert.Equal(t, "jx-gitops", p.Spec.Name, "plugin.Spec.Name")

		foundLinux := false
		foundWindows := false
		for _, b := range p.Spec.Binaries {
			if b.Goos == "Linux" && b.Goarch == "amd64" {
				foundLinux = true
				assert.Equal(t, "https://github.com/jenkins-x-plugins/jx-gitops/releases/download/v"+plugins.GitOpsVersion+"/jx-gitops-linux-amd64.tar.gz", b.URL, "URL for linux binary")
				t.Logf("found linux binary URL %s", b.URL)
			} else if b.Goos == "Windows" && b.Goarch == "amd64" {
				foundWindows = true
				assert.Equal(t, "https://github.com/jenkins-x-plugins/jx-gitops/releases/download/v"+plugins.GitOpsVersion+"/jx-gitops-windows-amd64.zip", b.URL, "URL for windows binary")
				t.Logf("found windows binary URL %s", b.URL)
			}
		}
		assert.True(t, foundLinux, "did not find a linux binary in the plugin %#v", p)
		assert.True(t, foundWindows, "did not find a windows binary in the plugin %#v", p)
	}
}

func TestOctantPlugin(t *testing.T) {
	t.Parallel()

	plugin := plugins.CreateOctantPlugin("0.16.1")

	assert.Equal(t, plugins.OctantPluginName, plugin.Name, "plugin.Name")
	assert.Equal(t, plugins.OctantPluginName, plugin.Spec.Name, "plugin.Spec.Name")

	foundLinux := false
	foundWindows := false
	for _, b := range plugin.Spec.Binaries {
		if b.Goos == "Linux" && b.Goarch == "amd64" {
			foundLinux = true
			assert.Equal(t, "https://github.com/vmware-tanzu/octant/releases/download/v0.16.1/octant_0.16.1_Linux-64bit.tar.gz", b.URL, "URL for linux binary")
			t.Logf("found linux binary URL %s", b.URL)
		} else if b.Goos == "Windows" && b.Goarch == "amd64" {
			foundWindows = true
			assert.Equal(t, "https://github.com/vmware-tanzu/octant/releases/download/v0.16.1/octant_0.16.1_Windows-64bit.zip", b.URL, "URL for windows binary")
			t.Logf("found windows binary URL %s", b.URL)
		} else if b.Goos == "Darwin" {
			foundWindows = true
			assert.Equal(t, "https://github.com/vmware-tanzu/octant/releases/download/v0.16.1/octant_0.16.1_macOS-64bit.tar.gz", b.URL, "URL for macOs binary")
			t.Logf("found Darwin binary URL %s", b.URL)
		}
	}
	assert.True(t, foundLinux, "did not find a linux binary in the plugin %#v", plugin)
	assert.True(t, foundWindows, "did not find a windows binary in the plugin %#v", plugin)
}

func TestOctantJXPlugin(t *testing.T) {
	t.Parallel()

	plugin := plugins.CreateOctantJXPlugin("0.0.31")

	assert.Equal(t, plugins.OctantJXPluginName, plugin.Name, "plugin.Name")
	assert.Equal(t, plugins.OctantJXPluginName, plugin.Spec.Name, "plugin.Spec.Name")

	foundLinux := false
	foundWindows := false
	for _, b := range plugin.Spec.Binaries {
		if b.Goos == "Linux" && b.Goarch == "amd64" {
			foundLinux = true
			assert.Equal(t, "https://github.com/jenkins-x-plugins/octant-jx/releases/download/v0.0.31/octant-jx-linux-amd64.tar.gz", b.URL, "URL for linux binary")
			t.Logf("found linux binary URL %s", b.URL)
		} else if b.Goos == "Windows" && b.Goarch == "amd64" {
			foundWindows = true
			assert.Equal(t, "https://github.com/jenkins-x-plugins/octant-jx/releases/download/v0.0.31/octant-jx-windows-amd64.zip", b.URL, "URL for windows binary")
			t.Logf("found windows binary URL %s", b.URL)
		}
	}
	assert.True(t, foundLinux, "did not find a linux binary in the plugin %#v", plugin)
	assert.True(t, foundWindows, "did not find a windows binary in the plugin %#v", plugin)
}
070701000000A5000081A4000000000000000000000001683E350C00000A5A000000000000000000000000000000000000002E00000000jenkins-x-cli-3.11.92/pkg/plugins/versions.gopackage plugins

import (
	jenkinsv1 "github.com/jenkins-x/jx-api/v4/pkg/apis/jenkins.io/v1"
	"github.com/jenkins-x/jx-helpers/v3/pkg/extensions"
)

const (
	// AdminVersion the version of the jx admin plugin
	AdminVersion = "0.3.18"

	// ApplicationVersion the version of the jx application plugin
	ApplicationVersion = "0.3.8"

	// ChangelogVersion the version of the jx changelog plugin
	ChangelogVersion = "0.10.14"

	// GitOpsVersion the version of the jx gitops plugin
	GitOpsVersion = "1.0.0"

	// HealthVersion the version of the jx health plugin
	HealthVersion = "0.0.80"

	// OctantVersion the default version of octant to use
	OctantVersion = "0.23.0"

	// OctantJXVersion the default version of octant-jx plugin to use
	OctantJXVersion = "0.0.44"

	// PipelineVersion the version of the jx pipeline plugin
	PipelineVersion = "0.7.21"

	// PreviewVersion the version of the jx preview plugin
	PreviewVersion = "0.5.8"

	// ProjectVersion the version of the jx project plugin
	ProjectVersion = "0.2.75"

	// PromoteVersion the version of the jx promote plugin
	PromoteVersion = "0.6.22"

	// SecretVersion the version of the jx secret plugin
	SecretVersion = "0.4.14"

	// TestVersion the version of the jx test plugin
	TestVersion = "0.4.9"

	// VerifyVersion the version of the jx verify plugin
	VerifyVersion = "0.3.12"
)

var (
	// Plugins default plugins
	Plugins = []jenkinsv1.Plugin{
		extensions.CreateJXPlugin(jenkinsxPluginsOrganisation, "admin", AdminVersion),
		extensions.CreateJXPlugin(jenkinsxPluginsOrganisation, "application", ApplicationVersion),
		extensions.CreateJXPlugin(jenkinsxPluginsOrganisation, "changelog", ChangelogVersion),
		extensions.CreateJXPlugin(jenkinsxPluginsOrganisation, "gitops", GitOpsVersion),
		extensions.CreateJXPlugin(jenkinsxPluginsOrganisation, "health", HealthVersion),
		extensions.CreateJXPlugin(jenkinsxPluginsOrganisation, "pipeline", PipelineVersion),
		extensions.CreateJXPlugin(jenkinsxPluginsOrganisation, "preview", PreviewVersion),
		extensions.CreateJXPlugin(jenkinsxPluginsOrganisation, "project", ProjectVersion),
		extensions.CreateJXPlugin(jenkinsxPluginsOrganisation, "promote", PromoteVersion),
		extensions.CreateJXPlugin(jenkinsxPluginsOrganisation, "secret", SecretVersion),
		extensions.CreateJXPlugin(jenkinsxPluginsOrganisation, "test", TestVersion),
		extensions.CreateJXPlugin(jenkinsxPluginsOrganisation, "verify", VerifyVersion),
	}

	// PluginMap a map of plugin names like `jx-gitops` to the Plugin object
	PluginMap = map[string]*jenkinsv1.Plugin{}
)

func init() {
	for i := range Plugins {
		plugin := &Plugins[i]
		PluginMap[plugin.Spec.Name] = plugin
	}
}
070701000000A6000041ED000000000000000000000002683E350C00000000000000000000000000000000000000000000002200000000jenkins-x-cli-3.11.92/pkg/version070701000000A7000081A4000000000000000000000001683E350C00000D5E000000000000000000000000000000000000002A00000000jenkins-x-cli-3.11.92/pkg/version/info.go// Copyright 2015 The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package version

import (
	"fmt"
	"strings"

	"github.com/blang/semver"
	"github.com/jenkins-x/jx-logging/v3/pkg/log"
)

// Build information. Populated at build-time.
var (
	Version      string
	Revision     string
	BuildDate    string
	GoVersion    string
	GitTreeState string
)

// Map provides the iterable version information.
var Map = map[string]string{
	"version":      Version,
	"revision":     Revision,
	"buildDate":    BuildDate,
	"goVersion":    GoVersion,
	"gitTreeState": GitTreeState,
}

const (
	// VersionPrefix string for setting pre-release etc
	VersionPrefix = ""

	// ExampleVersion shows an example version in the help
	// if no version could be found (which should never really happen!)
	ExampleVersion = "1.1.59"

	// TestVersion used in test cases for the current version if no
	// version can be found - such as if the version property is not properly
	// included in the go test flags.
	TestVersion = "3.2.238"

	// TestRevision can be used in tests if no revision is passed in the test flags
	TestRevision = "04b628f48"

	// TestTreeState can be used in tests if no tree state is passed in the test flags
	TestTreeState = "clean"

	// TestBuildDate can be used in tests if no build date is passed in the test flags
	TestBuildDate = "2020-05-31T14:51:38Z"

	// TestGoVersion can be used in tests if no version is passed in the test flags
	TestGoVersion = "1.13.8"
)

// GetVersion gets the current version string
func GetVersion() string {
	v := Map["version"]
	if v == "" {
		v = TestVersion
	}
	return v
}

// GetSemverVersion returns a semver.Version struct representing the current version
func GetSemverVersion() (semver.Version, error) {
	text := strings.TrimPrefix(GetVersion(), VersionPrefix)
	v, err := semver.Make(text)
	if err != nil {
		return v, fmt.Errorf("failed to parse version %s: %w", text, err)
	}
	return v, nil
}

// GetRevision returns the short SHA1 hashes given a given revision
func GetRevision() string {
	v := Map["revision"]
	if v == "" {
		v = TestRevision
	}
	return v
}

// GetTreeState returns the state of the working tree
func GetTreeState() string {
	v := Map["gitTreeState"]
	if v == "" {
		v = TestTreeState
	}
	return v
}

// GetBuildDate returns the build date for the binary
func GetBuildDate() string {
	v := Map["buildDate"]
	if v == "" {
		v = TestBuildDate
	}
	return v
}

// GetGoVersion returns the version of go used to build the binary
func GetGoVersion() string {
	v := Map["goVersion"]
	if v == "" {
		v = TestGoVersion
	}
	return v
}

// StringDefault returns the current version string or returns a dummy
// default value if there is an error
func StringDefault(defaultValue string) string {
	v, err := GetSemverVersion()
	if err == nil {
		return v.String()
	}
	log.Logger().Warnf("Warning failed to load version: %s", err)
	return defaultValue
}
070701000000A8000081A4000000000000000000000001683E350C00000A71000000000000000000000000000000000000002F00000000jenkins-x-cli-3.11.92/pkg/version/info_test.go//go:build unit

package version_test

import (
	"testing"

	"github.com/jenkins-x/jx/pkg/version"

	"github.com/blang/semver"
	"github.com/stretchr/testify/assert"
)

var InputNonEmpty = map[string]string{
	"version":      "2.2.2",
	"revision":     "abcdef",
	"buildDate":    "20200526-19:28:09",
	"goVersion":    "1.14.8",
	"gitTreeState": "dirty",
}

var OutputNonEmpty = InputNonEmpty

var InputEmpty = map[string]string{
	"version":      "",
	"revision":     "",
	"buildDate":    "",
	"goVersion":    "",
	"gitTreeState": "",
}

var OutputEmpty = map[string]string{
	"version":      version.TestVersion,
	"revision":     version.TestRevision,
	"buildDate":    version.TestBuildDate,
	"goVersion":    version.TestGoVersion,
	"gitTreeState": version.TestTreeState,
}

var getterTests = []struct {
	description string
	in          map[string]string
	out         map[string]string
}{
	{
		"Case 1: build passes a value",
		InputNonEmpty,
		OutputNonEmpty,
	},
	{
		"Case 2: No value passed during build",
		InputEmpty,
		OutputEmpty,
	},
}

func TestGetters(t *testing.T) {
	for _, tt := range getterTests {
		t.Run(tt.description, func(t *testing.T) {
			version.Map["version"] = tt.in["version"]
			version.Map["revision"] = tt.in["revision"]
			version.Map["buildDate"] = tt.in["buildDate"]
			version.Map["goVersion"] = tt.in["goVersion"]
			version.Map["gitTreeState"] = tt.in["gitTreeState"]

			result := version.GetVersion()
			assert.Equal(t, tt.out["version"], result)

			result = version.GetRevision()
			assert.Equal(t, tt.out["revision"], result)

			result = version.GetBuildDate()
			assert.Equal(t, tt.out["buildDate"], result)

			result = version.GetGoVersion()
			assert.Equal(t, tt.out["goVersion"], result)

			result = version.GetTreeState()
			assert.Equal(t, tt.out["gitTreeState"], result)
		})
	}
}

// TODO refactor to encapsulate
func TestGetSemverVersisonWithStandardVersion(t *testing.T) {
	version.Map["version"] = "1.2.1"
	result, err := version.GetSemverVersion()
	expectedResult := semver.Version{Major: 1, Minor: 2, Patch: 1}
	assert.NoError(t, err, "GetSemverVersion should exit without failure")
	assert.Exactly(t, expectedResult, result)
}

// TODO refactor to encapsulate
func TestGetSemverVersisonWithNonStandardVersion(t *testing.T) {
	version.Map["version"] = "1.3.153-dev+7a8285f4"
	result, err := version.GetSemverVersion()

	prVersions := []semver.PRVersion{{VersionStr: "dev"}}
	builds := []string{"7a8285f4"}
	expectedResult := semver.Version{Major: 1, Minor: 3, Patch: 153, Pre: prVersions, Build: builds}
	assert.NoError(t, err, "GetSemverVersion should exit without failure")
	assert.Exactly(t, expectedResult, result)
}
070701000000A9000081A4000000000000000000000001683E350C0000161F000000000000000000000000000000000000001D00000000jenkins-x-cli-3.11.92/run.sh#!/bin/bash -e
##
## TODO - When the $TFO_RESOURCE approaches 253 characters, this script should
##        truncate accordingly to make sure that any secrets/configmaps that
##        get saved here don't get blocked by the K8S API due to names being
##        too long.
##
# Let the finalizer or manual destroy by passing in $DESTROY="true"
# Terraforms will be applyed only then $APPLY="true"
function run_terraform {
    # options:
    #   destroy=true|false
    declare $@

    if [ "$destroy" = "true" ];then
        destroy_when_true='-destroy'
    fi

    terraform -chdir=. init
    if [ $? -gt 0 ];then return 1;fi

    terraform -chdir=. plan $TFOPS_VARFILE_FLAG $destroy_when_true -out plan.out 2>&1| tee $TMP
    if [ ${PIPESTATUS[0]} -gt 0 ];then
        set +x
        save_plan
        set -x
        return 1
    else
        set +x
        save_plan
        set -x
    fi
    set +x

    n=0
    while true;do
        (( n++ ))
        get_action # sets $action variable
        if [ "$action" = "apply" ];then
            break
        elif [ "$action" = "abort" ];then
            exit 0
        fi
        if [ $n -gt 60 ];then
            echo "Waiting for user action. Check the cm/${TFO_RESOURCE}-action"
            n=0
        fi
        sleep 1
    done

    set -x
    terraform apply plan.out
    if [ $? -gt 0 ];then return 1;fi

    set +x
    # Replan to see what tf thinks should happen next.
    terraform -chdir=. plan $TFOPS_VARFILE_FLAG $destroy_when_true 2>&1| tee $TMP
}

function save_plan {
    # Clean the output from coloration
    cat $TMP | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[mGK]//g" > $CLEAN

    # Save the intermediate plan
    cp $CLEAN tfplan
    kubectl delete cm ${TFO_RESOURCE}-plan > /dev/null 2>&1 || true
    kubectl create cm ${TFO_RESOURCE}-plan --from-file tfplan
}

function save_output {
    # Save terraform output as a configmap
    # TODO sensative items should be stored as a secret
    cat << EOF > "$TFO_RESOURCE-output.yaml"
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: $TFO_RESOURCE-output
  namespace: $NAMESPACE
data:
$(terraform output -json| jq -r '.|keys[] as $k| "  \($k): |-\n    \(.[$k].value)"')
EOF

    kubectl apply -f "$TFO_RESOURCE-output.yaml"

}

function get_action {
    action=`kubectl get cm ${TFO_RESOURCE}-action -ojsonpath='{.data.action}'`
    export action
}

if [ "${AWS_WEB_IDENTITY_TOKEN_FILE}" != "" ] ;then
    apk add --update-cache \
        python \
        python-dev \
        py-pip \
        build-base \
        && pip install boto3
    cat << EOF_HERE > .get_assumed_credentials.py
#!/usr/bin/python
import os
import boto3
session = boto3.Session()
credentials = session.get_credentials().get_frozen_credentials()
print('export AWS_ACCESS_KEY_ID="{0}"\nexport AWS_SECRET_ACCESS_KEY="{1}"\nexport AWS_SECURITY_TOKEN="{2}"\nexport AWS_SESSION_TOKEN="{2}"'.format(credentials.access_key, credentials.secret_key, credentials.token))
EOF_HERE

    chmod +x .get_assumed_credentials.py
    eval `./.get_assumed_credentials.py`
    rm .get_assumed_credentials.py

    unset AWS_ROLE_ARN
    unset AWS_WEB_IDENTITY_TOKEN_FILE
fi

if [ "$GIT_PASSWORD" != "" ];then
    echo setting git password
    ASKPASS=`mktemp`
    cat << EOF > $ASKPASS
#!/bin/sh
exec echo "$GIT_PASSWORD"
EOF
    chmod +x $ASKPASS
    export GIT_ASKPASS=$ASKPASS
fi

# Troubleshooting lines
# env
# ls -lah ~/.ssh

#
# Assume the default is to use git to pull tf files and
# Assume the tfvars lives at "tfvars" in root of untar-ed dir
export TMP=`mktemp`
export CLEAN=`mktemp`
REPO_COUNT=`find /tfops -type f  -not -path /tfops -name repo.tar|wc -l`


if [ "$STACK_REPO" != "" ];then
    set -x
    MAIN_MODULE_TMP=`mktemp -d`
    git clone $STACK_REPO $MAIN_MODULE_TMP/stack || exit $?
    cd $MAIN_MODULE_TMP/stack
    git checkout $STACK_REPO_HASH
    if [ "$STACK_REPO_SUBDIR" != "" ];then
        pwd
        ls -lah
        cp -r $STACK_REPO_SUBDIR /$TFOPS_MAIN_MODULE
    else
        mv $MAIN_MODULE_TMP/stack /$TFOPS_MAIN_MODULE
    fi
elif [ "$REPO_COUNT" -gt 0 ];then
        find /tfops -type f  -not -path /tfops -name repo.tar -exec tar -xf {} -C / \;
else
    echo "No terraform stack to run"
    exit 1
fi

if [ "$TFOPS_CONFIGMAP_PATH" != "" ];then
    cp $TFOPS_CONFIGMAP_PATH/* /$TFOPS_MAIN_MODULE
fi

cd /$TFOPS_MAIN_MODULE

# Load a custom backend
if stat backend_override.tf >/dev/null 2>/dev/null; then
    echo "Using custom backend"
else
    echo "Loading hashicorp backend"
    set -x
    envsubst < /backend.tf > /backend_override.tf
    mv /backend_override.tf .
fi

# Run the prerun script
if stat prerun.sh >/dev/null 2>/dev/null; then
    # prerun.sh needs exec privileges
    chmod +x prerun.sh
    ./prerun.sh
fi


WAIT_TIME=${WAIT_TIME:-60}
ATTEMPTS=${ATTEMPTS:-10}
i=0
until run_terraform destroy=$DESTROY || (( i++ >= $ATTEMPTS ));do
    echo "($i/$ATTEMPTS) Terraform did not exit 0, waiting $WAIT_TIME"
    sleep $WAIT_TIME
done

# Clean the output from coloration
cat $TMP | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[mGK]//g" > $CLEAN

# Status Helpers:
awk '/^Error:/{y=1}y' $CLEAN > ERROR

read -d '' -r -a arr <<< `grep "^Plan:" $CLEAN|tr -dc '0-9,'|tr ',' ' '` #`
echo -n ${arr[0]} > PLAN
echo -n ${arr[1]} > CHANGE
echo -n ${arr[2]} > DESTROY

kubectl delete cm ${TFO_RESOURCE}-status > /dev/null 2>&1 || true
kubectl create cm ${TFO_RESOURCE}-status \
    --from-file ERROR \
    --from-file PLAN \
    --from-file CHANGE \
    --from-file DESTROY

save_output
save_plan

# Run the postrun script
if stat postrun.sh >/dev/null 2>/dev/null; then
    # postrun.sh needs exec privileges 
    chmod +x postrun.sh
    ./postrun.sh
fi07070100000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000B00000000TRAILER!!!539 blocks
openSUSE Build Service is sponsored by