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

Add wildcard for --target and family #8883

Merged
merged 6 commits into from
Feb 1, 2022

Conversation

iwahbe
Copy link
Member

@iwahbe iwahbe commented Jan 31, 2022

Description

Fixes #5870

Checklist

  • I have added tests that prove my fix is effective or that my feature works
  • Yes, there are changes in this PR that warrants bumping the Pulumi Service API version

@iwahbe iwahbe self-assigned this Jan 31, 2022
@iwahbe iwahbe requested review from t0yv0 and Frassle January 31, 2022 17:05
@codecov
Copy link

codecov bot commented Jan 31, 2022

Codecov Report

Merging #8883 (1a133df) into master (8ffac5c) will decrease coverage by 15.03%.
The diff coverage is 59.09%.

Impacted file tree graph

@@             Coverage Diff             @@
##           master    #8883       +/-   ##
===========================================
- Coverage   59.33%   44.30%   -15.04%     
===========================================
  Files         641      634        -7     
  Lines       99407    97211     -2196     
  Branches     1389     1389               
===========================================
- Hits        58986    43065    -15921     
- Misses      37056    51158    +14102     
+ Partials     3365     2988      -377     
Impacted Files Coverage Δ
pkg/cmd/pulumi/up.go 49.43% <22.72%> (-0.86%) ⬇️
pkg/cmd/pulumi/destroy.go 65.77% <23.07%> (-1.81%) ⬇️
pkg/resource/deploy/snapshot.go 71.90% <100.00%> (+6.34%) ⬆️
pkg/codegen/docs.go 0.00% <0.00%> (-100.00%) ⬇️
pkg/codegen/go/gen_spill.go 0.00% <0.00%> (-100.00%) ⬇️
pkg/codegen/dotnet/templates.go 0.00% <0.00%> (-100.00%) ⬇️
pkg/codegen/hcl2/model/format/func.go 0.00% <0.00%> (-100.00%) ⬇️
pkg/codegen/go/gen_program_optionals.go 0.00% <0.00%> (-94.21%) ⬇️
pkg/codegen/dotnet/gen_program.go 0.00% <0.00%> (-90.03%) ⬇️
pkg/codegen/go/utilities.go 0.00% <0.00%> (-90.00%) ⬇️
... and 131 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8ffac5c...1a133df. Read the comment docs.

pkg/resource/deploy/snapshot.go Outdated Show resolved Hide resolved
pkg/cmd/pulumi/destroy.go Show resolved Hide resolved
// in the snapshot. URNs are returned in sorted order. All returned urns are unique.
func (snap *Snapshot) GlobUrn(urn resource.URN) []resource.URN {
if !strings.Contains(string(urn), "*") {
return []resource.URN{urn}
Copy link
Member

Choose a reason for hiding this comment

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

This case is bit weird. I think the weirdness comes from GlobUrn combining two distinct pieces of functionality - filtering snap.Resources and matching against a pattern. This clause returns urn even if it's not mentioned in snap.Resources. You would think that the return values []resource.URN are always a subset so this may be a little surprising. I'm guessing this is exactly what you want at the call sites but it's not obvious in the func itself.

Copy link
Member

Choose a reason for hiding this comment

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

I actually think it would be fine for it to do that here. I don't think we have anything to tell the user "you targeted X for update but it wasn't found"

Copy link
Member Author

Choose a reason for hiding this comment

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

It's also how a normal glob function works (for example, in sh). Expanding an argument with no wild cards returns that argument, even if the argument is not a valid path.

$ echo *.txt
real_file.txt
$ echo fake.txt
fake.txt

@iwahbe iwahbe merged commit 73047e1 into master Feb 1, 2022
@pulumi-bot pulumi-bot deleted the iwahbe/5870/wildcard-for-target-urn branch February 1, 2022 20:11
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 up --target wildcard urn support
3 participants