I managed to get the variables with a script block, but I expected that there would be a way to get to this without breaking into scripting mode.
The variables are available if you don't use the checkout step in the declarative pipeline. The declarative pipeline has an implicit checkout step that happens before the Pipeline executes.
What is a default checkout: where would the pipeline know the url from?
When the Jenkinsfile for the Pipeline is read from SCM, the declarative pipeline uses that URL.
Does withCheckout exist? its referenced in this thread.
No, withCheckout does not exist. It was added to the scm step plugin May 5, 2017 and then removed on May 16, 2017.
Docs send you completely in the wrong direction unfortunately.
Which docs send you in the wrong direction?