0

My Jenkins Pipeline has 4 stages as

1. Build> 2. Binaries Deployment to server > 3. Automated testing with the third party application > 4. Upload Binaries to JFrog

Here in the third stage, I do not have control to query for its completion or failure, what I know is testing will take maximum 3hrs to complete. So for every next build I need to check if the first one has completed testing otherwise it would create unnecessary binaries.

Right now I have configured a global variable called TimeStamp in Jenkins Configure. The variable TimeStamp will be used among builds. So for the first build in the third stage, it will be set as a current timeStamp and on trigger of next build it in third stage it would compare the current build timeStamp with the previous build TimeStamp, if it's more than 3hrs executes Automated testing stage else stop the build.

How can I use env variable which I'll set in my build and use it in other builds while triggering my Jenkins file?

Abhaya Ghatkar
  • 322
  • 1
  • 5
  • 22

1 Answers1

0

Here are some of the options you can try:

  1. Archive the artifacts from one build and retrieve it in the future build

    • Store the timestamp in a property file and archive it from build 1
    • Retrieve it in the next builds
  2. If you are using a version control tool, commit back the property file with the timestamp. Retrieve it in the future build for reference