We have a build job that clones the git repository and the builds it using maven to generate a jar file. We then trigger a separate deployment job to copy that jar and then deploy it using come script to AWS through cloudformation.
However, that deployment code has now been added to the git repository itself, and we would like to have those scripts get copied (first archived) to the deployment job so that we can cut down on the amount of script be keep carrying around.
Is there a way to archive the cloned repository along with the generated jar? If yes, then how to get (copy) the entire folder (workspace for a particular build) to a different job?
This is what I am using in the deployment job to get the jars:
copyArtifacts(projectName: 'my-demo-build-job/master', selector: specific(params.buildnumber))
However, I only get the jars and not the cloned repository source code with this and I guess that's because the source code is discarded (not archive) in the build job.