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

add returnText option to writeYaml

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      Currently the writeYaml step is only able to output the yaml to a file. However, sometimes we need the resulting yaml as a string in Groovy, such as when building a kubernetes pod spec. The only workaround is either to write to some temp file and then call readYaml, or to directly call into SnakeYaml, neither of which is ideal.

      I propose adding a boolean returnText parameter to writeYaml. If it is omitted or false, then writeYaml preserves its existing behavior. If it is true, then file and ovewrite must not be specified and writeYaml will return the yaml as a string.

      Example usage:

      String yaml = writeYaml data: object, returnText: true

       

        Attachments

          Activity

          Hide
          tsurankov tsurankov added a comment -

          Is there any progress on this feature? I have found this commit https://github.com/jenkinsci/pipeline-utility-steps-plugin/commit/3b266e0693188913f5e955a4a58f34b61c388fed 

          Looks like development is abandoned.

          Would be nice to have this possibility to load and save a YAML file back to text without writing to disc, which requires an executor or a node to run

          Show
          tsurankov tsurankov added a comment - Is there any progress on this feature? I have found this commit https://github.com/jenkinsci/pipeline-utility-steps-plugin/commit/3b266e0693188913f5e955a4a58f34b61c388fed   Looks like development is abandoned. Would be nice to have this possibility to load and save a YAML file back to text without writing to disc, which requires an executor or a node to run
          Hide
          rittneje Jesse Rittner added a comment -

          tsurankov The PR was merged. I don't think there has been a release since then yet. https://github.com/jenkinsci/pipeline-utility-steps-plugin/pull/88

          Show
          rittneje Jesse Rittner added a comment - tsurankov The PR was merged. I don't think there has been a release since then yet. https://github.com/jenkinsci/pipeline-utility-steps-plugin/pull/88
          Hide
          tsurankov tsurankov added a comment -

          Thanks for the response Jesse Rittner, looking forward to the release!

          Show
          tsurankov tsurankov added a comment - Thanks for the response Jesse Rittner , looking forward to the release!

            People

            Assignee:
            rsandell rsandell
            Reporter:
            rittneje Jesse Rittner
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated: