Skip to content
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

edgetest-hub errors out when the index changes but the files do not. #37

Open
kchare opened this issue Jul 22, 2022 · 0 comments
Open

Comments

@kchare
Copy link

kchare commented Jul 22, 2022

Brief description

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 this try 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:

  1. Add an explicit call to a git command to update the working tree index. For this, git update-index --refresh could work well. Source
  2. 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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant