You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Occasionally when using edgetest in some CI environments, edgetest recognizes changes to the git index that do not reflect actual file changes, leading to a cascade of exceptions being thrown.
Detailed description
More specifically, the behavior is related to thistry block. The command git diff-index --quiet HEAD will check for changes to the index rather than to the underlying files. According to the docs for this command (link), this does not check the actual files (see Note at the bottom). If this has occurred, as may be the case depending on the CI setup, then the command returns a code of 1, causing the plugin to enter the following except block. This in turn adds the requirements.txt and setup.cfg files to to the staging area and then attempts to commit them. If there are no changes to the underlying files, however, then this will be an empty commit, returning a code of 1 and causing the edgetest run to fail entirely due to a RuntimeError.
Proposed solutions
I am happy to work on a solution, though it may be a week or two before I get to it. Two potential ideas that came to mind are:
Add an explicit call to a git command to update the working tree index. For this, git update-index --refresh could work well. Source
Update the git diff-index to be git diff --quiet HEAD. This would compare the actual contents of the files and could be used in a similar way. Additionally, it could be sped up by passing through an explicit path to the requirements and setup files so that not every file is checked.
The drawback to either of these solutions is that there could be a performance drop, as the diff-index command is much faster. This could be ameliorated by handling of the explicit paths that are possible (though this could further constrain how a repo is set up and still use edgetest).
The text was updated successfully, but these errors were encountered:
Brief description
Occasionally when using
edgetest
in some CI environments,edgetest
recognizes changes to thegit
index that do not reflect actual file changes, leading to a cascade of exceptions being thrown.Detailed description
More specifically, the behavior is related to this
try
block. The commandgit diff-index --quiet HEAD
will check for changes to the index rather than to the underlying files. According to the docs for this command (link), this does not check the actual files (see Note at the bottom). If this has occurred, as may be the case depending on the CI setup, then the command returns a code of 1, causing the plugin to enter the followingexcept
block. This in turn adds therequirements.txt
andsetup.cfg
files to to the staging area and then attempts to commit them. If there are no changes to the underlying files, however, then this will be an empty commit, returning a code of 1 and causing theedgetest
run to fail entirely due to aRuntimeError
.Proposed solutions
I am happy to work on a solution, though it may be a week or two before I get to it. Two potential ideas that came to mind are:
git update-index --refresh
could work well. Sourcegit diff-index
to begit diff --quiet HEAD
. This would compare the actual contents of the files and could be used in a similar way. Additionally, it could be sped up by passing through an explicit path to the requirements and setup files so that not every file is checked.The drawback to either of these solutions is that there could be a performance drop, as the
diff-index
command is much faster. This could be ameliorated by handling of the explicit paths that are possible (though this could further constrain how a repo is set up and still useedgetest
).The text was updated successfully, but these errors were encountered: