Hey, I was wondering if anyone had any ideas about an interesting problem we’re struggling with. We’d like to have a job (or another pipeline if that’s easier) to be triggered a certain period of time (i.e 2 days) after a first job/pipeline has ran successfully. I’m probably missing something obvious, but the only thing I’ve come up with is using the experimental cron resource (https://github.com/pivotal-cf-experimental/cron-resource) and, when our first job succeeds have a job that sets a second pipeline with a specific value for the cron expression. This does feel a bit over-engineered though. Any suggestions would be very much welcome!
I needed something similar albeit 1H not 2days.
You could do:
- name: wait1 plan: - get: node1 trigger: true passed: [merge1] - task: wait1 config: platform: linux image_resource: type: docker-image source: repository: alpine tag: latest run: path: sleep args: - 172800
Hi Muttley, thank you very much! We haven’t implemented this yet (I was also told on Concourse Discord, that doing something like this is a potentially bad practice). Sleep does look like a good way, I wonder if there could be any potential issues with setting the time to 2 days
The problem with
sleep is if the task gets interrupted, and it could also prevent upgrades from happening if workers need to finish all tasks before getting shut down.
You might be able to knock up a custom resource pretty quickly that is a bit more safe. You could
put a timestamp to it, which would get persisted somewhere (Git? S3?),
check would read that file, and then emit a new version if the current time is greater than the time in the file.
get wouldn’t be much use here.
So when pipeline #1 finishes, write
now + 2_days to a file, get this custom resource to put it, and then have another pipeline that is triggered on new versions of that resource.
Smuggler might help you iterate on this: https://github.com/redfactorlabs/concourse-smuggler-resource
Oh, hey DJ!
Thanks, that is interesting, I didn’t know about that resource, will try to set it up like that.
So far, my best idea was to use the Concourse cron resource with a parameterized time expression and reset the expression in Vault in the first job and then have the second job to be triggered by that cron resource.