Upgrading CloudBees CI on modern cloud platforms

This guide describes the upgrade process for CloudBees CI on Kubernetes installations.

Helm is the preferred method of managing CloudBees CI on modern cloud platforms. CloudBees provides a Helm chart for CloudBees CI on modern cloud platforms, and recommends migrating existing installations to use the Helm chart.
The version of Operations Center must always be more recent or as old as the version of the Managed Masters that are connected to the Operations Center (Operations Center >= Managed Master version).

Upgrading using Helm

One of the most useful features of Helm is a streamlined upgrade and update process for your CloudBees CI installation.

The helm upgrade command allows you to upgrade your CloudBees CI release. This can be new setting, such as an updated OperationCenter.HostName value or a new version of CloudBees CI.

Helm Issue 2948 and NGINX Ingress controller support

If you are using the NGINX installation option, you MUST set the nginx-ingress.Enabled=true value or the NGINX Controller will be deleted. CloudBees strongly recommends you use a Custom Values file.

For more details around Helm Issue 2948, see Helm Issue 2948 on GitHub.

Using a custom values file to upgrade CloudBees CI

CloudBees recommends using a Custom Values File to upgrade CloudBees CI using Helm.

To upgrade your installation using a custom values file:

$ helm upgrade -f example-values.yaml --dry-run --debug cloudbees-core cloudbees/cloudbees-core -n cloudbees-core (1)
1 Run the helm upgrade command with the -f argument to use the examples-value.yaml file. Replace the examples-value.yaml filename with the name of your values file. Adding the --dry-run --debug runs a dry run of the installation without making changes.

The following example upgrade custom values file is based on examples in the cloudbees-examples GitHub repository.

# A helm example values file for standard Kubernetes install.
# An nginx-ingress controller is not installed and ssl isn't installed.
# Install an nginx-ingress controller
nginx-ingress:
  Enabled: false (1)

OperationsCenter:
  # Set the HostName for the Operation Center
  HostName: 'cloudbees-core.example.com' (2)
  Ingress:
    tls:
    ## Set this to true in order to enable TLS on the ingress record
      Enable: false (3)
      SecretName: core-example-com-tls
      Host: jenkins.cluster.local
1 If you want NGINX Ingress controller installed, change this value to true.
2 Replace cloudbees-core.example.com with your domain name.
3 If you want to enable TLS, set this value to true.

Upgrading on OpenShift using Helm

One of the most useful features of Helm is a streamlined upgrade and update process for your CloudBees CI installation.

The helm upgrade command allows you to upgrade your CloudBees CI release. This can be new setting, such as an updated OperationCenter.HostName value or a new version of CloudBees CI.

Using a custom values file to upgrade CloudBees CI

CloudBees recommends using a Custom Values File to upgrade CloudBees CI using Helm.

To upgrade your installation using a custom values file:

$ helm upgrade -f openshift-example-values.yaml --dry-run --debug (1) (2)
1 Run the helm upgrade command with the -f argument to use the openshift-examples-value.yaml file. Replace the openshift-examples-value.yaml filename with the name of your values file.
2 Adding the --dry-run --debug runs a dry run of the installation without making changes.

The following example upgrade custom values file is based on examples in the cloudbees-examples GitHub repository.

OperationsCenter:
  # Set the HostName for the Operation Center
  HostName: 'cloudbees-core.example.com' (1)
  Route:
    tls:
    ## Set this to true in order to enable TLS on the ingress record
      Enable: false (2)
      SecretName: core-example-com-tls
      Host: jenkins.cluster.local
  Project:
    Name: myproject (3)
1 Replace cloudbees-core.example.com with your domain name.
2 If you want to enable TLS, set this value to true.
3 OperationsCenter.Project.name is the OpenShift project.

Upgrading without Helm

Before you upgrade

  1. The CloudBees CI YAML has changed, because it is now generated from the CloudBees CI Helm Chart. Both the format and the order of the file have changed. If you intend to use the YAML file as your basis for the upgrade (instead of Helm), you must manually update the field values in cloudbees-core.yml to match the values in your previous installation.

  2. As a best practice, CloudBees recommends backing up your Operations Center and JENKINS_HOME prior to upgrading. For more information, see the Backup and Restore guide.

Performing the upgrade

If you previously attempted to upgrade CloudBees CI and got an error message reading The StatefulSet "cjoc" is invalid: spec: Forbidden: updates to statefulset spec for fields other than 'replicas', 'template', and 'updateStrategy' are forbidden, follow this upgrade process to resolve the issue.

To upgrade CloudBees CI:

  1. Download the installer from the Downloads site.

  2. In a local directory on your workstation, unpack the installer:

    $ tar xvf name-of-installer.tgz
  3. Modify the extracted cloudbees-core.yml to match the values of your previous installation. There are two options for this step:

    1. Use Helm to create a custom YAML file for your installation

    2. Manually edit cloudbees-core.yml values to match the values from the previous installation (IMPORTANT: the YAML file format has changed.

  4. Delete the cjoc statefulset (this does not remove the associated volume or data):

    $ kubectl delete sts cjoc
  5. Confirm that the CJOC statefulset has been deleted:

    $ kubectl get sts cjoc
    Error from server (NotFound): statefulsets.apps "cjoc" not found (1)
    1 This error confirms that the cjoc statefulset has been deleted.
  6. Run the installer:

    $ kubectl apply -f cloudbees-core.yml
  7. Check the status of the Operations Center roll-out:

    $ kubectl rollout status sts cjoc
  8. Once the new Operations Center version has been rolled out, log into Operations Center and upgrade your Managed Masters.