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

CustomLabels + destructive changes issues during 'sfdx force source deploy' #1977

Closed
Raspikabek opened this issue Mar 3, 2023 · 5 comments
Closed
Labels
bug Issue or pull request that identifies or fixes a bug stale validated Version information for this issue has been validated

Comments

@Raspikabek
Copy link

Summary

CustomLabels not being deployed & causing issues on dependencies when CustomLabels included as part of destructive changes with the command sfdx force source deploy

Does not seem to happen with sfdx force mdapi deploy

Steps To Reproduce:

Repository to reproduce: custom-labels-issue

Option A (auto from pointed repository):

  • Run npm run build (creates Scratch Org > Geneartes manifest > tries to deploy with destructive changes)

Option B (manual):

  • Create a Manifest with the source metadata:
sfdx force source manifest create -p force-app -o temp
  • Deploy the manifest with Destructive Changes:
sfdx force source deploy --manifest temp/package.xml --predestructivechanges destructiveChangesPre.xml --postdestructivechanges ackage.xml --predestructivechanges destructiveChangesPre.xml --postdestructivechanges destructiveChangesPost.xml -g -c -u TARGET_ORG_ALIAS

Expected result

Deployment/Validation succeeds with no issues. I'd expect any label in destructive changes will be deleted and other labels in the repository will be deployed with no issues.

Actual result

The deployment fails due to the Apex class has a reference the a CustomLabel, but seems like the Custom Label is not being deployed due to DestructiveChanges are deleting other custom labels, but seems like is deleting ALL labels. The output of the command is:

=== Deleted Source

 FULL NAME    TYPE         PROJECT PATH                                               
 ──────────── ──────────── ────────────────────────────────────────────────────────── 
 CustomLabels CustomLabels force-app/main/default/labels/CustomLabels.labels-meta.xml 

=== Component Failures [1]

 Type  Name      Problem                                               
 ───── ───────── ───────────────────────────────────────────────────── 
 Error MyBuilder External string does not exist: MyAwesomeLabel (3:16) 

ERROR running force:source:deploy:  Deploy failed. 

System Information

  • Which shell/terminal are you using? (e.g. bash, zsh, powershell 5, powershell 7, cmd.exe, etc.)

Using zsh

  • If you are using sfdx
    • Run sfdx version --verbose --json
  • If you are using sf
    • Run sf version --verbose --json
  • Paste the output here
{
  "cliVersion": "sfdx-cli/7.186.2",
  "architecture": "linux-x64",
  "nodeVersion": "node-v18.13.0",
  "pluginVersions": [
    "@oclif/plugin-autocomplete 1.4.2 (core)",
    "@oclif/plugin-commands 2.2.4 (core)",
    "@oclif/plugin-help 5.2.1 (core)",
    "@oclif/plugin-not-found 2.3.17 (core)",
    "@oclif/plugin-plugins 2.2.4 (core)",
    "@oclif/plugin-search 0.0.11 (core)",
    "@oclif/plugin-update 3.1.0 (core)",
    "@oclif/plugin-version 1.2.1 (core)",
    "@oclif/plugin-warn-if-update-available 2.0.23 (core)",
    "@oclif/plugin-which 2.2.9 (core)",
    "alias 2.1.19 (core)",
    "apex 1.4.3 (core)",
    "auth 2.3.12 (core)",
    "community 2.1.5 (core)",
    "config 1.4.23 (core)",
    "custom-metadata 2.0.16 (core)",
    "data 2.1.22 (core)",
    "generator 2.0.17 (core)",
    "info 2.3.5 (core)",
    "limits 2.2.3 (core)",
    "org 2.2.24 (core)",
    "packaging 1.12.4 (core)",
    "schema 2.2.3 (core)",
    "signups 1.2.12 (core)",
    "source 2.3.16 (core)",
    "telemetry 2.0.7 (core)",
    "templates 55.2.3 (core)",
    "trust 2.3.0 (core)",
    "user 2.2.1 (core)",
    "@salesforce/sfdx-plugin-lwc-test 1.0.1 (core)",
    "@salesforce/sfdx-scanner 3.8.0 (user)",
    "salesforce-alm 54.8.5 (core)",
    "sfdmu 4.26.2 (user)"
  ],
  "osVersion": "Linux 5.15.0-67-generic",
  "shell": "zsh",
  "rootPath": "/home/MYUSERNAME/.local/share/sfdx/client/7.186.2-b2fe485"
}

Additional information

Seems like using mdapi command does not trigger this issue. I've prepared a script npm run mdapi:build that triggers the build with the same metadata + copy/pastes the destructiveChanges files into the metadata folder generated that we use to fire the build.

Initially I though it was something to do from the Salesforce side, but since source fails but mdapi commands work, I thought i worth to mention here.

As soon as CustomLabels is remove from all destructiveChanges the source command works with no issues.

@Raspikabek Raspikabek added the investigating We're actively investigating this issue label Mar 3, 2023
@github-actions
Copy link

github-actions bot commented Mar 3, 2023

Thank you for filing this issue. We appreciate your feedback and will review the issue as soon as possible. Remember, however, that GitHub isn't a mechanism for receiving support under any agreement or SLA. If you require immediate assistance, contact Salesforce Customer Support.

@WillieRuemmele WillieRuemmele added bug Issue or pull request that identifies or fixes a bug and removed investigating We're actively investigating this issue labels Jul 31, 2023
@git2gus
Copy link

git2gus bot commented Jul 31, 2023

This issue has been linked to a new work item: W-13858279

@WillieRuemmele WillieRuemmele added the validated Version information for this issue has been validated label Jul 31, 2023
@WillieRuemmele
Copy link
Member

Hi @Raspikabek - I've looked into this issue and have a few questions...
Once I removed the -g/ --ignorewarnings flag from the command it provided some warnings that some of the files didn't exist, which is correct.

once I created the new apex class and custom label and had them in my org, I was able to delete them and the custom labels using the source command, as well as the mdapi command. Could you update your repo with all the metadata required to complete the operation, and see if the commands will work for you?

@iowillhoit
Copy link
Contributor

@Raspikabek can you please try WillieRuemmele's suggestions and let us know if it resolves this issue? Thanks

@iowillhoit
Copy link
Contributor

Closing as stale. If you are still having problems please open a new Github Issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue or pull request that identifies or fixes a bug stale validated Version information for this issue has been validated
Projects
None yet
Development

No branches or pull requests

3 participants