I have a groovy file, I want to run from the Jenkinsfile.
ie. load script.groovy
However, I am not sure how I can reference this file if it is store
if this script.groovy file is in the root of your project, like the Jenkinsfile, it will be fetched from git into the same folder as your Jenkinsfile. So the command you are using should work OK.
Are you getting some error? Please provide more details if so.
EDIT: now I can see what's in your Jenkinsfile, I can see you are checking out a git project called integration_bus which is where the groovy script resides. You can specify the location where that is checked out like this:
checkout([$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: 'esb_deploy']], submoduleCfg: [], userRemoteConfigs: [[url: 'ssh://git@giturl/integration_bus.git']]])
as opposed to what you have
git branch: branch, url: 'ssh://git@giturl/integration_bus.git'
Then you should be able to reference the groovy script in the esb_deploy folder like this
load 'esb_deploy/esb_deploybar_pipeline/deploy_esb.groovy'