Simple python tool that can be used to retry failing pipelines in your Gitlab build. Useful for flakey tests that are preventing your merge request.
- Clone the project
- Create a .env file inside the project directory.
- Copy the contents of example.env to the newly created .env file, then update the variables as expected.
- Save the .env file.
- Run
pip install -r requirements.txt. - The script is ready. Run
python RetryPipeline.py -hto see usage options.
- 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 terminal in the folder where RetryPipeline.py is saved.
- Run
python RetryPipeline.py <pipeline_id>after replacing<pipeline_id>with your Pipeline ID or URL. (You can also runpython RetryPipeline.pydirectly, you will be prompted for pipeline ID or URL while the project executes.)
- Run
pip install -r requirements-optional.txt. - Open RetryPipeline.py and set PRETTY_PRINT_FLAG to
True. - Save RetryPipeline.py
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. Use this method to get the project ID for your project.