Skip to content

Instantly share code, notes, and snippets.

@ressl
Last active July 13, 2018 10:54
Show Gist options
  • Save ressl/d44030db797e82e940d605f97e824407 to your computer and use it in GitHub Desktop.
Save ressl/d44030db797e82e940d605f97e824407 to your computer and use it in GitHub Desktop.
GitLab retry all failed jobs

#First assign a user to user variable user = User.find_by(username: 'your username here')

Find all failed jobs for the project with the id 62

job = Ci::Build.find_by_sql("select * from ci_builds where status = 'failed' and project_id = '62'")

job.each { |j| Ci::Build.retry(j, user) }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment