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

Gotcha about chromatic publish not working #17114

Merged
merged 3 commits into from
Jan 21, 2022

Conversation

cabbiepete
Copy link
Contributor

@cabbiepete cabbiepete commented Jan 3, 2022

New repos with less than 2 commits will fail due to the shallow clone test Found only one commit This typically means you've checked out a shallow copy of the Git repository,

Issue:

What I did

My chat from the chromatic intercom that pointed this out and helped me resolve the issue.

cli issue trying to install chromatic while following the storybook testing tutorial
taskbox git:(master) npx chromatic --project-token=40bc0fc490f8
Chromatic CLI v6.3.3
https://www.chromatic.com/docs/cli
✔ Authenticated with Chromatic
→ Using project token '********90f8'
✖ Retrieving git information
→ Refer to your CI provider's documentation for details.
Collect Storybook metadata
Build Storybook
Publish your built Storybook
Verify your Storybook
Test your stories
✖ Failed to retrieve git information
✖ Found only one commit
This typically means you've checked out a shallow copy of the Git repository, which some CI systems do by default.
In order for Chromatic to correctly determine baseline commits, we need access to the full Git history graph.
Refer to your CI provider's documentation for details.
→ View the full stacktrace below
If you need help, please chat with us at https://www.chromatic.com/docs/cli for the fastest response.
You can also email the team at support@chromatic.com if chat is not an option.
Please provide us with the above CLI output and the following info:
{
"timestamp": "2022-01-03T01:55:06.683Z",
"sessionId": "5b14b470-bc2b-4aa7-904b-6143d02a71cf",
"nodePlatform": "darwin",
"nodeVersion": "14.18.1",
"packageName": "chromatic",
"packageVersion": "6.3.3",
"flags": {
"projectToken": [
"40bc0fc490f8"
],
"appCode": [],
"outputDir": [],
"storybookBuildDir": [],
"untraced": [],
"externals": [],
"interactive": true
},
"buildScript": "build-storybook -s public",
"errorType": "Error",
"errorMessage": "✖ Failed to retrieve git information"
}
Error: ✖ Failed to retrieve git information
✖ Found only one commit
This typically means you've checked out a shallow copy of the Git repository, which some CI systems do by default.
In order for Chromatic to correctly determine baseline commits, we need access to the full Git history graph.
Refer to your CI provider's documentation for details.
at /Users/cabbiepete/development/taskbox/node_modules/chromatic/bin/main.cjs:95:1602
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async wt.steps (/Users/cabbiepete/development/taskbox/node_modules/chromatic/bin/main.cjs:95:1089)
at async e.exports.task (/Users/cabbiepete/development/taskbox/node_modules/chromatic/bin/main.cjs:70:11136)
Operator profile
Thanks we'll get back to you as soon as we can.
Michael profile
Hi Peter, It looks like there is only one commit in your repo. Can you make another git commit and try again?
January 4
Thanks, interesting gotcha you guys should note this in the quick start or link to a FAQ about it. I'll see if I can do a PR for the storybook book tutorial
it works btw
14m ago. Not seen yet
We run on Intercom

How to test

  • Is this testable with Jest or Chromatic screenshots?
  • Does this need a new example in the kitchen sink apps?
  • Does this need an update to the documentation?

Create a new repo and attempt npx chromatic --project-token=<token> expect failure, add 1 commit, try again another failure, add a 2nd commit try again expect success.

New repos with less than 2 commits will fail due to the shallow clone test `Found only one commit
This typically means you've checked out a shallow copy of the Git repository,`
@nx-cloud
Copy link

nx-cloud bot commented Jan 3, 2022

☁️ Nx Cloud Report

We didn't find any information for the current pull request with the commit 2e3ee01.
You might need to set the 'NX_BRANCH' environment variable in your CI pipeline.

Check the Nx Cloud Github Integration documentation for more information.


Sent with 💌 from NxCloud.

@kylegach kylegach added documentation patch:yes Bugfix & documentation PR that need to be picked to main branch labels Jan 4, 2022
Copy link
Contributor

@jonniebigodes jonniebigodes left a comment

Choose a reason for hiding this comment

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

@cabbiepete thanks for the time and effort you've put into this pull request and willingness to help us improve our documentation. One small item to take care of and this should be good to go.

Let me know once you've addressed the feedback and I'll gladly merge this pull request.

Have a great day!

Stay safe

Comment on lines 43 to 47
<div class="aside">

GOTCHA: If you're project has less than 2 commits chromatic publishing will fail while `Retrieving git information` add another commit and try again.

</div>
Copy link
Contributor

Choose a reason for hiding this comment

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

@cabbiepete we have a bit of room for improvement here. We could move this below the snippet with the text " Build 1 published...." and probably go with:

<div class="aside">
💡 Before running Chromatic's CLI ensure you have at least two commits added to the repository to prevent build failures, as Chromatic relies on a full Git history graph to establish the baselines. Read more about baselines in Chromatic's <a href="https://www.chromatic.com/docs/branching-and-baselines"> documentation</a>
</div>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jonniegodes thanks done.

@jonniebigodes
Copy link
Contributor

All good on my end. @cabbiepete thanks for the follow-up on this and willingness to address the feedback so promptly. Appreciate it. Going to merge this.

Have a great weekend!

Stay safe

@jonniebigodes jonniebigodes merged commit 9909f9a into storybookjs:next Jan 21, 2022
@shilman shilman added the patch:done Patch/release PRs already cherry-picked to main/release branch label Jan 28, 2022
shilman pushed a commit that referenced this pull request Jan 28, 2022
Gotcha about chromatic publish not working
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation patch:done Patch/release PRs already cherry-picked to main/release branch patch:yes Bugfix & documentation PR that need to be picked to main branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants