Is it possible to pass puppet resource references to other resources? My use-case is to build a jenkins build pipeline with puppet. To chain jenkins jobs into a pipeline I need to pass the successor job to a job. A subset of the definition is:
jobs::build { "Build ${release_name}":
release => $release_name,
jenkins_jobs_path => $jenkins_jobs_path,
successors => 'Deploy',
}
jobs::deploy { "Deploy ${release_name}":
release => $release_name,
jenkins_jobs_path => $jenkins_jobs_path,
successors => 'Smoke Test',
}
In the def you see that I define the successors by name, i.e. 'Deploy' and in case of the second job 'Smoke Test'. What I'd like to do is to pass a reference to a resource and extract the name from it:
jobs::build { "Build ${release_name}":
release => $release_name,
jenkins_jobs_path => $jenkins_jobs_path,
successors => Jobs::Deploy["Deploy ${release_name}"],
}
jobs::deploy { "Deploy ${release_name}":
release => $release_name,
jenkins_jobs_path => $jenkins_jobs_path,
successors => Jobs::Smoke_test["Smoke Test ${release_name}"],
}
And then within the jobs::deploy and jobs::build definition I'd access the resource by reference and query for it's type, etc..
Is it possible to achieve this in puppet?