jenkinsci / jenkinsci/git-plugin

[JENKINS-23415] 2 Jobs w/same repo. Job triggers twice when first triggered job is Git SCM is still downloading

Open
#2,486 13 comments 0 reactions 0 assignees View on GitHub
component:git-plugin imported-jira-issue priority:major resolution:unresolved
Dominant language
Java
Stars
694
Forks
1.1k
Avg merge
1h 29m
Merged PRs (30d)
3

Description

Problem:

A job keeps triggering when it should not.

Background:

2 separate jobs are configured to be triggered on the same Github repository depending on branch that pushed to.

When pushing to the 1st branch, "origin/test/branch1", the 1st job is triggered. Good.

When pushing to the 2nd branch, "origin/test/branch2", the 2nd job triggers. Good.

But the 1st job is triggered again. Bad. There's only been 2 pushes.

The repository is very large, so the git clone takes a few minutes for both jobs.

The problem consistently occurs when pushing to the 1st branch, THEN immediately pushing to the 2nd branch. The 1st job is triggered and git cloning. And the 2nd job is triggered and queued. BUT another 1st job is triggered and queued.

Seems to happen when it's still downloading during the clone.

That extra triggered job is causing us grief, because it's used for deployments.

This is reproducible consistently with this script:

----------------------------

#!/bin/bash

pushd mydirectory

git checkout develop

echo ${1}d >> d.txt

git add .

git commit -m "${1}d"

git push

git checkout test/branch1

git pull --no-edit upstream develop

git push

git checkout test/branch2

git pull --no-edit upstream test/branch1

git push

popd

----------------------------

And run it as:


  1. ./script 1

  2. ./script 2

    etc...

Jenkins v1.558

Git Client v1.9.1

Git plugin v2.2.1

GitHub API v1.54

Github OAuth v0.14

GitHub Pull Request Builder 1.12

GitHub plugin v1.8

---
Originally reported by tokyowizard, imported from: 2 Jobs w/same repo. Job triggers twice when first triggered job is Git SCM is still downloading


  • status: Open
  • priority: Major
  • component(s): git-plugin
  • label(s): git, github, scm
  • resolution: Unresolved
  • votes: 5
  • watchers: 9
  • imported: 2025-12-02

Raw content of original issue

Problem:
A job keeps triggering when it should not.

Background:
2 separate jobs are configured to be triggered on the same Github repository depending on branch that pushed to.

When pushing to the 1st branch, "origin/test/branch1", the 1st job is triggered. Good.
When pushing to the 2nd branch, "origin/test/branch2", the 2nd job triggers. Good.
But the 1st job is triggered again. Bad. There's only been 2 pushes.

The repository is very large, so the git clone takes a few minutes for both jobs.

The problem consistently occurs when pushing to the 1st branch, THEN immediately pushing to the 2nd branch. The 1st job is triggered and git cloning. And the 2nd job is triggered and queued. BUT another 1st job is triggered and queued.

Seems to happen when it's still downloading during the clone.

That extra triggered job is causing us grief, because it's used for deployments.

This is reproducible consistently with this script:

----------------------------
#!/bin/bash
pushd mydirectory
git checkout develop
echo ${1}d >> d.txt
git add .
git commit -m "${1}d"
git push

git checkout test/branch1
git pull --no-edit upstream develop
git push

git checkout test/branch2
git pull --no-edit upstream test/branch1
git push
popd
----------------------------

And run it as:


  1. ./script 1

  2. ./script 2
    etc...

Jenkins v1.558
Git Client v1.9.1
Git plugin v2.2.1
GitHub API v1.54
Github OAuth v0.14
GitHub Pull Request Builder 1.12
GitHub plugin v1.8

  • environment: CentOS 5, JDK 1.7

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.