Skip to content

Locking pipeline without using executors #732

@skreienk

Description

@skreienk

What feature do you want to see added?

I run Jenkins in a kubernetes environment. I am trying to lock an entire pipeline so it runs as a single unit. I need this because I have multiple levels of priority of jobs, and need to be able to block execution of jobs in more than the single way allowed by the build-blocker plugin.

When running a simple pipeline like this:

pipeline {
    agent any
    options{
        lock(resource: "shared_resource_lock",quantity:1,priority:0)
    }
    stages {
        stage("test") {
            steps {
                    sh("sleep 300")
            }
        }
    }
}

If I have ten executors and build ten of these simultaneously, all ten executors will be busy, with 9 of them waiting on locks and blocking other buildable jobs. I would like the lock interpreted before being assigned an executor so that it's waiting in the queue and not blocking other buildable jobs.

Upstream changes

No response

Are you interested in contributing this feature?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions