Installing the Operator

Installing the Git Operator to install/upgrade Jenkins X

Jenkins X 3.x uses a git operator to manage installing + upgrading of Jenkins X and any other components in any environment. If you are interested you can read how it works.

Using Terraform

NOTE if you are using one of the public clouds to install Jenkins X then Terraform will install the git operator for you so that there is no need for you to do so manually.

So the following approaches automatically install the operator for you:

Git user and token

To install the git operator you will need a pipeline user and token for the git repository.

This user and token needs read and write access to the git repository containing the installation configuration. Ideally the token will also have permissions to be able to create a webhook on the repository (to trigger CI/CD pipelines whenever someone creates a Pull Request on the git repository).

You can always setup webhooks by hand yourself whenever a git repository is created or imported or the domain name of your lighthouse hook endpoint changes via the jx verify webhooks command. Though its easier to get Jenkins X to automate this for you as part of the CI/CD pipelines; it just requires the git user and token to have sufficient permissions to list, create and modify webhooks.

Note also that the same pipeline user and token is reused by default for all pipelines on all repositories created or imported which will need read, write and webhook permissions on all of those repositories too. Though if you really want you can change this later on by editing the pipeline token.

Create a git token

To create a git token for passing into the operator use this button:

Create new GitHub Token

Installing the operator

Run jx admin operator command inside the git clone of the git repository you created previously:

jx admin operator --username mygituser --token mygittoken

If you don’t specify the username or token parameters you will be prompted for them.

If you are not inside the git clone of the git repository you will need to specify the --url parameter for the git URL:

jx admin operator --url=https://github.com/myorg/env-mycluster-dev.git --username mygituser --token mygittoken

This command will use helm to install the git operator which will trigger a Job to install Jenkins X (and re-trigger a Job whenever you commit to your git repository).

The terminal will display the logs as the boot Job runs.

Jenkins X will now install itself.

Viewing the logs

At any time you can tail the boot job logs via the jx admin log command:

jx admin log

If you know you have just done a git commit and are waiting for the boot job to start you can run:

jx admin log --wait

Which will wait for a running Job to display.

Insecure git repositories

If you are using an on premise git repository you may need to configure git in the git operator and boot job to support insecure git repositories via a git config command or two.

When installing the git operator you can pass in any git configuration commands via the --setup argument. You can supply multiple of these arguments if you need them.

e.g.

export GIT_USERNAME=someone
export GIT_TOKEN=mytoken      

git clone https://github.com/myorg/env-mycluster-dev.git
cd env-mycluster-dev.git

jx admin operator --setup "git config --global http.sslverify false"

Last modified November 24, 2020: fix: add insecure git repository docs (668e0fb330)