jenkinsci / jenkinsci/github-branch-source-plugin

[JENKINS-54265] Sending Parameters or initialize environment variables

Open
#1,219 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

component:github-branch-source-plugin enhancement imported-jira-issue priority:minor resolution:unresolved
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.