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

forceignore doesn't retrieve correctly when using an opt-in style #2404

Closed
aidan-harding opened this issue Aug 11, 2023 · 4 comments
Closed
Labels
bug Issue or pull request that identifies or fixes a bug validated Version information for this issue has been validated

Comments

@aidan-harding
Copy link

Summary

The .forceignore file is supposed to work like a .gitignore, so it should be possible to write an opt-in sort of file like we can in git.

For example, this file would only allow classes:

# First, ignore everything
*

# Now, allow anything that's a directory
!*/

# Then allow anything in the classes directory
!**/classes/**

However, if I use a file like this, retrieve does not work as expected. A new remote class is listed by retrieve preview but won't be retrieved during an actual retrieve.

Steps To Reproduce

No repo required. Just create an empty project and scratch org using the .forceignore file from above.

We can confirm that creating and deploying a class works:

sf apex generate class --name MyClass --output-dir force-app/main/default/classes
sf project deploy start 

As expected, MyClass is created in the scratch org.

Now, open the scratch org and use Dev Console to create a class called RemoteClass. Going back to the CLI:

sf project retrieve preview
No conflicts found.

No files will be deleted.

Will Retrieve [1] files.
 Type      Fullname    Path 
 ───────── ─────────── ──── 
 ApexClass RemoteClass      

Ignored [1] files. These files won't retrieve because they're ignored by your .forceignore file.
 Type    Fullname Path 
 ─────── ──────── ──── 
 Profile Admin         

This is still as expected, so do the retrieve:

sf project retrieve start

Expected result

I would expect RemoteClass to be retrieved, as reported in the preview.

Actual result

Nothing is retrieved:

Retrieving v58.0 metadata from test-3vnmdnapvkxv@example.com using the v58.0 SOAP API
Preparing retrieve request... Succeeded
 ›   Warning: Nothing retrieved

System Information

Using zsh shell on mac.

{
  "cliVersion": "@salesforce/cli/2.3.8",
  "architecture": "darwin-arm64",
  "nodeVersion": "node-v18.15.0",
  "osVersion": "Darwin 22.5.0",
  "shell": "zsh",
  "rootPath": "/usr/local/lib/sf",
  "pluginVersions": [
    "@oclif/plugin-autocomplete 2.3.3 (core)",
    "@oclif/plugin-commands 2.2.21 (core)",
    "@oclif/plugin-help 5.2.15 (core)",
    "@oclif/plugin-not-found 2.3.34 (core)",
    "@oclif/plugin-plugins 3.1.8 (core)",
    "@oclif/plugin-search 0.0.21 (core)",
    "@oclif/plugin-update 3.1.28 (core)",
    "@oclif/plugin-version 1.3.8 (core)",
    "@oclif/plugin-warn-if-update-available 2.0.46 (core)",
    "@oclif/plugin-which 2.2.29 (core)",
    "@salesforce/cli 2.3.8 (core)",
    "apex 2.3.9 (core)",
    "auth 2.8.10 (core)",
    "data 2.5.4 (core)",
    "deploy-retrieve 1.16.5 (core)",
    "info 2.6.35 (core)",
    "limits 2.3.27 (core)",
    "login 1.2.23 (core)",
    "org 2.9.28 (core)",
    "schema 2.3.21 (core)",
    "settings 1.4.21 (core)",
    "sobject 0.1.42 (core)",
    "source 2.10.28 (core)",
    "telemetry 2.2.3 (core)",
    "templates 55.5.7 (core)",
    "trust 2.5.1 (core)",
    "user 2.3.27 (core)"
  ]
}

Additional information

@aidan-harding aidan-harding added the investigating We're actively investigating this issue label Aug 11, 2023
@github-actions
Copy link

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.

@github-actions github-actions bot added the validated Version information for this issue has been validated label Aug 11, 2023
@cristiand391 cristiand391 added bug Issue or pull request that identifies or fixes a bug and removed investigating We're actively investigating this issue labels Aug 15, 2023
@git2gus
Copy link

git2gus bot commented Aug 15, 2023

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

@cristiand391
Copy link
Member

cristiand391 commented Oct 4, 2023

this was fixed in sf v2.10.2:
https://github.com/forcedotcom/cli/tree/main/releasenotes/#2102-sept-27-2023-stable

@aidan-harding you mentioned in cli-friends this also happened in devops center, their PM is aware of this and they should update SDR to include the fix and bump CLI if they are using it (or maybe they already did, pinged them a few weeks ago 😄 )

@aidan-harding
Copy link
Author

Thank you @cristiand391!

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 validated Version information for this issue has been validated
Projects
None yet
Development

No branches or pull requests

2 participants