`rules:changes` will look at last commit only


I started using rules:changes for 2 different reasons:

  1. in workflow:rules to avoid starting the pipeline if no file was changed; this is useful with git-flow releases, that otherwise will trigger a pipeline for develop because an (empty) merge commit is pushed
  2. in single jobs to skip DB migrations in CD if no migration file was changed (DB migrations are described ad python files in django)

Now I’d like to expand the usage of the second point above to skip js tests if no js code was changed and so on…

But I noticed that rules look at the latest commit only in a multiple-commit push. This means that if I push multiple commits at once, and the last one doesn’t contain migrations, my migrations won’t run.

I understand solving this problem means to get the file diff between HEAD and the last pipeline that succeeded but I wonder how changes can be useful at all given the current implementation.

Any suggestion?

What version & edition of GitLab are you on?

For myself I just uploaded 2 commits, the first one has the change which triggered the rule, and the rule was triggered. Therefore GitLab Community Edition 13.5.3 seems to look farther than HEAD.