[gitlab-ci] new "when" values for "retry" attribute acting on job's script output log with regex and/or exit code
### Problem to solve As a dev/devops, I want my pipeline jobs to retry automatically on functional/technical script errors, so that I don't have to do it myself :) ### Intended users - devops - dev ### User experience goal We use acceptance tools to guarantee the quality of our code, e.g. we use sonarQube, Fortify etc ... The problem is that sometimes the api called by the scripts of our jobs do not respond and we get timeouts on our scripts that we log functionally or for which we have a specific exit code. ### Proposal currently the "retry" attribute in the gitlab ci allows us to use several "when" corresponding to gitlab or gitlab-runner errors, we would also like to be able to decide on a retry based on the exit code of our script or on a regex search of the job output log. ### Further details ```yml test: script: rspec retry: max: 2 when: job_exit_code_equals exit_code: 3 ``` ```yml test: script: rspec retry: max: 2 when: job_exit_code_less_than exit_code: 3 ``` ```yml test: script: rspec retry: max: 2 when: job_exit_code_greater_than exit_code: 3 ``` ```yml test: script: rspec retry: max: 2 when: job_output_log_contains regex: /.*reset by peer.*/ ``` ### Permissions and Security Anyone with gitlab-ci.yml write rights :) ### Documentation <!-- See the Feature Change Documentation Workflow https://docs.gitlab.com/ee/development/documentation/workflow.html#for-a-product-change * Add all known Documentation Requirements in this section. See https://docs.gitlab.com/ee/development/documentation/feature-change-workflow.html#documentation-requirements * If this feature requires changing permissions, update the permissions document. See https://docs.gitlab.com/ee/user/permissions.html --> ### Availability & Testing ### What does success look like, and how can we measure that? ### What is the type of buyer? ### Is this a cross-stage feature? ### Links / references
issue