Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-63373

writeYaml should support writing a list as multiple documents

    XMLWordPrintable

Details

    Description

      It's unclear how a List passed to writeYaml should be written: as a single sequence document or as multiple documents: one per element in the list. writeYaml always creates a single document, but I need it to write multiple documents instead.

       

      I propose that an optional field be added to writeYaml so that List data can be serialized as single or multiple documents. Maybe something like writeMultipleDocuments or serializeMultipleDocuments or serializeListDataAsMultipleDocuments.

       

      The implementation should be trivial: simply call dumpAll on step.getData().iterator() instead of dump when the new option is set.

      Attachments

        Activity

          ianusesjenkins Ian Anderson added a comment - - edited

          In other words, I need this.

          key: value
          ---
          key: value

           

          But instead I get this

          - key: value
          - key: value

           

          ianusesjenkins Ian Anderson added a comment - - edited In other words, I need this. key: value --- key: value   But instead I get this - key: value - key: value  
          ianusesjenkins Ian Anderson added a comment -

          Took a first attempt at <https://github.com/jenkinsci/pipeline-utility-steps-plugin/pull/83>. Instead of a boolean parameter that makes assumptions about data, I added a datas parameter as an alternative.

          ianusesjenkins Ian Anderson added a comment - Took a first attempt at < https://github.com/jenkinsci/pipeline-utility-steps-plugin/pull/83 >. Instead of a boolean parameter that makes assumptions about data , I added a datas parameter as an alternative.

          It looks like this was released in Pipeline Utility Steps Plugin 2.7.0.

          kon Kalle Niemitalo added a comment - It looks like this was released in Pipeline Utility Steps Plugin 2.7.0 .

          People

            rsandell rsandell
            ianusesjenkins Ian Anderson
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: