flowbber.plugins.sources.env

Env

This source collects environment variables.

Danger

This source can leak sensitive data. Please adjust include and exclude patterns accordingly.

By default include and exclude patterns are empty, so no data will be collected. See Usage below for examples.

Data collected:

{
    "pythonhashseed": "720667772"
}

Dependencies:

pip3 install flowbber[env]

Usage:

Variables will be collected if the name of the variable match any item in the include list but DOES NOT match any item in the exclude list.

Variables names will be stored in lowercase if the lowercase option is set to true (the default).

[[sources]]
type = "env"
id = "..."

    [sources.config]
    include = ["PYTHONHASHSEED"]
    exclude = []
    lowercase = true
{
    "sources": [
        {
            "type": "env",
            "id": "...",
            "config": {
                "include": [
                    "PYTHONHASHSEED"
                ],
                "exclude": [],
                "lowercase": true
            }
        }
    ]
}

Configuration examples:

Collect all environment variables

{
    "include": ["*"],
    "exclude": []
}

Collect all except a few

{
    "include": ["*"],
    "exclude": ["*KEY*", "*SECRET*"]
}

Collect only the ones specified

{
    "include": ["PYTHONHASHSEED"],
    "exclude": []
}

Using with Jenkins CI

This source is very helpful to collect information from Jenkins CI:

[[sources]]
type = "env"
id = "jenkins"

    [sources.config]
    include = [
        "BUILD_NUMBER",
        "JOB_NAME",
        "GIT_COMMIT",
        "GIT_URL",
        "GIT_BRANCH",
        "BUILD_TIMESTAMP"
    ]
    lowercase = false
{
    "sources": [
        {
            "type": "env",
            "id": "jenkins",
            "config": {
                "include": [
                    "BUILD_NUMBER",
                    "JOB_NAME",
                    "GIT_COMMIT",
                    "GIT_URL",
                    "GIT_BRANCH",
                    "BUILD_TIMESTAMP"
                ],
                "lowercase": false
            }
        }
    ]
}

Note

In the above example the BUILD_TIMESTAMP variable is provided by the Build Timestamp Plugin.

include

List of patterns of environment variables to include.

Matching is performed using Python’s fnmatch.

  • Default: []

  • Optional: True

  • Schema:

    {
        'type': 'list',
        'schema': {
            'type': 'string',
            'empty': False,
        },
    }
    
  • Secret: False

exclude

List of patterns of environment variables to exclude.

Matching is performed using Python’s fnmatch.

  • Default: []

  • Optional: True

  • Schema:

    {
        'type': 'list',
        'schema': {
            'type': 'string',
            'empty': False,
        },
    }
    
  • Secret: False

lowercase

Store variables names in lowercase.

  • Default: True

  • Optional: True

  • Schema:

    {
        'type': 'boolean',
    }
    
  • Secret: False

Classes

  • EnvSource: Main base class to implement a Source.
class flowbber.plugins.sources.env.EnvSource(index, type_, id_, optional=False, timeout=None, config=None)

Inheritance

Inheritance diagram of EnvSource