Interesting scheduled deployment challenge
I have an interesting scheduled deployment challenge. Here is our situation.
We have 50 or so Amazon WorkSpaces that we setup using a Deploy “compound package” that calls about a dozen nested packages, some of which need to run as the logged on user. We run this compound package when we first provision a WorkSpace and it works perfectly.
In addition, we have a compound package that updates the WorkSpaces and also runs some nested packages as the logged on user.
Conceptually, what I’d like to have happen is this: for each WorkSpace, after an update I’d like it to wait a week and then automatically update the WorkSpace again the next time it’s online and logged in.
This turns out to be a non-trivial requirement.
First some things to note:
- When a WorkSpace is first started, it will have a heartbeat, but no user will be logged on, so we can’t run the update package quite yet
- Each WorkSpace is typically only used a few hours each day, so we can’t rely on a WorkSpace being online and logged in at any particular time
- The update package runs for about 10 minutes
- I have a dynamic Inventory collection that includes all WorkSpaces that are online (but not necessarily logged in)
- The first step of the update package is a Message that only runs if a user is logged on. It uses an `Error Mode` of `Stop Deployment with Success` (very handy feature), so that if the update package runs when no user is logged on, it just fails silently, which is good.
- The Heartbeat trigger doesn’t help, because it triggers before the user has logged in, so the update package fails
- The Weekly trigger doesn’t work, because it will end up mostly running at a time when a given WorkSpace is not online
One possible approach would be to:
- Add a Powershell script step that creates a special flag file when the update succeeds
- Add a Powershell script step that 1) only succeeds when today date is more than a week later than the flag file date and 2) uses an `Error Mode` of `Stop Deployment with Success`
- Use a schedule that runs frequently—say every 30-60 minutes
Another possible approach would be to use the Heartbeat trigger, but incorporate a Sleep step as the first step, so that the user has enough time to login.
Finally, having nothing to do with PDQ, I could try to develop some code that can automatically start and login to a WorkSpace. Then I could just run this as the first step and use a simple weekly schedule.
Surely others have dealt with a similar challenge?