I have a Job-DSL job that starts a pipeline script, but it could be any other job that uses the Git plugin to chekcout its files.
// Job-DSL script used with JCASC
pipelineJob("cgfw-kvm-image-sync") {
definition {
cpsScm {
scm {
git {
remote {
url("ssh://git@somehost.com/somerepo.git")
credentials("git-ssh")
}
branch('main')
}
}
scriptPath("some-pipeline.groovy")
}
}
}
In some-pipeline.groovy
, which is commited in somerepo
, Iād like to use other files than just the pipeline script to do something in the job, e.g.:
// some-pipeline.groovy
node {
stage("stuff") {
sh script: "jq -r '.data' ????/a_file_from_somerepo.json | bash ????/another_file_from_somerepo.sh"
}
}
But the workspace is empty. How do I find the files that were checked out by the Git Plugin and use them?