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

Calculate and record uncommittedHash when creating a build #798

Merged
merged 6 commits into from
Aug 15, 2023

Conversation

ghengeveld
Copy link
Member

This is required for the "is outdated" concept in the Visual Tests addon, but may also be used in the future for other builds (e.g. during onboarding or even CI builds with an unclean working directory).

@linear
Copy link

linear bot commented Aug 11, 2023

AP-3369 Add concept of outdated builds

  • Store a "git changes" hash as well as the commit hash on the build (ideally in the index, but it could be locally).
    • The CLI could understand the concept of a "uncommitted builds" also.
  • Poll git for the current commit hash + changes hash (we also need to poll for branch for AP-3366 eventually)
  • Consider snapshots out of date if the two don't match.

To get a hash of staged+unstaged+untracked changes:

(
 git diff --name-only --diff-filter=d --cached; 
 git diff --name-only --diff-filter=d; 
 git ls-files --others --exclude-standard
) | git hash-object --stdin-paths | git hash-object --stdin

This seems to be the only way to get a full hash of all these types of changes, whilst excluding any deleted files (which would cause an error because they can't be hashed).

node-src/git/git.ts Show resolved Hide resolved
Copy link
Contributor

@weeksling weeksling left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

weeksling

This comment was marked as duplicate.

@weeksling
Copy link
Contributor

It looks like this is failing tests because the CI for multiple reasons. Action-canary is a git.email issue others are 400 errors from git

@ghengeveld
Copy link
Member Author

ghengeveld commented Aug 15, 2023

It looks like this is failing tests because the CI for multiple reasons. Action-canary is a git.email issue others are 400 errors from git

That's caused by this PR which is released as canary but not merged yet. It needs to deal with missing email config.

The unit tests fail due to missing mock for getUncommittedHash. I added those just now.

The other tests fail because the index doesn't accept uncommittedHash yet, which will be resolved when merging this PR.

@ghengeveld ghengeveld merged commit a776f36 into main Aug 15, 2023
28 checks passed
@ghengeveld ghengeveld deleted the ghengeveld/ap-3369-add-concept-of-outdated-builds branch August 15, 2023 14:21
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

Successfully merging this pull request may close these issues.

3 participants