How can I stop my Pipeline Workspace to use an empty folder?

It’s been a while since I used Jenkins Pipeline and back then you could run and edit a Pipeline script in Jenkins. Now it’s seems you can only get it from source control.

When I do that it will pull my whole project and then run the jenkins script. But everything is run in a seperate folder which is empty. If I specify a Custom Workspace, it will not sync my repository in that Custom Workspace and instead still uses the generated Workspace within the .jenkins folder and after checkout it will switch to the custom workspace and fail running anything because the Custom Workspace is empty.

I mean it makes sense that the Pipeline doesn’t know about the Custom Workspace since it needs to sync with the whole repository first to then read in the jenkinsfile where the Custom Workspace is. Why can’t I specify the custom workspace directly in the Pipeline before checkout?

I’m open for a different approuch, I just don’t get how Jenkins pipeline is now supposed to be used.
What is the workflow with Jenkins pipeline?
Having a seperate repository with the Jenkinsfile which gets checkouted and in the Jenkinsfile we switch to a custom workspace which then Checkouts to the second Project Repository?

Note: In my Pipeline → Branch Sources I use “Single Repository & Branch” with Perforce Software.

Okay, what I did was to checkout only the Jenkins file in the Pipeline configuration, and in my Jenkinsfile, I do another checkout which checkouts the full project within a Custom Workspace.