同步操作将从 Gitee 极速下载/Jenkins-x 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
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.
To compile and test jx binaries you will need:
In most cases, install the prerequisite according to its instructions. See the next section for a note about Go cross-compiling support.
The jx's binary eCLI is built on your machine in your GO Path.
On macOS, Go can be installed with Homebrew:
$ brew install go
It is also straightforward to build Go from source:
$ sudo su
$ curl -sSL https://storage.googleapis.com/golang/go1.7.5.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
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
.
$ 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:
$ git remote add upstream https://github.com/jenkins-x/jx.git
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:
$ make build # runs glide and builds `jx` inside the build/
There's a handy script to output nice syntax highlighted output of test results via:
./test.sh
Or you can use make
make test
Lots of the test have debug output to try figure out when things fail. You can enable verbose debug logging for tests via
export JX_TEST_DEBUG=true
First you need to install Delve
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
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:
pid
of the jx command via something like ps -elaf | grep jx
dlv --listen=:2345 --headless=true --api-version=2 attach SomePID
If you create a bash file called jxDebug
as the following (replacing SomePid
with the actual pid
):
#!/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!
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。