Skip to content

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

@kchare

Description

@kchare

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions