Skip to main content
Version: 13.x (Current)

Create a project template integrated with Jenkins

After having created a project following our guide, you can include an xml file inside the template repo, describing how Jenkins should configure the build job. If you want to rely upon Jenkins as your CI/CD system, you need to do the following:

  • include the XML template of the Jenkins job that will build your service somewhere in the repo template (e.g. at path/to/xml/build/build-job.xml). Here you can find an example of this file.
  • in the services collection on MongoDB, the object correpsonding to your template must contain a pipelines.jenkins field structured as in the example below:
"_id" : ,
"name" : "template_name",
"archiveUrl" : "https://<GITLAB_URL>/api/v4/projects/<PROJECT_ID>/repository/archive.tar.gz",
"type" : "template",
"pipelines" : {
"jenkins" : {
"xmlTemplate" : {
"gitlabProjectId" : "<PROJECT_ID>",
"gitlabPath" : "path/to/xml/build/file",
"gitlabBranch" : "master"
"gitlabWebhookOptions" : {
"pushEvents" : true,
"tagPushEvents" : true

In this way, when you create a new project from this template, the relative build pipeline will be automatically created on Jenkins, and the corresponding webhook will be set on Gitlab.