Equivalent of GitLab's "before_script" for Jenkins?
You can use the Jenkins provided step dir() which changes the directory to one relative to the Jenkins env.WORKSPACE (/var/lib/jenkins/workspace/JOB_NAME by default).

stage('Build') { 
    steps {
        dir('path/to/dir') {
            // do stuff
        }

        dir('path/to/other/dir') {
            // do other stuff
        }
    }
}