Run books steps with different environments

Hello.
I’m trying to create runbook that will restore production DB on our staging server.
So I have 2 environments and for each I have variables for DB connection and backup paths.
My runbook have next steps:

  1. Make PROD backup => PROD environment
  2. Make STAGE backup => STAGE environment
  3. Restore PROD DB on STAGE=> STAGE environment

On restore step I want to use tmp paths with backup from PROD but stuck on next:
when I run this runbook in starts to execute in parallel: PROD and STAGE. As result I can not to use output variable from PROD and use it in Restore step (that is running on Stage).

What is proper way run steps on different environmets one-by-one and use variables produced on any step and any environment?

Hi Peter,

Thanks for getting in touch, and welcome! Great question, though sadly I can’t think of any pretty solution to this, since output variables generated aren’t stored for future deployments. A few potential approaches might be to:

  • Create a project variable during the deployment to PROD, then update the applicable release snapshot so the value is stored and available when you deploy to STAGE.

  • Have a script step that makes an API call to retrieve the value of the variable for the other deployment, similar to this sample script.

  • Have a script step that writes the value somewhere static outside of the deployment which can be referenced in STAGE.

Another feature that might help is prompted variables, which would allow you to set the path value in advance (when you kick off the deployment to STAGE).

I hope this helps in some way. Let me know what you think, or if you have any further questions going forward!

Best regards,

Kenny

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.