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

Wr/delete custom labels #613

Merged
merged 20 commits into from
May 18, 2023
Merged

Wr/delete custom labels #613

merged 20 commits into from
May 18, 2023

Conversation

WillieRuemmele
Copy link
Contributor

What does this PR do?

when a single CL is specified for delete, only delete that label from the CLs file

What issues does this PR fix or reference?

@W-13167950@
forcedotcom/cli#2118

@@ -355,7 +355,19 @@ export class Source extends SfCommand<DeleteSourceJson> {
}
}
if (component.xml) {
promises.push(fsPromises.unlink(component.xml));
Copy link
Contributor

Choose a reason for hiding this comment

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

for every custom label in the CS, this calls STL.deleteCustomLabels on every label in the set.

Some of those are going to be targeted multiple times?

Maybe you want to do that filter of labels once at the top of the method rather than inside the per-component loop

@mshanemc
Copy link
Contributor

QA: turned Willie's STL PR into 3.2.0-beta.1 for local testing

using the sfdx-delete-customlabel repo, sf project deploy start

source delete

✅ can delete one label via sf project delete source --metadata CustomLabel:KeepMe2 --track-source
👎🏻 I don't think this is true now for Labels. I don't expect you to delete the file.

This operation will delete the following files on your computer and in your org:
/Users/shane.mclaughlin/eng/repros/sfdx-delete-customlabel/force-app/main/default/labels/CustomLabels.labels-meta.xml

✅👎🏻 error when deleting something fictitious. Expected our usual red Error: blah stuff, and something about why, maybe?

Screenshot 2023-05-12 at 1 35 35 PM 👎🏻 and did you really update source tracking?

2 labels remain in the file, and I say to delete one of them, and then make up something else to delete.
✅ nothing is deleted.

✅ when I delete both remaining labels, the file disappears


project deploy/retrieve stuff

I put the labels back in the org.
✅ delete label in org, looks fine locally after retrieve (pull-like)
✅ when I delete all the labels from the org, the file deletes.

I put the labels back in the local project and the org.
remove 1 label from the local file
❌ project deploy start (like a push)

It gives the output that seems correct, but the label is still in the org

| State     Name         Type         Path                                                       
| ───────── ──────────── ──────────── ────────────────────────────────────────────────────────── 
| Unchanged KeepMe1      CustomLabel  force-app/main/default/labels/CustomLabels.labels-meta.xml 
| Unchanged KeepMe2      CustomLabel  force-app/main/default/labels/CustomLabels.labels-meta.xml 
| Unchanged CustomLabels CustomLabels force-app/main/default/labels/CustomLabels.labels-meta.xml 

If you restore the label locally and deploy again, it notices the change correctly and the re-added label is in the output.

📓 Not tested: multiple directory scenarios

@mshanemc
Copy link
Contributor

QA notes:

retested using https://github.com/forcedotcom/source-tracking/pull/388/files and the corresponding change for PDR.

👍🏻 output messages are good
✅ successfully deleted 1 and multiple labels from local file and verified deletion in org

Note: this set of PRs does not modify the behavior of push so that it stays consistent with source:deploy and underlying metadata api behavior expectations.

@mshanemc mshanemc merged commit b9edd15 into main May 18, 2023
@mshanemc mshanemc deleted the wr/deleteCustomLabels branch May 18, 2023 22: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.

2 participants