Right way to invalidate SCM Cache after git update-ref?

Alexey_Efimov
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 29, 2015

In or plugin we make copy of `refs/pull-request/1234/merge` ref to `refs/pull-request/1234/merge-pin` (to prevent Build Storm on CI) on PR rescope (from reference update only).

Since 3.9.2 (and maybe 3.9.1) Stash version we found some problems. If we update such reference and run build after a second, then CI server can't fetch right up-to date reference value. We get something like:

'/usr/bin/git fetch --progress origin +refs/pull-requests/36343/merge-pin:refs/pull-requests/36343/merge-pin' command failed. stderr: fatal: git fetch_pack: expected ACK/NAK, got 'A ref was requested that is no longer valid. The ref may have been updated while the git-upload-pack request was received. Please try again.' fatal: The remote end hung up unexpectedly

 

But if we turn SCM-Cache off then errors gone.

So, the question is: How we must use `git update-ref` in our code to make SCM-Cache work propertly?

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

2 votes
Answer accepted
Michael Heemskerk
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 29, 2015

If you raise a (subclass of) RepositoryRefChangedEvent, scm-cache will invalidate its ref-cache

Alexey_Efimov
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 30, 2015

Thanks!

TAGS
AUG Leaders

Atlassian Community Events