chromaui / chromatic-cli

Chromatic CLI: `npx chromatic`
https://www.chromatic.com/docs/cli
MIT License
285 stars 71 forks source link

⚠ TurboSnap disabled due to missing git history #993

Closed nfarina closed 3 months ago

nfarina commented 3 months ago

After https://github.com/chromaui/chromatic-cli/pull/988 was released in v11.4.0, the customers are hitting error Build had uncommitted changes Their projects were working correctly before. To fix the error, we tried:

1) Setting CHROMATIC_SHA, CHROMATIC_BRANCH, CHROMATIC_SLUG

2) Tried running git diff-index HEAD -- but it doesn't print anything, the working tree is clean on the CI.

3) Ensuring that the commit is present via git log 974… and it is there.

4) Reviewed YAML. See: https://github.com/nfarina/crosswing/blob/main/.github/workflows/chromatic.yml


For the 'failing' build: https://www.chromatic.com/build?appId=664f7dfdb3ca361ef24fafee&number=6

The customer did a query and got this:

{
"id": "66549ac66b83b30ccea942e8",
"number": 6,
"status": "ACCEPTED",
"commit": "97437bf627eb8ae023f02ca832812b626aa25a9b",
"committedAt": 1716820654000,
"uncommittedHash": "8a8a52f029dddca3d643f70ec3f5c601eb09aa38",
"changeCount": 6
}

The presence of "uncommittedHash" seems to be triggering this problem. I tried running the various `git diff` commands that `getUncommitedHash()` in the CLI runs, but all return nothing (no changes).

It's not a git commit hash (git log 8a8… returns "bad object") - not sure where it's coming from!

No VTA, local builds: https://www.chromatic.com/builds?appId=664f7dfdb3ca361ef24fafee

Could you try downgrading the CLI version from 11.4.1/latest to v11.3.5? The PR https://github.com/chromaui/chromatic-cli/pull/988 was released in v11.4.0.

cgbl-90 commented 3 months ago

Hey @nfarina can you our in-app chat to contact us or email us? Please send the --debug output for your build

nfarina commented 3 months ago

Ok will do later!

linear[bot] commented 3 months ago

AP-4668 Customers hit error: `Build had uncommitted changes`

nfarina commented 3 months ago

Awesome, that did the trick, thanks so much!

ghengeveld commented 3 months ago

@nfarina Excellent, thanks for the feedback!

redonkulus commented 2 months ago

@nfarina @ghengeveld what was the actual fix? I'm having this same issue in my repository and it is hard to debug what the issue is.

ghengeveld commented 2 months ago

@redonkulus The fix was implemented in #994. In a nutshell, we have some logic that attempts to find Chromatic baseline builds. If there's no build for the parent commit, we look further back in history to find a replacement build. We have a similar behavior when you're running a build on uncommitted code (unclean Git repo), but that behavior was being applied to CI builds even though it should only apply to local (visual test addon) builds.

In any case, you should be using the latest version of our CLI (currently v11.5.5) and the problem should be resolved. If not, please reach out to our customer support chat.

redonkulus commented 2 months ago

Thanks for the info @ghengeveld. I'm using chromaui/action@v11 but my job pulling in version v11.5.4. Should I hardcode to 11.5.5 or does a tag need to be updated in the action to point to the latest version?

FYI, I filed a similar issue yesterday with TurboSnap that might be related to this, not sure if it will be solved by 11.5.5 as well. https://github.com/chromaui/chromatic-cli/issues/1014

ghengeveld commented 2 months ago

The fix was shipped in 11.5.1 so you should already have it. chromaui/action@v11 should give you v11.5.5 though (as of 4 days ago). v11.5.5 doesn't change anything related to TurboSnap.