trigger-jobs: Rewrite trigger-jobs to only run required post-merge jobs
The changes on trigger-jobs.py was condensed in one commit, three main reasons for this:
- The script was triggering jobs from pipelines with commits that were not necessarily merged into the main branch, wasting resources.
- Use the ETL wrapper for Gitlab to make it more uniform with the rest of the repository.
- Follow Python best-practices. Use functions and only run the script if it is called from terminal, not when it is imported as module.
In more details, the rewritten script only triggers performance jobs for GitLab pipelines associated with merge requests merged into the main branch.
- Connects to GitLab using the GitlabConnector class.
- Retrieves merge requests merged into the main branch within the last day.
- Sorts the merge requests by their merge date.
- Retrieves pipelines associated with the merge requests.
- Processes performance jobs in the pipelines, adding untriggered jobs to a list.
- Stops processing once it encounters a pipeline with triggered performance jobs.
- Triggers the untriggered performance jobs in chronological order.