Elasticsearch

The Elasticsearch driver supports reporters only. The purpose of the driver is to export build and buildset results to an Elasticsearch index.

If the index does not exist in Elasticsearch then the driver will create it with an appropriate mapping for static fields.

The driver can add job’s variables and any data returned to Zuul via zuul_return respectively into the job_vars and job_returned_vars fields of the exported build doc. Elasticsearch will apply a dynamic data type detection for those fields.

Elasticsearch supports a number of different datatypes for the fields in a document. Please refer to its documentation.

The Elasticsearch reporter uses new ES client, that is only supporting current version of Elastisearch. In that case the reporter has been tested on ES cluster version 7. Lower version may be working, but we can not give tu any guarantee of that.

Connection Configuration

The connection options for the Elasticsearch driver are:

<Elasticsearch connection>
<Elasticsearch connection>.driver (required)
elasticsearch

The connection must set driver=elasticsearch.

<Elasticsearch connection>.uri (required)

Database connection information in the form of a comma separated list of host:port. The information can also include protocol (http/https) or username and password required to authenticate to the Elasticsearch.

Example:

uri=elasticsearch1.domain:9200,elasticsearch2.domain:9200

or

uri=https://user:password@elasticsearch:9200

where user and password is optional.

<Elasticsearch connection>.use_ssl
Default: true

Turn on SSL. This option is not required, if you set https in uri param.

<Elasticsearch connection>.verify_certs
Default: true

Make sure we verify SSL certificates.

<Elasticsearch connection>.ca_certs
Default: ''

Path to CA certs on disk.

<Elasticsearch connection>.client_cert
Default: ''

Path to the PEM formatted SSL client certificate.

<Elasticsearch connection>.client_key
Default: ''

Path to the PEM formatted SSL client key.

Example of driver configuration:

[connection elasticsearch]
driver=elasticsearch
uri=https://managesf.sftests.com:9200

Additional parameters to authenticate to the Elasticsearch server you can find in client class.

Reporter Configuration

This reporter is used to store build results in an Elasticsearch index.

The Elasticsearch reporter does nothing on pipeline.start or pipeline.merge-failure; it only acts on pipeline.success or pipeline.failure reporting stages.

pipeline.<reporter>.<elasticsearch source>

The reporter supports the following attributes:

pipeline.<reporter>.<elasticsearch source>.index
Default: zuul

The Elasticsearch index to be used to index the data. To prevent any name collisions between Zuul tenants, the tenant name is used as index name prefix. The real index name will be:

<index-name>.<tenant-name>-<YYYY>.<MM>.<DD>

The index will be created if it does not exist.

pipeline.<reporter>.<elasticsearch source>.index-vars
Default: false

Boolean value that determines if the reporter should add job’s vars to the exported build doc. NOTE: The index-vars is not including the secrets.

pipeline.<reporter>.<elasticsearch source>.index-returned-vars
Default: false

Boolean value that determines if the reporter should add zuul_returned vars to the exported build doc.

For example:

- pipeline:
    name: check
    success:
      elasticsearch:
        index: 'zuul-index'