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

Cannot apply Metadata to Pipeline jobs (WorkflowJob)

XMLWordPrintable

      MetadataJobProperty extends AbstractProject, while Pipeline (WorkflowJob) doesn't extend it:

      Groovy script inside a Pipeline Job:

      stage 'testMetadata'
      node{
      
          def testJob = currentBuild;
          properties([[$class :'MetadataJobProperty', 
                      values : [[
                                  $class: 'StringMetadataValue', 
                                  name : 'owner', 
                                  value : 'bob'
                              ]]
                      ]]);
      }
      

      Returns the following error:

      [Pipeline] stage (testMetadata)
      Using the 'stage' step without a block argument is deprecated
      Entering stage testMetadata
      Proceeding
      [Pipeline] node
      Running on master in (...)
      [Pipeline]

      { [Pipeline] properties [Pipeline] }

      [Pipeline] // node
      [Pipeline] End of Pipeline
      ERROR: cannot apply com.sonyericsson.hudson.plugins.metadata.model.MetadataJobProperty to a WorkflowJob
      Finished: FAILURE

            rsandell rsandell
            pedrofaria Pedro Faria
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: