Score:0

jenkins job to deploy latest version in new env, using the deployed version

br flag

I have a jenkins job with multiple applications, each with 4 environment namely DEV, TEST,QA and PROD. I am using ansible playbook to deploy the artifact in each environment. I have deployed an artifact with versions 1.0.0, 1.0.1, 1.0.2 in Dev environment using a shell command as

ansible-playbook artifact.yml -i jenkins/environments/$(env_name} --extra-vars= version_number=${artifact_version_number} where env_name and artifact_version_number are passed as parameters in jenkins job.

I need to create another job where the job needs to pick up the last version which has been passed from parameters of Jenkins job that is 1.0.2 from DEV and deploy in TEST environment.

Is there any possible groovy script or ansible script to do so to deploy through jenkins job. Help on these scripts is appreciated.

Thanks in advance.

jp flag
When the job successfully deploys to an environment, have it write the version deployed to that environment to a file. Leave the file somewhere where it can be read from other jobs, or upload the file to Jenkins' artifact store. Then other jobs can read the most recently deployed version for a particular environment from that file.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.