thought-machine / falco-probes

Automated build and mirror of eBPF kernel probes for use as a driver with the Falco runtime security agent (https://falco.org/)
Apache License 2.0
16 stars 4 forks source link

fix multiple goroutines trying to create releases #38

Closed VJftw closed 3 years ago

VJftw commented 3 years ago

The ensureReleaseForDriverVersion function had a bug in added in #37 which made it attempt to create releases for ones which already existed.

This PR fixes that and adds a unit test to prevent it from happening again :pray:

The bug was the ensureReleaseforDriverVersion was doing

if release, err := ghr.getReleaseByName(driverVersion); err != nil {
  return release, nil

which was only returning the release if there was an error, instead of returning the release when there is no error:

if release, err := ghr.getReleaseByName(driverVersion); err == nil {
  return release, nil