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

Lockable resources: Allow to define time constrained resources

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      Sometimes a resource is limited or unavailable only during certain times, for example because of a fixed maintenance window for a specific service. It would therefor be nice to be able to optionally define a time frame during which the lock must be aquired. Outside that time frame, the resource should always be considered available.

        Attachments

          Activity

          Hide
          dhs Dirk Heinrichs added a comment -

          OK, found a workaround by using a blocking job that runs (and acquires the lock) as long as the resource is unavailable and a Groovy expression in the jobs that need the resource which only tries to acquire the lock at certain time.

          However, I need to implement this using JobDSL, but the documentation doesn't say anything about how to add a Groovy expression with JobDSL. Can you please clarify?

          Show
          dhs Dirk Heinrichs added a comment - OK, found a workaround by using a blocking job that runs (and acquires the lock) as long as the resource is unavailable and a Groovy expression in the jobs that need the resource which only tries to acquire the lock at certain time. However, I need to implement this using JobDSL, but the documentation doesn't say anything about how to add a Groovy expression with JobDSL. Can you please clarify?
          Hide
          dhs Dirk Heinrichs added a comment -

          Could configure it using the following JobDSL snippet:

          job('LockableTest') {
            def lockScript = '...'
            configure { project ->
              project / 'properties' / 'org.jenkins.plugins.lockableresources.RequiredResourcesProperty' {
                'resourceMatchScript' {
                  'script'(lockScript)
                  'sandbox'(false)
                }
              }
            }
          }

          However, as this is quite cumbersome, it would be really great to have direct support for Groovy expressions in JobDSL.

          Show
          dhs Dirk Heinrichs added a comment - Could configure it using the following JobDSL snippet: job( 'LockableTest' ) { def lockScript = '...' configure { project -> project / 'properties' / 'org.jenkins.plugins.lockableresources.RequiredResourcesProperty' { 'resourceMatchScript' { 'script' (lockScript) 'sandbox' ( false ) } } } } However, as this is quite cumbersome, it would be really great to have direct support for Groovy expressions in JobDSL.

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            dhs Dirk Heinrichs
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: