Simple python tool with no dependencies that can be used to retry failing pipelines in your gitlab build. Useful for flakey tests that are preventing your merge request.
- Download the run.py file (or the whole project, either works).
- Open run.py in a text editor (any will do).
- Use this tutorial to get your Personal Access Token for Gitlab. Make sure to use the scope "api", otherwise the retry functionality won't work.
- Delete "PASTE_ACCESS_TOKEN_HERE" in run.py and paste your access token inside double quotes.
- Use this method to get the project ID for your project.
- Replace "PASTE_PROJECT_ID_HERE" with your project ID in run.py.
- Replace "PASTE_URL_HERE" with your gitlab URL (this is the website you visit to access your repository).
- Now save run.py. Your first time setup is done.
- Get the Pipeline ID from the Gitlab UI or URL. It is a # followed by some number. This is the pipeline that will be retried.
- Open command prompt or powershell in the folder where run.py is saved.
- Run
python retry_pipeline.py <pipeline_id>
after replacing<pipeline_id>
with your Pipeline ID. - Now sit back and watch the magic happen. Helpful failure messages have been provided in case something is misconfigured.