N
N
Nikolay Baranenko2021-08-13 14:52:24
Jenkins
Nikolay Baranenko, 2021-08-13 14:52:24

How to properly load yaml list in env?

Hello.

to have values ​​from env.yml

project_name: adv
project_version: 1.4.1


got into the environment pipeline doing such a download

stage("import common_vars") {
                            def cicd_store.common_envs = readYaml file: 'vault/common-envs/envs.yml'
                            cicd_store.common_envs.eachWithIndex { item,index ->
                                env."${item.key}" = "${item.value}"
                            }
                    }


eventually

[Pipeline] sh (hide)
+ printenv
project_name: adv
project_version: 1.4.1


now I thought that it would be great if we could organize storage in env.yml in a different way:

project:
  name: adv
  version: 1.4.1


the same method leads to a different result

project=[name:adv, version:1.4.1]

How do I properly parse a new structure in jenkins (preferably inline functions)
to get the result?

project.name=adv
project.version=1.4.1


or go even

name=adv
version=1.4.1

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question