Right now jenkins x works 'out the box' on a few major cloud hosting providers including aws and Google, Digital ocean is a work in progress. This blog uses a Google hosted k8s cluster.
Install jx cli
jx CLI tool basically connects to your existing k8s cluster, giving you ability to interact with the jenkinsx only parts of the system. If you need to dig deeper, you can still use
kubectl of course.
Get the jx binary
(Linux) - see source above for other os's
curl -L "https://github.com/jenkins-x/jx/releases/download/$(curl --silent "https://github.com/jenkins-x/jx/releases/latest" | sed 's#.*tag/\(.*\)\".*#\1#')/jx-linux-amd64.tar.gz" | tar xzv "jx"
Install the jx binary to a well-known path
sudo mv jx /usr/local/bin
Check it's installed OK:
Will output information
jx can find about your cluster. It will default to whatever context is your current context (see
kubectl config get-contexts to see your current context and
kubectl config use-context).
Gotcha's that tripped me up
The current cli install process (v2.0.413) does not install
kanikoby default (even though its needed doing
jx install --kanikoafter install may resolve this). The full error is:
unexpected response from pipeline runner service: 400 Bad Request, ... effective project configuration: Missing option: --docker-registry. After doing that , you have to re-import your repo..otherwise serverless jenkins githook no longer fires
If you want a 'git bot' to show as the bot, first log out of your github account
- Create another 'bot' account and add this bot account to the github Organisation which you want your bot to work on (I say organisation becayse jx will need permission to create additional repos in that organisation
If you started this process already, and broke things:
jx uninstallto start over and
jx get contextto get the context name.
- Delete the cluster in gke (or aws) which jx created for you
- Delete your
rm -rf ~/.jx) becayse otherwise jx install will ignore your github bot user selection (https://github.com/jenkins-x/jx/issues/1471 - closed issue, but not fixed yet)
- Remove the repo's jx created in your organisation's repo and start over
- The beauty of this the install of jx is declarative, so removing and starting again is not very painful
- If you've previously tried to import your repo, jenkins x may have created a helm
chartsdirectory, and you'll see the error
./charts/preview: file exists, remove this direcrory and the try
jx importagain (this is harmless, probably, because the exact same folder will be created by the install scrip and any git push that jenkins x does will result in no change to the repo).
For me, the process was:
jx create cluster gke # The install process at time of writing is non interactive for most for the first ~6 steps (this is the cause of the kaniko / --docker flag missing error) and why jx install --kaniko is needed after install # - use nip.io to begin with rather than fafing around with domains whilst getting started # Before doing github, remember to log out of your personal git account and login as your bot user. Otherwise you'll end up setting up the bot under your github account instead of a bot account, which looks confusing/lame # - specify your github bot username (a github bot is just another user account, there is nothing special about them) # Grant your bot account access via the token (follow url that jx install process gives you. # Import your repo # First, clone your repo into /tmp # go into your local repo # jx import # enter your bot username / password # complete!
Good to know
If your install messes up, and your
serverless-jenkins bot failes, you can comment with
/retest after fixing and this will trigger another attempt.
Subscribe to Karma Computing
Get the latest posts delivered right to your inbox