Skip to content

Be able to use and store complex data exportable to json or yaml format #225

@clarsonneur

Description

@clarsonneur

forjj within Forjfiles and forjj secrets uses a collection of key/value pair and are expanded or used in forjj plugins to generate and deploy services (update/maintain).

Currently forjj works with strings only on the value part of key/value pairs.

In short, in key=value, value is a string only.

In some cases, that string itself can be a json or a yaml format depending of plugin need.
But forjj itself, still consider this data as a raw string and is not interpreted/managed/controlled by forjj.
So, we can introduce a mistake that will break the flow, because the expected string have to be a valid structure which could be extracted as json or yaml string or just extracted piece by piece where needed.

Ex:

key:
  key1: value
  key2: 
    - element1
    - element2

Could be extracted by with go template with such syntax in forjj-jenkins plugin:
{{ .Source.Key | to_json }}

{"key1": "value1", "key2": ["element1", "element2"]}

or
{{ .Source.Key | to_yaml }}

key:
  key1: value
  key2: 
    - element1
    - element2

or
{{ index .Source.Key "key1" }}

values1

We have several other use case, like:

  • Validating the structure.
  • manage one piece of the structure and not all.
  • extract all as an encoded string in json or yaml, or just a single data.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions