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

pulumi new hitting error: cloning templates repo: worktree contains unstaged changes #11121

Closed
lukehoban opened this issue Oct 22, 2022 · 11 comments · Fixed by #11175
Closed
Labels
impact/regression Something that used to work, but is now broken kind/bug Some behavior is incorrect or out of spec p1 Bugs severe enough to be the next item assigned to an engineer resolution/fixed This issue was fixed

Comments

@lukehoban
Copy link
Member

Several users have reported seeing this occasionally recently. Retrying seems to always work - but we should make sure this does not fail in the first place.

$ pulumi new typescript
error: cloning templates repo: worktree contains unstaged changes
@lukehoban lukehoban added kind/bug Some behavior is incorrect or out of spec p1 Bugs severe enough to be the next item assigned to an engineer needs-triage Needs attention from the triage team impact/regression Something that used to work, but is now broken labels Oct 22, 2022
@Frassle
Copy link
Member

Frassle commented Oct 22, 2022

This might be a go-git issue: go-git/go-git#511

@Frassle
Copy link
Member

Frassle commented Oct 24, 2022

I've been trying to repro this but so far re-cloning the repo or resetting templates to non-head commits isn't triggering it. I've written up #11124 quickly to try and report better errors here, hopefully someone can run that and hit and report the error to give some hints as to what's going on here.

@justinvp
Copy link
Member

Hmm, I just hit this. I then rebuilt with the changes from #11124 and now I'm not seeing the error anymore.

bors bot added a commit that referenced this issue Oct 24, 2022
11117: Airgap sdk gen tests r=iwahbe a=iwahbe

<!--- 
Thanks so much for your contribution! If this is your first time contributing, please ensure that you have read the [CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md) documentation.
-->

# Description

<!--- Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. -->

This PR provides the test host to our sdk generation tests. Previously, we were downloading plugins as needed for external packages.

## Checklist

<!--- Please provide details if the checkbox below is to be left unchecked. -->
- [ ] I have added tests that prove my fix is effective or that my feature works
<!--- 
User-facing changes require a CHANGELOG entry.
-->
- [ ] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the Pulumi Service,
then the service should honor older versions of the CLI where this change would not exist.
You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add
it to the service.
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Service API version
  <!-- `@Pulumi` employees: If yes, you must submit corresponding changes in the service repo. -->


11124: Report unstaged changes from GitCloneOrPull r=justinvp a=Frassle

<!--- 
Thanks so much for your contribution! If this is your first time contributing, please ensure that you have read the [CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md) documentation.
-->

# Description

<!--- Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. -->

To help with #11121

## Checklist

<!--- Please provide details if the checkbox below is to be left unchecked. -->
- [ ] I have added tests that prove my fix is effective or that my feature works
<!--- 
User-facing changes require a CHANGELOG entry.
-->
- [ ] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the Pulumi Service,
then the service should honor older versions of the CLI where this change would not exist.
You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add
it to the service.
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Service API version
  <!-- `@Pulumi` employees: If yes, you must submit corresponding changes in the service repo. -->


Co-authored-by: Ian Wahbe <ian@wahbe.com>
Co-authored-by: Fraser Waters <fraser@pulumi.com>
bors bot added a commit that referenced this issue Oct 24, 2022
11124: Report unstaged changes from GitCloneOrPull r=justinvp a=Frassle

<!--- 
Thanks so much for your contribution! If this is your first time contributing, please ensure that you have read the [CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md) documentation.
-->

# Description

<!--- Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. -->

To help with #11121

## Checklist

<!--- Please provide details if the checkbox below is to be left unchecked. -->
- [ ] I have added tests that prove my fix is effective or that my feature works
<!--- 
User-facing changes require a CHANGELOG entry.
-->
- [ ] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the Pulumi Service,
then the service should honor older versions of the CLI where this change would not exist.
You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add
it to the service.
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Service API version
  <!-- `@Pulumi` employees: If yes, you must submit corresponding changes in the service repo. -->


Co-authored-by: Fraser Waters <fraser@pulumi.com>
@EvanBoyle
Copy link
Contributor

EvanBoyle commented Oct 25, 2022

I just hit this as well. Just ran pulumi new aws-typescript. rerunning fixed it.

@aaronkao
Copy link

aaronkao commented Oct 26, 2022

i just hit this as well and was told to report it here

pulumi new container-aws-python -s aaronkao/deploy-container-aws/dev

@Zaid-Ajaj Zaid-Ajaj removed the needs-triage Needs attention from the triage team label Oct 26, 2022
@justinvp
Copy link
Member

Hit it again. Here's the details:

$ pulumi new aws-typescript
error: cloning templates repo: GitCloneOrPull reported unstaged changes: metadata/dist/metadata.json was D
Please report this to https://github.com/pulumi/pulumi/issues/11121.

@Frassle
Copy link
Member

Frassle commented Oct 26, 2022

metadata/dist/metadata.json

I think some confusion has happened with ignore settings and this file. It looks like "metadata.json" was added to .gitignore, then removed from .gitignore and added to the repository. I wonder if go-git hasn't handled that transition well?

Although that wouldn't explain how @justinvp saw this twice. Could something be deleting this file?

@jkodroff
Copy link
Member

jkodroff commented Oct 26, 2022

Same here:

$ pulumi new aws-python
error: cloning templates repo: GitCloneOrPull reported unstaged changes: metadata/dist/metadata.json was D

@lukehoban lukehoban added the p0 Bugs severe enough to interrupt existing work label Oct 26, 2022
@justinvp
Copy link
Member

justinvp commented Oct 27, 2022

I think some confusion has happened with ignore settings and this file. It looks like "metadata.json" was added to .gitignore, then removed from .gitignore and added to the repository. I wonder if go-git hasn't handled that transition well?

Yes, that appears to be the problem; some issue with go-git not handling this well. It looks like this can happen for anyone who has run pulumi new after it was added to .gitignore on 10/17, and then ran pulumi new again after it was removed from .gitignore and added to the repo on 10/20. At that point your local ~/.pulumi/templates directory will have unstaged changes leading to these errors.

Workaround

For anyone affected by this, you can workaround the problem by simply deleting your ~/.pulumi/templates directory (it'll be re-created the next time you run pulumi new), or by running git reset --hard inside the templates directory.

Fix

We'll work on a fix to the CLI itself that will effectively do the git reset --hard (via go-git).

@justinvp justinvp removed the p0 Bugs severe enough to interrupt existing work label Oct 27, 2022
@justinvp
Copy link
Member

WIP fix: master...justin/gitreset

@jaxxstorm
Copy link
Contributor

I just tried to pull a template and got:

pulumi new azure-typescript
error: cloning templates repo: GitCloneOrPull reported unstaged changes: metadata/dist/metadata.json was D
Please report this to https://github.com/pulumi/pulumi/issues/11121.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
impact/regression Something that used to work, but is now broken kind/bug Some behavior is incorrect or out of spec p1 Bugs severe enough to be the next item assigned to an engineer resolution/fixed This issue was fixed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants