Why would a job in Jenkins multibranch pipeline gets disabled
Asked Answered
S

3

8

We are using Jenkins(v2.235.1) and BitBucket cloud combination. We have BitBucket Team/Project type job which has created multi-branch pipelines. Some of the jobs corresponding to individual branches are getting disabled even these branches in the Git repo are active. Not sure why this is happening.

Can you please share some insight on this and how we can prevent this from happening.

Below are my versions

  • Jenkins v2.235.1
  • Bitbucket Branch Source plugin v2.9.7
  • Bitbucket plugin v1.1.27

Thank you

Schweinfurt answered 2/4, 2021 at 16:27 Comment(1)
Is there a specific number of days where branches are getting disabled ? When you configure your BitBucket Team/Project, what is your Child Orphaned Item Strategy configuration ?Grampositive
T
3

If there is no Jenkinsfile at the root of the repository or if the name is misspelled or is with different letters casing, like JenkinsFile, the job will be disabled.

From https://www.jenkins.io/doc/book/pipeline-as-code/

Presence of the Jenkinsfile in the root of a repository makes it eligible for Jenkins to automatically manage and execute jobs based on repository branches.

Tadio answered 27/8, 2021 at 20:23 Comment(0)
K
1

Make sure you have only one jenkinsfile in your root directory. it is not a good idea to have more than one file with the name jenkinsfile which causes jenkins to disable the job. this could be one the reason why your job is getting disabled.

Kinky answered 31/8, 2021 at 13:40 Comment(1)
multiple jenkinsfile in the root is normal for targeting multiple platforms. Jenkinsfile.windows, Jenkinsfile.linux, etcDoubletree
P
1

In addition to previous answers.

Jobs (branches/PRs/tags) also can be marked as disabled if you first start using all available discovering options (Bitbucket Team/Project -> Configure -> Behaviors -> Within repository -> Discover ...) and after that removed one or some of them. In this situation, a Child project of Bitbucket Team/Project indexes all branches/PRs/tags first (keep them active), and after the configuration was changed, it reindexes and disables unneeded items.

Also, jobs can be marked as disabled when Bitbucket Team/Project is configured in a way when both branches and PRs are discovered, but for branches configured the "Exclude branches that are also filed as PRs" strategy. In such a case, the branch that becomes a PR (a branch from which PR has been created) will not be tracked by Jenkins.

Plover answered 30/4, 2022 at 17:57 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.