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

requireResources and RequiredResourcesProperty are not available in pipeline multibranch properties

XMLWordPrintable

      According to https://www.jenkins.io/doc/pipeline/steps/workflow-multibranch/ there should be possibility to use requireResources or class RequiredResourcesProperty within the property() function in Jenkinsfile.

      When I try to use it with requireResources() like:

      properties([
          parameters(parametersList),
          pipelineTriggers([eventTrigger(jmespathQuery(<myJmesPathQuery>))]),
          requireResources('resourceName')
      ]) 

      I get error that no such DSL methods were find among steps

      When I try to use it with class RequiredResourcesProperty like

      properties([
          parameters(parametersList),
          pipelineTriggers([eventTrigger(jmespathQuery(<myJmesPathQuery>))]),
          [
              $class: 'RequiredResourcesProperty',
              resourceNames: 'resuorceName'
          ]
      ]) 

      I am getting following error:
      ERROR: cannot apply org.jenkins.plugins.lockableresources.RequiredResourcesProperty to a WorkflowJob
      Is there possibility to update the properties of the job (add resource plugin in this section) that way from jenkinsfile?
      Or the documentation is not up-to-date?

            Unassigned Unassigned
            niemampomyslunanazwe Piotr
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: