How to try again if get resource is fail

Hello everyone!

Could anyone help me to find an approach to add attempts to restart get resource step if it failed to download a resource?

We use as a resource git:// to trigger if they deploy a new release, but for downloading release file we use their ftp -

What is a problem
Sometimes they created a new release faster than upload file to ftp, as a result, build failed because it can’t download a file and we need to restart it manually. So is there any possibility to catch this situation and say to try 10 times with interval 1 hour between tries?

for example, how it can be in Jenkins:

Thank you

This can be done by using attempts: and on_failure: with a task that sleeps:

- get: postgres-ftp
  attempts: 10
    task: sleep
      platform: linux

        type: registry-image
        source: {repository: alpine}

      run: {path: sleep, args: ["3600"]}

It’d be nice if you didn’t have to do that though, and instead there was some way to have inter-dependent resources for situations like this where you can’t really change how the external assets are published. :thinking:

If such a feature existed we could avoid triggering the build in the first place until there are corresponding versions in both locations. I’m not really sure what a good syntax for this would be but I know I’ve run into similar situations in the past.

1 Like

Thank you. I will try your suggestion :slight_smile: