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

Don't allow stacks with the wrong project name in filestate #12033

Merged
merged 1 commit into from
Feb 1, 2023

Conversation

Frassle
Copy link
Member

@Frassle Frassle commented Jan 31, 2023

Description

Fixes filestate to check that stacks with projects in their name match the current project, same as what httpstate does.

Checklist

  • I have added tests that prove my fix is effective or that my feature works
  • I have run make changelog and committed the changelog/pending/<file> documenting my change - Filestate projects aren't released yet, so this change is user facing compared to the first PR that added support for these.
  • Yes, there are changes in this PR that warrants bumping the Pulumi Service API version

@Frassle Frassle added the impact/no-changelog-required This issue doesn't require a CHANGELOG update label Jan 31, 2023
@pulumi-bot
Copy link
Contributor

pulumi-bot commented Jan 31, 2023

Changelog

[uncommitted] (2023-02-01)

@Frassle Frassle force-pushed the fraser/fixLocalProjectCheck branch 6 times, most recently from 3777422 to 434628c Compare February 1, 2023 13:50
Copy link
Member

@justinvp justinvp left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -541,27 +542,57 @@ func TestProjectFolderStructure(t *testing.T) {
assert.FileExists(t, path.Join(tmpDir, ".pulumi", "stacks", "testproj", "b.json"))
}

func TestCanRenameStack(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

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

Should we keep a test of rename?

Copy link
Member Author

Choose a reason for hiding this comment

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

herp yes we should not sure how I managed that.

@Frassle
Copy link
Member Author

Frassle commented Feb 1, 2023

bors merge

@bors
Copy link
Contributor

bors bot commented Feb 1, 2023

🕐 Waiting for PR status (GitHub check) to be set, probably by CI. Bors will automatically try to run when all required PR statuses are set.

bors bot added a commit that referenced this pull request Feb 1, 2023
12033: Don't allow stacks with the wrong project name in filestate r=Frassle 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. -->

Fixes filestate to check that stacks with projects in their name match the current project, same as what httpstate does.

## Checklist

<!--- Please provide details if the checkbox below is to be left unchecked. -->
- [x] 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 - Filestate projects aren't released yet, so this change is user facing compared to the first PR that added support for these.
<!--
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>
Copy link
Contributor

@abhinav abhinav left a comment

Choose a reason for hiding this comment

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

I'll admit that I'm not as familiar with the codebase, but this feels like an abstraction leak. My gut says that the state backend should not have access to "current directory". That'll especially be a problem if/when we do plugin backends that run in separate processes.

All that said, this is fine since httpstate is also doing this, so if that boundary does exist, we'll have to refactor to enforce it anyway.

@bors
Copy link
Contributor

bors bot commented Feb 1, 2023

Timed out.

@justinvp
Copy link
Member

justinvp commented Feb 1, 2023

The CI / build binaries (darwin, arm64, macos-11) / darwin-arm64 job's Run actions/setup-go@v3 step is stuck for over 2.5 hours, writing lines like: Received 556258799 of 560453103 (99.3%), 0.1 MBs/sec. Gonna retry.

@justinvp
Copy link
Member

justinvp commented Feb 1, 2023

bors retry

@bors
Copy link
Contributor

bors bot commented Feb 1, 2023

Build succeeded:

@bors bors bot merged commit 486b364 into master Feb 1, 2023
@bors bors bot deleted the fraser/fixLocalProjectCheck branch February 1, 2023 19:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
impact/no-changelog-required This issue doesn't require a CHANGELOG update
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants