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 save empty config values to the config file in new #13233

Merged
merged 1 commit into from
Jun 22, 2023

Conversation

Frassle
Copy link
Member

@Frassle Frassle commented Jun 21, 2023

Description

Fixes #4081

Also plumbs the prompt function down to promptForConfig so this can be tested.

Checklist

  • I have run make tidy to update any new dependencies
  • I have run make lint to verify my code passes the lint check
    • I have formatted my code using gofumpt
  • 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
  • Yes, there are changes in this PR that warrants bumping the Pulumi Cloud API version

@Frassle Frassle requested a review from a team June 21, 2023 19:58
@pulumi-bot
Copy link
Contributor

pulumi-bot commented Jun 21, 2023

Changelog

[uncommitted] (2023-06-22)

Bug Fixes

  • [cli/new] Fix empty config values being added to the config file as part of new.
    #13233

pkg/cmd/pulumi/new_test.go Outdated Show resolved Hide resolved
Fixes #4081

Also plumbs the prompt function down to `promptForConfig` so this can be
tested.
@Frassle
Copy link
Member Author

Frassle commented Jun 22, 2023

bors merge

@bors
Copy link
Contributor

bors bot commented Jun 22, 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 Jun 22, 2023
13233: Don't save empty config values to the config file in new 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 #4081

Also plumbs the prompt function down to `promptForConfig` so this can be tested.


## Checklist

- [x] I have run `make tidy` to update any new dependencies
- [x] I have run `make lint` to verify my code passes the lint check
  - [ ] I have formatted my code using `gofumpt`

<!--- 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.
-->
- [x] 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 Cloud,
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 Cloud API version
  <!-- `@Pulumi` employees: If yes, you must submit corresponding changes in the service repo. -->


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

bors bot commented Jun 22, 2023

Build failed:

@Frassle
Copy link
Member Author

Frassle commented Jun 22, 2023

bors retry

bors bot added a commit that referenced this pull request Jun 22, 2023
13233: Don't save empty config values to the config file in new 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 #4081

Also plumbs the prompt function down to `promptForConfig` so this can be tested.


## Checklist

- [x] I have run `make tidy` to update any new dependencies
- [x] I have run `make lint` to verify my code passes the lint check
  - [ ] I have formatted my code using `gofumpt`

<!--- 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.
-->
- [x] 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 Cloud,
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 Cloud API version
  <!-- `@Pulumi` employees: If yes, you must submit corresponding changes in the service repo. -->


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

bors bot commented Jun 22, 2023

Build failed:

@Frassle
Copy link
Member Author

Frassle commented Jun 22, 2023

windows test failed to upload artifacts

bors retry

@bors
Copy link
Contributor

bors bot commented Jun 22, 2023

Build succeeded!

The publicly hosted instance of bors-ng is deprecated and will go away soon.

If you want to self-host your own instance, instructions are here.
For more help, visit the forum.

If you want to switch to GitHub's built-in merge queue, visit their help page.

@bors bors bot merged commit e8b7a9b into master Jun 22, 2023
42 checks passed
@bors bors bot deleted the fraser/fixEmptyNew branch June 22, 2023 11:27
vanbasten17 pushed a commit to hubtype/botonic that referenced this pull request Aug 5, 2023
<p>This PR was automatically created by Snyk using the credentials of a
real user.</p><br /><h3>Snyk has created this PR to upgrade
@pulumi/pulumi from 3.72.2 to 3.73.0.</h3>

:information_source: Keep your dependencies up-to-date. This makes it
easier to fix existing vulnerabilities and to more quickly identify and
fix newly disclosed vulnerabilities when they affect your project.
<hr/>

- The recommended version is **1 version** ahead of your current
version.
- The recommended version was released **a month ago**, on 2023-06-22.


<details>
<summary><b>Release notes</b></summary>
<br/>
  <details>
    <summary>Package name: <b>@pulumi/pulumi</b></summary>
    <ul>
      <li>
<b>3.73.0</b> - <a
href="https://snyk.io/redirect/github/pulumi/pulumi/releases/tag/v3.73.0">2023-06-22</a></br><h2>3.73.0
(2023-06-22)</h2>
<h3>Features</h3>
<ul>
<li>[programgen] Allow traversing unknown properties from resources when
skipping resource type checking<br>
<a href="https://snyk.io/redirect/github/pulumi/pulumi/pull/13180"
data-hovercard-type="pull_request"
data-hovercard-url="/pulumi/pulumi/pull/13180/hovercard">#13180</a></li>
</ul>
<h3>Bug Fixes</h3>
<ul>
<li>
<p>[backend/filestate] Fix auto-opt-in to project mode.<br>
<a href="https://snyk.io/redirect/github/pulumi/pulumi/pull/13243"
data-hovercard-type="pull_request"
data-hovercard-url="/pulumi/pulumi/pull/13243/hovercard">#13243</a></p>
</li>
<li>
<p>[cli] <code>pulumi convert</code> will now cleanup temporary
pulumi-convert directories when the command is finished.<br>
<a href="https://snyk.io/redirect/github/pulumi/pulumi/pull/13185"
data-hovercard-type="pull_request"
data-hovercard-url="/pulumi/pulumi/pull/13185/hovercard">#13185</a></p>
</li>
<li>
<p>[cli] Fix Markdown formatting issues in command usage.<br>
<a href="https://snyk.io/redirect/github/pulumi/pulumi/pull/13225"
data-hovercard-type="pull_request"
data-hovercard-url="/pulumi/pulumi/pull/13225/hovercard">#13225</a></p>
</li>
<li>
<p>[cli] Fix <code>stack rm</code> removing config files for the wrong
project.<br>
<a href="https://snyk.io/redirect/github/pulumi/pulumi/pull/13227"
data-hovercard-type="pull_request"
data-hovercard-url="/pulumi/pulumi/pull/13227/hovercard">#13227</a></p>
</li>
<li>
<p>[cli/config] No longer error on directory read permissions when
searching for project files.<br>
<a href="https://snyk.io/redirect/github/pulumi/pulumi/pull/13211"
data-hovercard-type="pull_request"
data-hovercard-url="/pulumi/pulumi/pull/13211/hovercard">#13211</a></p>
</li>
<li>
<p>[cli/display] Fix diff display partially parsing JSON/YAML from
strings.</p>
</li>
<li>
<p>[cli/display] Fix large integers displaying in scientific
notation.<br>
<a href="https://snyk.io/redirect/github/pulumi/pulumi/pull/13209"
data-hovercard-type="pull_request"
data-hovercard-url="/pulumi/pulumi/pull/13209/hovercard">#13209</a></p>
</li>
<li>
<p>[cli/display] Update summary is now correctly shown when
<code>advisory</code> and <code>disabled</code> policy events are
encountered.<br>
<a href="https://snyk.io/redirect/github/pulumi/pulumi/pull/13218"
data-hovercard-type="pull_request"
data-hovercard-url="/pulumi/pulumi/pull/13218/hovercard">#13218</a></p>
</li>
<li>
<p>[cli/display] Fix formatting bugs in display causing text like
(MISSING) showing in output.<br>
<a href="https://snyk.io/redirect/github/pulumi/pulumi/pull/13228"
data-hovercard-type="pull_request"
data-hovercard-url="/pulumi/pulumi/pull/13228/hovercard">#13228</a></p>
</li>
<li>
<p>[cli/display] On Windows, make <code>pulumi state unprotect</code>
command suggestion use double-quotes instead of single-quotes.<br>
<a href="https://snyk.io/redirect/github/pulumi/pulumi/pull/13236"
data-hovercard-type="pull_request"
data-hovercard-url="/pulumi/pulumi/pull/13236/hovercard">#13236</a></p>
</li>
<li>
<p>[cli/new] <code>pulumi new</code> now correctly supports numeric
stack names.<br>
<a href="https://snyk.io/redirect/github/pulumi/pulumi/pull/13220"
data-hovercard-type="pull_request"
data-hovercard-url="/pulumi/pulumi/pull/13220/hovercard">#13220</a></p>
</li>
<li>
<p>[cli/new] Fix empty config values being added to the config file as
part of <code>new</code>.<br>
<a href="https://snyk.io/redirect/github/pulumi/pulumi/pull/13233"
data-hovercard-type="pull_request"
data-hovercard-url="/pulumi/pulumi/pull/13233/hovercard">#13233</a></p>
</li>
<li>
<p>[cli/plugin] Fixes the output of plugin rm --yes command to
explicitly say that plugins were removed<br>
<a href="https://snyk.io/redirect/github/pulumi/pulumi/pull/13216"
data-hovercard-type="pull_request"
data-hovercard-url="/pulumi/pulumi/pull/13216/hovercard">#13216</a></p>
</li>
<li>
<p>[engine] Fix wildcards in IgnoreChanges.<br>
<a href="https://snyk.io/redirect/github/pulumi/pulumi/pull/13005"
data-hovercard-type="pull_request"
data-hovercard-url="/pulumi/pulumi/pull/13005/hovercard">#13005</a></p>
</li>
<li>
<p>[engine] Fix ignoreChanges setting ignore array indexes to zero.<br>
<a href="https://snyk.io/redirect/github/pulumi/pulumi/pull/13005"
data-hovercard-type="pull_request"
data-hovercard-url="/pulumi/pulumi/pull/13005/hovercard">#13005</a></p>
</li>
<li>
<p>[sdk/nodejs] Write port to stdout as a string so Node doesn't
colorize the output<br>
<a href="https://snyk.io/redirect/github/pulumi/pulumi/pull/13204"
data-hovercard-type="pull_request"
data-hovercard-url="/pulumi/pulumi/pull/13204/hovercard">#13204</a></p>
</li>
<li>
<p>[sdk/python] Allow tuples as Sequence input values to resources.<br>
<a href="https://snyk.io/redirect/github/pulumi/pulumi/pull/13210"
data-hovercard-type="pull_request"
data-hovercard-url="/pulumi/pulumi/pull/13210/hovercard">#13210</a></p>
</li>
<li>
<p>[sdkgen/python] Python SDK only prints a Function Invoke result's
deprecation messages when using getters rather than on
instantiation.<br>
<a href="https://snyk.io/redirect/github/pulumi/pulumi/pull/13213"
data-hovercard-type="pull_request"
data-hovercard-url="/pulumi/pulumi/pull/13213/hovercard">#13213</a></p>
</li>
</ul>
<h3>Miscellaneous</h3>
<ul>
<li>[cli] Make no retry attempts for the Pulumi new version query. This
should speed up the CLI in certain environments.<br>
<a href="https://snyk.io/redirect/github/pulumi/pulumi/pull/13215"
data-hovercard-type="pull_request"
data-hovercard-url="/pulumi/pulumi/pull/13215/hovercard">#13215</a></li>
</ul>
      </li>
      <li>
<b>3.72.2</b> - <a
href="https://snyk.io/redirect/github/pulumi/pulumi/releases/tag/v3.72.2">2023-06-17</a></br><h2>3.72.2
(2023-06-17)</h2>
<h3>Bug Fixes</h3>
<ul>
<li>[cli/state] Fix panic caused by an invalid stack when a parent
resource is renamed in the state. Now, parent references are also
updated when the resource is renamed.<br>
<a href="https://snyk.io/redirect/github/pulumi/pulumi/pull/13190"
data-hovercard-type="pull_request"
data-hovercard-url="/pulumi/pulumi/pull/13190/hovercard">#13190</a></li>
</ul>
      </li>
    </ul>
from <a
href="https://snyk.io/redirect/github/pulumi/pulumi/releases">@pulumi/pulumi
GitHub release notes</a>
  </details>
</details>
<hr/>

**Note:** *You are seeing this because you or someone else with access
to this repository has authorized Snyk to open upgrade PRs.*

For more information: <img
src="https://api.segment.io/v1/pixel/track?data=eyJ3cml0ZUtleSI6InJyWmxZcEdHY2RyTHZsb0lYd0dUcVg4WkFRTnNCOUEwIiwiYW5vbnltb3VzSWQiOiIwMDFkOTk2NC1iZTkyLTQ1NDktYjk5Yi03OTRjMThiZWYwM2QiLCJldmVudCI6IlBSIHZpZXdlZCIsInByb3BlcnRpZXMiOnsicHJJZCI6IjAwMWQ5OTY0LWJlOTItNDU0OS1iOTliLTc5NGMxOGJlZjAzZCJ9fQ=="
width="0" height="0"/>

🧐 [View latest project
report](https://app.snyk.io/org/manuelfidalgo/project/1e476a2c-f968-4574-8a48-a93a0982eecc?utm_source&#x3D;github&amp;utm_medium&#x3D;referral&amp;page&#x3D;upgrade-pr)

🛠 [Adjust upgrade PR
settings](https://app.snyk.io/org/manuelfidalgo/project/1e476a2c-f968-4574-8a48-a93a0982eecc/settings/integration?utm_source&#x3D;github&amp;utm_medium&#x3D;referral&amp;page&#x3D;upgrade-pr)

🔕 [Ignore this dependency or unsubscribe from future upgrade
PRs](https://app.snyk.io/org/manuelfidalgo/project/1e476a2c-f968-4574-8a48-a93a0982eecc/settings/integration?pkg&#x3D;@pulumi/pulumi&amp;utm_source&#x3D;github&amp;utm_medium&#x3D;referral&amp;page&#x3D;upgrade-pr#auto-dep-upgrades)

<!---
(snyk:metadata:{"prId":"001d9964-be92-4549-b99b-794c18bef03d","prPublicId":"001d9964-be92-4549-b99b-794c18bef03d","dependencies":[{"name":"@pulumi/pulumi","from":"3.72.2","to":"3.73.0"}],"packageManager":"npm","type":"auto","projectUrl":"https://app.snyk.io/org/manuelfidalgo/project/1e476a2c-f968-4574-8a48-a93a0982eecc?utm_source=github&utm_medium=referral&page=upgrade-pr","projectPublicId":"1e476a2c-f968-4574-8a48-a93a0982eecc","env":"prod","prType":"upgrade","vulns":[],"issuesToFix":[],"upgrade":[],"upgradeInfo":{"versionsDiff":1,"publishedDate":"2023-06-22T21:46:48.423Z"},"templateVariants":[],"hasFixes":false,"isMajorUpgrade":false,"isBreakingChange":false,"priorityScoreList":[]})
--->

Co-authored-by: snyk-bot <snyk-bot@snyk.io>
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.

Empty config values during 'pulumi new' lead to ""s
3 participants