jenkinsci / jenkinsci/github-branch-source-plugin
[JENKINS-54265] Sending Parameters or initialize environment variables
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 218
- Forks
- 399
- Avg merge
- 30m
- Merged PRs (30d)
- 1
Description
Jenkins Version: 2.138.2
GitHub Branch Source Plugin Version 2.4.1
Within our Jenkins-Setup we integrated a github.dsl which is able to detect new projects or branches within a project and creates dynamically new Pipeline-Jobs. Every project contains a Jenkinsfile, which defines the build-process.
Within our organization, we would like to set-up an integrate and push mechanism, in order to keep a master-branch clean from any not working source-code.
To lock the jobs within a project, we would like to use the option "lock resource: any-name". If you add a specific name, the locking works just fine. But we would like to set the name of the resource to lock dynamically via either parameters or environments variables.
At the time, the options-block gets evaluated the environment does not seem to be available, hence any env-var is null and cannot be used.
Is it possible to expand the configuration within the github-dsl to send parameters to the generated job, so that these parameters contain values like the project-name or similar, that can be used inside the option-block?
Or is there a way to initialize the environment variables, so that these can be used within the option-block?
Originally reported by leherrma, imported from: Sending Parameters or initialize environment variables
- status: Open
- priority: Minor
- component(s): github-branch-source-plugin
- resolution: Unresolved
- votes: 0
- watchers: 2
- imported: 2025-12-02
Raw content of original issue
Jenkins Version: 2.138.2 GitHub Branch Source Plugin Version 2.4.1
Within our Jenkins-Setup we integrated a github.dsl which is able to detect new projects or branches within a project and creates dynamically new Pipeline-Jobs. Every project contains a Jenkinsfile, which defines the build-process.
Within our organization, we would like to set-up an integrate and push mechanism, in order to keep a master-branch clean from any not working source-code.
To lock the jobs within a project, we would like to use the option "lock resource: any-name". If you add a specific name, the locking works just fine. But we would like to set the name of the resource to lock dynamically via either parameters or environments variables.
At the time, the options-block gets evaluated the environment does not seem to be available, hence any env-var is null and cannot be used.
Is it possible to expand the configuration within the github-dsl to send parameters to the generated job, so that these parameters contain values like the project-name or similar, that can be used inside the option-block?
Or is there a way to initialize the environment variables, so that these can be used within the option-block?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the generated Pipeline job's Jenkinsfile and its options block, focusing on how the lock resource value is evaluated before environment variables are available. Determine whether parameters or project-derived values are expected to reach that block, then document or test the supported behavior and confirm that dynamic resource names work as intended.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- github, java
- Domain
- ci-cd
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100