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

Populate pulumi:template tag also for interactively selected templates #16308

Merged
merged 2 commits into from
Jun 3, 2024

Conversation

mikhailshilkov
Copy link
Member

Description

The following lines are added to Pulumi.yaml after a pulumi new command:

config:
  pulumi:tags:
    value:
      pulumi:template: alicloud-fsharp

where pulumi:template points to a name or a URL of the template that was used for project instantiation.

The problem is that this currently works only if the template name is specified as a CLI argument, not selected interactively. This PR fixes the field population for the interactive case by using template.Name for the tag value, not just the input argument.

Fixes #16037

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

@mikhailshilkov mikhailshilkov requested a review from a team as a code owner June 3, 2024 12:45
@pulumi-bot
Copy link
Contributor

Changelog

[uncommitted] (2024-06-03)

Bug Fixes

  • [cli/new] Populate pulumi:template tag also for interactively selected templates
    #16308

@@ -201,7 +204,7 @@ func runNew(ctx context.Context, args newArgs) error {
} else if len(templates) == 1 {
template = templates[0]
} else {
if template, err = chooseTemplate(templates, opts); err != nil {
if template, err = args.chooseTemplate(templates, opts); err != nil {
Copy link
Member Author

Choose a reason for hiding this comment

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

This is a slightly terrifying change in terms of a potential nil reference panic. I think I checked and it should be fine - but may I ask the reviewer to double-check that we'll never pass nil here from the CLI binary (not tests)?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, I can't find any instances other than newNewCmd.

@mikhailshilkov mikhailshilkov added this pull request to the merge queue Jun 3, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jun 3, 2024
@mikhailshilkov mikhailshilkov added this pull request to the merge queue Jun 3, 2024
Merged via the queue into master with commit 556ce54 Jun 3, 2024
50 checks passed
@mikhailshilkov mikhailshilkov deleted the mikhailshilkov/template-tag branch June 3, 2024 20:39
This was referenced Jun 5, 2024
github-merge-queue bot pushed a commit that referenced this pull request Jun 5, 2024
Planning to include #16322.

Other than that, tentative changelog:

### Features

- [auto/{go,nodejs,python}] Add support for `--all` parameter of the
`stack ls` command to the Automation API
  [#16266](#16266)


### Bug Fixes

- [cli/new] Populate pulumi:template tag also for interactively selected
templates
  [#16308](#16308)

- [backend/service] Improve error reporting when policy pack download
fails
  [#16306](#16306)


### Miscellaneous

- [sdk/python] Move dependency installation and python command
invocation to Toolchain interface
  [#16243](#16243)
github-merge-queue bot pushed a commit that referenced this pull request Jun 5, 2024
To be merged after #16322 and
#16323

Tentative changelog:

### Features

- [auto/{go,nodejs,python}] Add support for `--all` parameter of the
`stack ls` command to the Automation API
  [#16266](#16266)


### Bug Fixes

- [cli/new] Populate pulumi:template tag also for interactively selected
templates
  [#16308](#16308)

- [backend/service] Improve error reporting when policy pack download
fails
  [#16306](#16306)


### Miscellaneous

- [sdk/python] Move dependency installation and python command
invocation to Toolchain interface
  [#16243](#16243)
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.

pulumi:template tag in Pulumi.yaml is blank for new projects created from template
3 participants