forcedotcom/sfdx-scanner

[BUG] canner command not picking up files under ".folder" like ".jenkins"

Yogesh-Tiwari opened this issue · 8 comments

Description:

  • When running the command sf scanner run -t "./**/*.cls" for the jenkins job's workspace folder for a PR raised gives error:
    "The specified target wasn't processed by any engines. Use the --engine parameter to select a different engine or specify a different target. Specified target: ./**/*.cls" and no files are scanned even if the .cls files are present in the job's workspace.
  • The same command when run in the actual sfdx project folder it works fine and the classes scan result is shown in console.

Details:

  • Operating System. Example: Windows 11
  • sf scanner plugin version: 3.24.0
  • Salesforce CLI version: @salesforce/cli/2.38.7

Did you instead mean to do
sf scanner run -t "./**/*.cls"
?

Hi @stephen-carter-at-sf yes I am trying to run the same command.

@Yogesh-Tiwari
Oh I see the markdown in github is removing what you typed visually. Are you calling this from a jenkinsFile or something? If so, can you show me the code where you actually make this call.

Also, can you confirm that the environment that you are running this from in jenkins has your files actually checked out. Doing an ls or something first may help you confirm it in the logs.

OK, we were finally able to reproduce this and get to the bottom of things.

The issue is that inside of a jenkins environment, all of your files are being placed underneith a parent directory called .jenkins. In fact we are finding that if the files you want to scan live under any .folder then these files are hidden to our scanner when it comes to discovery of files.

We will try our best to find a solution to this. In the meantime, maybe you can move your files into a temporary folder on the machine that doesn't live underneith a .jenkins folder and run your scan from there, and then move the output file back into the target directory. I know this workaroudn isn't elegant - so we'll keep you updated on whether or not we can fix this asap.

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

We are hoping to submit a patch release by 4.3.1 tomorrow evening which will fix this so that it unblocks all jenkins users.

Ended up shipping as 4.3.2 actually... but is the latest. So you should be able to do a sf plugins install @salesforce/sfdx-scanner to get this change as the latest.

Thanks for the update @stephen-carter-at-sf.