-
Notifications
You must be signed in to change notification settings - Fork 354
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changeset detection broke between 866.vdea_7dcd3008e and 874.v659a_b_70f5e69 #812
Comments
potentially @andrey-fomin if you have a look please? |
We are also seeing something strange after upgrading this plugin from 866.vdea_7dcd3008e to 874.v659a_b_70f5e69. A multi-branch pipeline with "Discover pull requests from origin" used to show this at the beginning of the logs: git fetch --tags --force --progress -- ssh://git@bitbucket.redactedserver.com/repo_example.git +refs/heads/*:refs/remotes/origin/*
git fetch --tags --force --progress -- ssh://git@bitbucket.redactedserver.com/repo_example.git +refs/pull-requests/38/from:refs/remotes/origin/PR-38
git fetch --tags --force --progress -- ssh://git@bitbucket.redactedserver.com/repo_example.git +refs/heads/main:refs/remotes/upstream/main and after the upgrade it just shows: git fetch --tags --force --progress -- ssh://git@bitbucket.redactedserver.com/repo_example.git +refs/heads/branch_of_pr_38:refs/remotes/origin/branch_of_pr_38 We don't have local git information about pull requests, which causes issues in scripts we use. This PR: https://github.com/jenkinsci/bitbucket-branch-source-plugin/pull/796/files |
This change also leads to SonarQube being unable to capture the changes and always reporting 0 changed files.
|
I'll check |
I can't reproduce this issue. For me change log is empty for the first build and contains some changes in next builds if branch is updated. Do you use default strategy to compute change log agains previous build? Or do you use ChangelogToBranch extension? I can guess that new fetching implementation doesn't work properly with ChangelogToBranch extension. |
We do nothing else beside of calling the mentioned function. We always got (and rely on) the change delta from last build I've attached our job config in case this is of any help config.xml<?xml version='1.1' encoding='UTF-8'?>
<jenkins.branch.OrganizationFolder plugin="branch-api@2.1046.v0ca_37783ecc5">
<actions/>
<description></description>
<displayName>Konfigurationen</displayName>
<properties>
<jenkins.branch.OrganizationChildHealthMetricsProperty>
<templates>
<com.cloudbees.hudson.plugins.folder.health.WorstChildHealthMetric plugin="cloudbees-folder@6.773.vd2dcc704ee7e">
<nonRecursive>false</nonRecursive>
</com.cloudbees.hudson.plugins.folder.health.WorstChildHealthMetric>
</templates>
</jenkins.branch.OrganizationChildHealthMetricsProperty>
<jenkins.branch.OrganizationChildOrphanedItemsProperty>
<strategy class="jenkins.branch.OrganizationChildOrphanedItemsProperty$Inherit"/>
</jenkins.branch.OrganizationChildOrphanedItemsProperty>
<jenkins.branch.OrganizationChildTriggersProperty>
<templates>
<com.cloudbees.hudson.plugins.folder.computed.PeriodicFolderTrigger plugin="cloudbees-folder@6.773.vd2dcc704ee7e">
<spec>H H/4 * * *</spec>
<interval>86400000</interval>
</com.cloudbees.hudson.plugins.folder.computed.PeriodicFolderTrigger>
</templates>
</jenkins.branch.OrganizationChildTriggersProperty>
<com.cloudbees.hudson.plugins.folder.properties.FolderCredentialsProvider_-FolderCredentialsProperty plugin="cloudbees-folder@6.773.vd2dcc704ee7e">
<domainCredentialsMap class="hudson.util.CopyOnWriteMap$Hash">
<entry>
<com.cloudbees.plugins.credentials.domains.Domain plugin="credentials@1189.vf61b_a_5e2f62e">
<specifications/>
</com.cloudbees.plugins.credentials.domains.Domain>
<java.util.concurrent.CopyOnWriteArrayList>
<com.cloudbees.plugins.credentials.impl.UsernamePasswordCredentialsImpl plugin="credentials@1189.vf61b_a_5e2f62e">
<id>36c31674-7dc1-4af2-9447-677b5393c8a1</id>
<description></description>
<username><entfernt></username>
<password><entfernt></password>
<usernameSecret>false</usernameSecret>
</com.cloudbees.plugins.credentials.impl.UsernamePasswordCredentialsImpl>
</java.util.concurrent.CopyOnWriteArrayList>
</entry>
</domainCredentialsMap>
</com.cloudbees.hudson.plugins.folder.properties.FolderCredentialsProvider_-FolderCredentialsProperty>
<jenkins.branch.NoTriggerOrganizationFolderProperty>
<branches>.*</branches>
<strategy>NONE</strategy>
</jenkins.branch.NoTriggerOrganizationFolderProperty>
</properties>
<folderViews class="jenkins.branch.OrganizationFolderViewHolder">
<owner reference="../.."/>
</folderViews>
<healthMetrics/>
<icon class="jenkins.branch.MetadataActionFolderIcon">
<owner class="jenkins.branch.OrganizationFolder" reference="../.."/>
</icon>
<orphanedItemStrategy class="com.cloudbees.hudson.plugins.folder.computed.DefaultOrphanedItemStrategy" plugin="cloudbees-folder@6.773.vd2dcc704ee7e">
<pruneDeadBranches>true</pruneDeadBranches>
<daysToKeep>-1</daysToKeep>
<numToKeep>-1</numToKeep>
<abortBuilds>false</abortBuilds>
</orphanedItemStrategy>
<triggers>
<com.cloudbees.hudson.plugins.folder.computed.PeriodicFolderTrigger plugin="cloudbees-folder@6.773.vd2dcc704ee7e">
<spec>H H/4 * * *</spec>
<interval>86400000</interval>
</com.cloudbees.hudson.plugins.folder.computed.PeriodicFolderTrigger>
</triggers>
<disabled>false</disabled>
<navigators>
<com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMNavigator plugin="cloudbees-bitbucket-branch-source@791.vb_eea_a_476405b">
<serverUrl>https://<entfernt>/bitbucket</serverUrl>
<credentialsId>36c31674-7dc1-4af2-9447-677b5393c8a1</credentialsId>
<repoOwner>PROJECT</repoOwner>
<traits>
<jenkins.scm.impl.trait.RegexSCMSourceFilterTrait plugin="scm-api@621.vda_a_b_055e58f7">
<regex>(config_dev|config_test)</regex>
</jenkins.scm.impl.trait.RegexSCMSourceFilterTrait>
<com.cloudbees.jenkins.plugins.bitbucket.BranchDiscoveryTrait>
<strategyId>1</strategyId>
</com.cloudbees.jenkins.plugins.bitbucket.BranchDiscoveryTrait>
<com.cloudbees.jenkins.plugins.bitbucket.OriginPullRequestDiscoveryTrait>
<strategyId>1</strategyId>
</com.cloudbees.jenkins.plugins.bitbucket.OriginPullRequestDiscoveryTrait>
<com.cloudbees.jenkins.plugins.bitbucket.ForkPullRequestDiscoveryTrait>
<strategyId>1</strategyId>
<trust class="com.cloudbees.jenkins.plugins.bitbucket.ForkPullRequestDiscoveryTrait$TrustTeamForks"/>
</com.cloudbees.jenkins.plugins.bitbucket.ForkPullRequestDiscoveryTrait>
</traits>
</com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMNavigator>
</navigators>
<projectFactories>
<org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProjectFactory plugin="workflow-multibranch@716.vc692a_e52371b_">
<scriptPath>Jenkinsfile</scriptPath>
</org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProjectFactory>
</projectFactories>
<buildStrategies>
<jenkins.branch.buildstrategies.basic.ChangeRequestBuildStrategyImpl plugin="basic-branch-build-strategies@71.vc1421f89888e">
<ignoreTargetOnlyChanges>true</ignoreTargetOnlyChanges>
<ignoreUntrustedChanges>false</ignoreUntrustedChanges>
</jenkins.branch.buildstrategies.basic.ChangeRequestBuildStrategyImpl>
<jenkins.branch.buildstrategies.basic.NamedBranchBuildStrategyImpl plugin="basic-branch-build-strategies@71.vc1421f89888e">
<filters>
<jenkins.branch.buildstrategies.basic.NamedBranchBuildStrategyImpl_-RegexNameFilter>
<regex>^.*$</regex>
<caseSensitive>false</caseSensitive>
</jenkins.branch.buildstrategies.basic.NamedBranchBuildStrategyImpl_-RegexNameFilter>
</filters>
</jenkins.branch.buildstrategies.basic.NamedBranchBuildStrategyImpl>
</buildStrategies>
<strategy class="jenkins.branch.DefaultBranchPropertyStrategy">
<properties class="empty-list"/>
</strategy>
</jenkins.branch.OrganizationFolder> |
Hi. I confirm a similar problem. I configured additional "ref specs" for git fetch - to use in "git diff <source_branch>...<target_branch>" for generating of FILES_CHANGELIST in first PR build when changeset is empty. Before updating to the latest versions: `using GIT_SSH to set credentials
After plugin updating to 866 higher version, it removes fetching of additional ref specs: `using GIT_SSH to set credentials
And I get an error in my diff command
Additional Ref Specs are set through git-plugin behaviour "Specify ref specs" |
@andrey-fomin We use the default strategy also. See the config.xml of a job with the issue<?xml version='1.1' encoding='UTF-8'?>
<org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject plugin="workflow-multibranch@756.v891d88f2cd46">
<actions/>
<description>Build pipeline for project redacted</description>
<displayName>job-name-redacted</displayName>
<properties/>
<folderViews class="jenkins.branch.MultiBranchProjectViewHolder" plugin="branch-api@2.1128.v717130d4f816">
<owner class="org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject" reference="../.."/>
</folderViews>
<healthMetrics>
<com.cloudbees.hudson.plugins.folder.health.WorstChildHealthMetric plugin="cloudbees-folder@6.858.v898218f3609d">
<nonRecursive>false</nonRecursive>
</com.cloudbees.hudson.plugins.folder.health.WorstChildHealthMetric>
</healthMetrics>
<icon class="jenkins.branch.MetadataActionFolderIcon" plugin="branch-api@2.1128.v717130d4f816">
<owner class="org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject" reference="../.."/>
</icon>
<orphanedItemStrategy class="com.cloudbees.hudson.plugins.folder.computed.DefaultOrphanedItemStrategy" plugin="cloudbees-folder@6.858.v898218f3609d">
<pruneDeadBranches>true</pruneDeadBranches>
<daysToKeep>5</daysToKeep>
<numToKeep>-1</numToKeep>
<abortBuilds>false</abortBuilds>
</orphanedItemStrategy>
<triggers>
<com.cloudbees.hudson.plugins.folder.computed.PeriodicFolderTrigger plugin="cloudbees-folder@6.858.v898218f3609d">
<spec>H H/4 * * *</spec>
<interval>86400000</interval>
</com.cloudbees.hudson.plugins.folder.computed.PeriodicFolderTrigger>
</triggers>
<disabled>false</disabled>
<sources class="jenkins.branch.MultiBranchProject$BranchSourceList" plugin="branch-api@2.1128.v717130d4f816">
<data>
<jenkins.branch.BranchSource>
<source class="com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMSource" plugin="cloudbees-bitbucket-branch-source@848.v42c6a_317eda_e">
<id>name_redacted</id>
<serverUrl>https://bitbucket.companyname.com</serverUrl>
<credentialsId>service_account_credentials</credentialsId>
<repoOwner>REDACTED</repoOwner>
<repository>repo_name_redacted</repository>
<traits>
<com.cloudbees.jenkins.plugins.bitbucket.BranchDiscoveryTrait>
<strategyId>1</strategyId>
</com.cloudbees.jenkins.plugins.bitbucket.BranchDiscoveryTrait>
<com.cloudbees.jenkins.plugins.bitbucket.ForkPullRequestDiscoveryTrait>
<strategyId>1</strategyId>
<trust class="com.cloudbees.jenkins.plugins.bitbucket.ForkPullRequestDiscoveryTrait$TrustTeamForks"/>
</com.cloudbees.jenkins.plugins.bitbucket.ForkPullRequestDiscoveryTrait>
<com.cloudbees.jenkins.plugins.bitbucket.OriginPullRequestDiscoveryTrait>
<strategyId>1</strategyId>
</com.cloudbees.jenkins.plugins.bitbucket.OriginPullRequestDiscoveryTrait>
<jenkins.plugins.git.traits.WipeWorkspaceTrait plugin="git@5.2.0"/>
<jenkins.plugins.git.traits.CloneOptionTrait plugin="git@5.2.0">
<extension class="hudson.plugins.git.extensions.impl.CloneOption">
<shallow>false</shallow>
<noTags>false</noTags>
<honorRefspec>false</honorRefspec>
</extension>
</jenkins.plugins.git.traits.CloneOptionTrait>
<com.cloudbees.jenkins.plugins.bitbucket.SSHCheckoutTrait>
<credentialsId>service_account_ssh_key</credentialsId>
</com.cloudbees.jenkins.plugins.bitbucket.SSHCheckoutTrait>
</traits>
</source>
<strategy class="jenkins.branch.DefaultBranchPropertyStrategy">
<properties class="java.util.Arrays$ArrayList">
<a class="jenkins.branch.BranchProperty-array">
<jenkins.branch.BuildRetentionBranchProperty>
<buildDiscarder class="hudson.tasks.LogRotator">
<daysToKeep>-1</daysToKeep>
<numToKeep>10</numToKeep>
<artifactDaysToKeep>-1</artifactDaysToKeep>
<artifactNumToKeep>-1</artifactNumToKeep>
</buildDiscarder>
</jenkins.branch.BuildRetentionBranchProperty>
</a>
</properties>
</strategy>
</jenkins.branch.BranchSource>
</data>
<owner class="org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject" reference="../.."/>
</sources>
<factory class="org.jenkinsci.plugins.workflow.multibranch.WorkflowBranchProjectFactory">
<owner class="org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject" reference="../.."/>
<scriptPath>Jenkinsfile</scriptPath>
</factory>
</org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject> |
Makes RefSpecsSCMSourceTrait working again. Fixes jenkinsci#814. See also jenkinsci#812. Problem was introduced in jenkinsci#796.
@sha-root I believe your problem should be solved by #815. Please can you check release 876.v857269a_5f439 @kenden I don't understand why pattern The only thing I can assume that your builds are executed in different folders (for example, multiple worker nodes or parallel builds). If branch was overwritten with forced push then commit from previous build can be missing in the current build folder. Fetching all branches with @kenden do you use force pushes? Please can you try again with 876.v857269a_5f439? |
@andrey-fomin |
@andrey-fomin Thanks. git fetch --tags --force --progress -- ssh://git@bitbucket.redactedserver.com/repo_example.git +refs/pull-requests/38/from:refs/remotes/origin/PR-38 We allow force pushed for pull requests. But we protect the base branch (main). But made changed to our scripting to not depend on it. So this is not a problem for us anymore. |
Jenkins and plugins versions report
Environment
What Operating System are you using (both controller, and any agents involved in the problem)?
Red Hat Enterprise Linux Server 7.9
Reproduction steps
We are using the following function to gather changed yaml files:
This can be reproduced by a simple git commit in the repo which is being built, modifying one of the yaml files (function filters for Files ending with ".yaml"). With the old version this triggered an entry in the array, using the new version the array stays empty.
Expected Results
Using 874.v659a_b_70f5e69 the returned files variable (from our function) is empty. We would expect to still get all changed files from the function mentioned above
Actual Results
After upgrading from 866.vdea_7dcd3008e to 874.v659a_b_70f5e69 changeset detection doesn't work anymore.
Anything else?
No response
Are you interested in contributing a fix?
No response
The text was updated successfully, but these errors were encountered: