Metadata

The Metadata plugin module enables the ability to add metadata to the projects that can be exposed to job environment.

Requires the Jenkins Metadata Plugin.

Component: metadata
Macro:

metadata

Entry Point:

jenkins_jobs.metadata

Example:

metadata:
  - string:
      name: FOO
      value: bar
      expose-to-env: true
class metadata.Metadata(registry)
component_list_type = 'metadata'

The component list type will be used to look up possible implementations of the component type via entry points (entry points provide a list of components, so it should be plural). Set both component_type and component_list_type to None if module doesn’t have components.

component_type = 'metadata'

The component type for components of this module. This will be used to look for macros (they are defined singularly, and should not be plural). Set both component_type and component_list_type to None if module doesn’t have components.

gen_xml(xml_parent, data)

Update the XML element tree based on YAML data. Override this method to add elements to the XML output. Create new Element objects and add them to the xml_parent. The YAML data structure must not be modified.

:arg class:xml.etree.ElementTree xml_parent: the parent XML element :arg dict data: the YAML data structure

sequence = 21

The sequence number for the module. Modules are invoked in the order of their sequence number in order to produce consistently ordered XML output.

date()

A date metadata

Parameters:
  • name (str) – the name of the metadata

  • time (str) – time value in millisec since 1970-01-01 00:00:00 UTC

  • timezone (str) – time zone of the metadata

  • expose-to-env (bool) – expose to environment (optional)

Example:

metadata:
  - date:
      name: FOO
      value: 1371708900268
      timezone: Australia/Melbourne
      expose-to-env: true
number()

A number metadata.

Parameters:
  • name (str) – the name of the metadata

  • value (str) – the value of the metadata

  • expose-to-env (bool) – expose to environment (optional)

Example:

metadata:
  - number:
      name: FOO
      value: 1
      expose-to-env: true
string()

A string metadata.

Parameters:
  • name (str) – the name of the metadata

  • value (str) – the value of the metadata

  • expose-to-env (bool) – expose to environment (optional)

Example:

metadata:
  - string:
      name: FOO
      value: bar
      expose-to-env: true