wttech / gradle-aem-plugin

Swiss army knife for Adobe Experience Manager related automation. Environment setup & incremental AEM application build which takes seconds, not minutes.
https://tech.cognifide.com/tag/gradle-aem-plugin
Apache License 2.0
157 stars 32 forks source link

Retry on fail in step provisioning #462

Closed pun-ky closed 5 years ago

pun-ky commented 5 years ago

thx @tomaszmichalak for reporting this

consider impl


step("xxx") {
    rerunOnFail = true // exists
    retryOnFail(3) // will wrap step action into `aem.retry { afterSquaredSecond(3) }.withCountdown { /* action() */ } }

}
tomaszmichalak commented 5 years ago

Hi, I would think also about something like this:

step("xxx") {
    rerunOnFail = true // exists
    retryWhen {
        condition {
            (aem.bundles == valid) && (operationStatusValidationResult == 500)
        }
        times(5)
    }
}

Example: The step calls the HTTP endpoint to modify some value, let say: update some counter.

The requested HTTP endpoint has timed out. A timeout signals that something took to much time, but it does not mean that your operation failed.

To confirm the counter state, your logic requests other endpoint and checks its status.

pun-ky commented 5 years ago

I think that all retry related features could be implemented as a part of step action

action {
    instanceActions.awaitUp { instances = listOf(this) } // throws exception when e.g bundles are not up; yours 'retryWhen()'
    retry { afterSquaredSecond(5) }.withCountdown<Unit, Exception> {
        // do anything
    }
}
pun-ky commented 5 years ago

released in 7.2.2