Skip to content

(ci): sheldon-mr job doesn't work

Marc SCHWEITZER requested to merge 402-ci-sheldon-mr-job-doesn-t-work into dev

What does this MR do?

According to #402 (closed), the sheldon-mr job seems to fail when merge commit are present in-between dev and the current mr branch.

Here the git merge-base function has been replaced by a diff of revision list between the MR branch and dev, and then keep the oldest common ancestor.

Explanations

  • git rev-list --first-parent origin/${CI_COMMIT_REF_NAME}: revision list of the MR branch

  • git rev-list --first-parent origin/dev: revision list of dev (/!\ we need to check is there is a limitation on number)

  • diff -u <(git rev-list --first-parent origin/${CI_COMMIT_REF_NAME}) <(git rev-list --first-parent dev) : basic diff between the two list

  • | sed -ne 's/^ //p': removes the diff line ("+" "-", etc), to keep only the common revisions

  • | head -1: keep the first form common revisions.

This is, indeed, a bit over-complicated, and can be simplified by a simple merge on the CI side, and then run sheldon, but this avoid any potential merge conflicts checking beforehand.

Do not hesitate to invalid this, if a better solution is found.

How to test it?

  • Run sheldon-mr job.

Data

No data

Some results

  • Check the sheldon-mr job.

Additional tests to run

  • Test on complicated git tree

Associated Issues/Merge Requests

Closes #402 (closed)

Edited by Marc SCHWEITZER

Merge request reports