Skip to content

Migrate CI Pipelines From Jenkins to Tektonβš“οΈŽ

To migrate the CI pipelines for a codebase from Jenkins to Tekton, follow the steps below:

Deploy a Custom EDP Scenario With Tekton and Jenkins CI Toolsβš“οΈŽ

Make sure that Tekton stack is deployed according to the documentation. Enable Tekton as an EDP subcomponent:

values.yaml
edp-tekton:
  enabled: true

Disable Jenkins Triggersβš“οΈŽ

To disable Jenkins Triggers for the codebase, add the following code to the provisioner:

job-provisioner
def tektonCodebaseList = ["<codebase_name>"]
if (!tektonCodebaseList.contains(codebaseName.toString())){
    triggers {
        gerrit {
            events {
                if (pipelineName.contains("Build"))
                    changeMerged()
                else
                    patchsetCreated()
            }
            project("plain:${codebaseName}", ["plain:${watchBranch}"])
        }
    }
}

Note

The sample above shows the usage of Gerrit VCS where the <codebase_name> value is your codebase name.

  • If using GitHub or GitLab, additionally remove the webhook from the relevant repository.
  • If webhooks generation for new codebase(s) is not required, correct the code above so that it creates a webhook in the job-provisioner.
  • To recreate the pipeline in Jenkins, trigger the job-provisioner.
  • Check that the new pipeline is created without triggering Gerrit events.

Manage Tekton Triggers the Codebase(s)βš“οΈŽ

By default, each Gerrit project inherits configuration from the All-Projects repository.

To exclude triggering in Jenkins and Tekton CI tools simultaneously, edit the configuration in the All-Projects repository or in the project which inherits rights from your project.

Edit the webhooks.config file in the refs/meta/config and remove all context from this configuration.

Warning

The clearance of the webhooks.config file will disable the pipeline trigger in Tekton.

To use Tekton pipelines, add the configuration to the corresponding Gerrit project (webhooks.config file in the refs/meta/config):

webhooks.config
[remote "changemerged"]
  url = http://el-gerrit-listener:8080
  event = change-merged
[remote "patchsetcreated"]
  url = http://el-gerrit-listener:8080
  event = patchset-created
[remote "commentadded"]
  url = http://el-gerrit-listener:8080
  event = comment-added

Configure webhooks plugin in Gerrit configuration (typically located at /var/gerrit/review_site/etc/gerrit.config):

gerrit.config
[plugin "webhooks"]
        connectionTimeout = 3000
        socketTimeout = 2500
        maxTries = 1
        retryInterval = 5000
        threadPoolSize = 3

Switch CI Tool for Codebase(s)βš“οΈŽ

Go to the codebase Custom Resource and change the spec.ciTool field from jenkins to tekton.