jenkinsci / jenkinsci/git-plugin

[JENKINS-59071] Git should include an option to "checkout the revision at build-time"

Open
#3,458 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

component:git-plugin enhancement imported-jira-issue priority:minor resolution:unresolved
Dominant language
Java
Stars
694
Forks
1.1k
Avg merge
1h 29m
Merged PRs (30d)
3

Description

Currently the git-plugin can checkout the current head, or a specific commit, what I'm missing is an option to checkout the head at the time where the build has started.

Reason: if you have a pipeline build that was triggered at a certain time, and the devlopers checked in something before the checkout takes place these changes are picked up even if the build is already running for a while.

For example I have a pipeline that builds different repositories together one after the other. It now can happen that a build starts, checkout the first repository, then checkout the second but picks up changes commited at a later point at time (and fail because changes from the first repository are not taken into account).

The same happens if you replay a certain pipeline build, it always fetches the ltest changes and not the changes that where current at the time of the build (so replay is more a "rebuild with different script" because the build is not really replayed.


Originally reported by laeubi, imported from: Git should include an option to "checkout the revision at build-time"
  • status: Open
  • priority: Minor
  • component(s): git-plugin
  • resolution: Unresolved
  • votes: 0
  • watchers: 5
  • imported: 2025-12-02
Raw content of original issue

Currently the git-plugin can checkout the current head, or a specific commit, what I'm missing is an option to checkout the head at the time where the build has started.

Reason: if you have a pipeline build that was triggered at a certain time, and the devlopers checked in something before the checkout takes place these changes are picked up even if the build is already running for a while.

For example I have a pipeline that builds different repositories together one after the other. It now can happen that a build starts, checkout the first repository, then checkout the second but picks up changes commited at a later point at time (and fail because changes from the first repository are not taken into account).

The same happens if you replay a certain pipeline build, it always fetches the ltest changes and not the changes that where current at the time of the build (so replay is more a "rebuild with different script" because the build is not really replayed.

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

The issue names the git-plugin and Jenkins pipeline checkout behavior but no files or tests. Start by locating the checkout option and pipeline entry points, then determine how a build-time revision should be selected; done means an option preserves the repository state from build start, including sequential checkouts and replayed builds.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, java
Domain
ci-cd
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.