Drone

Memoization of starlark converters leads to missing events

I use the drone-starlark converter.

When I open a pull request in my Github repository I should get two events: pull_request and push, right? But really in my starlark script, I get only push event. I think that happens by the memoization that drone does when sees the first event push.

Moreover, when I push the same commit to another branch, I get no events!

Could you help me?

Update: I’ve commented these lines in memoize.go file:

and now it works as expected: I’ve recieved in my starlark script two events: push and pull_request!

When I added event type (req.Build.Event) to the cache key like:

// cache key pattern used in the cache, comprised of the
// repository slug and commit sha and event type.
const keyf = "%d/%s/%s"

...

key := fmt.Sprintf(keyf, req.Repo.ID, req.Build.After, req.Build.Event)

It is also works good!

EDIT: I can make a PR, if the above solution is OK.

I also get this issue, only for me upon pushing to a branch when a PR is open, it runs both intended builds as a push event.
I upvote a fix for this.
In the mean time I’m forking your proposition. Thanks for offering a solution :slight_smile:

the memoization function was removed back in November by this commit. Have you confirmed you are running the latest stable release?

I was just about to edit my message. :slight_smile:
Indeed I was still running v1.4, I just updated to 1.6.4 and it resolves the issue (after I figured that the v1.5 added the DRONE_AGENTS_DISABLED variable that is xD).