Project

General

Profile

Actions

Bug #19244

closed

ceph-pr-submodules jenkins job doesn't work

Added by Dan Mick about 7 years ago. Updated almost 7 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
% Done:

0%

Source:
Development
Tags:
Backport:
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Crash signature (v1):
Crash signature (v2):

Description

git submodule foreach doesn't work on a fresh clone; the only thing I can find to get it to work is a git submodule update.

Also, checking for 'any output' from git submodule (with [[ $submodule_output ]]) is wrong; you get output even if there are no inconsistencies.

Also, recently, we had a case where a random subdir got added back, but had no contents, which causes the 'submodule foreach' to lose it. Need to check for an error code from it as well.

Working on a fix.

Actions #1

Updated by Dan Mick about 7 years ago

  • Subject changed from ceph-pr-submodules jenkin job doesn't work to ceph-pr-submodules jenkins job doesn't work
Actions #2

Updated by Ken Dreyer about 7 years ago

some more discussion @ https://github.com/ceph/ceph-build/issues/656

Does git diff <range> --submodule=log | grep Submodule work for you?

Actions #3

Updated by Dan Mick about 7 years ago

still has to have a git submodule update, but maybe

Actions #4

Updated by Dan Mick about 7 years ago

As a piece of this puzzle: a generic method for specifying the range of commits in the pull request is

git fetch origin $ghprbTargetBranch
git log --oneline refs/remotes/origin/$ghprbTargetBranch..$ghprbActualCommit

TargetBranch is the branch into which the PR wants to merge, and ActualCommit is the SHA1 of the tip of the PR's branch, so this shows all commits in the PR branch that are not already in the existing branch. This should be the set of commits that are searched for changes to submodules.

Actions #5

Updated by Dan Mick about 7 years ago

This is what I'm looking at:

--- a/ceph-pr-submodules/build/build
+++ b/ceph-pr-submodules/build/build
@@ -4,12 +4,11 @@ set -ex

 cd "$WORKSPACE" 

-# The command below has access to the variables $name, $path, $sha1 and $toplevel:
-# $name is the name of the relevant submodule section in .gitmodules, $path is
-# the name of the submodule directory relative to the superproject, $sha1 is
-# the commit as recorded in the superproject, and $toplevel is the absolute
-# path to the top-level of the superproject.
-modified_submodules=$(git submodule foreach 'cd $toplevel; git diff --ignore-submodules=dirty origin/master -- $path')
+# show diffs between $ghprbTargetBranch (where the merge is going) and
+# $ghprbActiveCommit (the tip of the branch that's merging) with '...',
+# which is equivalent to diff $(git merge-base TB AC) AC.  With 
+# --submodule, also show detail of diff in submodules.
+modified_submodules="$(git diff --submodule=log $ghprbTargetBranch...$ghprbActiveCommit | grep ^Submodule)" 

 if [[ $modified_submodules ]]; then
     echo "Project has modified submodules!" 

Actions #6

Updated by Ken Dreyer about 7 years ago

That looks a lot better than the current implementation

Actions #7

Updated by Dan Mick about 7 years ago

  • Status changed from 12 to Fix Under Review

The above had some bugs, but the current version is in https://github.com/ceph/ceph-build/pull/665

Actions #8

Updated by Alfredo Deza almost 7 years ago

  • Status changed from Fix Under Review to Resolved
Actions

Also available in: Atom PDF