Stable branch with SHA command does not work if commit was cherry picked

Today we proceed to create the stable branch from the last auto-deploy branch that was deployed to GitLab.com https://gitlab.com/gitlab-org/security/gitlab/commits/13-3-auto-deploy-2020082010.

With the last SHA of that branch, the command to create the stable branch was:

/chatops run release stable_branch 13.3.0 fbcdd80781acd11d6083abafe9668b50136a5f3a

However, the job failed https://ops.gitlab.net/gitlab-org/release/tools/-/jobs/1662094:

2020-08-20 18:12:50.936360 F Rake::Task -- Task failed -- Exception: Gitlab::Error::BadRequest: Server responded with code 400, message: Invalid reference name: fbcdd80781acd11d6083abafe9668b50136a5f3a. Request URI: https://gitlab.com/api/v4/projects/gitlab%2Dorg%2Fgitlab/repository/branches

Because fbcdd80781acd11d6083abafe9668b50136a5f3a was generated by cherry-picking the MR into the auto-deploy branch (gitlab-org/gitlab!39955 (comment 399337087)). The original commit was 53814371ce407b50715c479b7f57556022d80e8f, but we couldn't use that one as that will include more commits into the stable branch.

As a workaround stable branch was created from one commit before (fbe8a8225f4639154716d8f16d53836378792e2d) and then Release Manager manually cherry-pick gitlab-org/gitlab!39955 (merged) into the 13-3-stable-ee stable branch.

A possible solution will be to always look for the commits on Security and not in canonical

Edited by Mayra Cabrera