Ability to consistently point Plugins at the HEAD commit on a given Branch

It would be awesome to be able to refer to the most recent commit of a plugin pointed at a certain branch in the event versioned releases don’t make sense to use. E.g my-buildkite-plugin#master

We know this is currently supported. But with the way BK runner plugin checkout works, there is no guarantee the plugin is running off the most recent commit on the expected branch.

A bit of context: At Wayfair, we’re managing deployments through a deployment plugin, this plugin contains control points which gate deployments. We do stuff like checking if your deployment is meeting compliance requirements, that you have proper service metadata so. More generally it wraps up our deployment logic into a consistent layer that WFs engineers can interact w/ in a composable manner.

Given the context - we don’t really want to request our engineers to frequently upgrade their plugin version since we’re actively making updates/features. Maybe not daily - but multiple updates per week.

After looking through your source code - we’re seeing that the plugin checkout logic lives here: https://github.com/buildkite/agent/blob/f7d57d748ac9fdac4084338546a21b03efde21e7/bootstrap/bootstrap.go#L761

What we want to know is if there is a deliberate reason to avoid adding a fetch on this line? In our eyes: it shouldn’t impact versioned/tagged based workflows, since there wouldn’t be any updates to fetch in that case, and it would enable consistent branch based workflows.

Seems like the only downside would be the additional fetch (which should be pretty cheap).

What does everyone think?

Thanks for posting @timchep and welcome!

This is an interesting idea and I have shared it internally to gather some feedback from the team!

@Jason any update on this? Just stumbled across this and we’d like to poewr this as well.

Hello @chomey!

It looks like this issue may be solved by the environment variable BUILDKITE_PLUGINS_ALWAYS_CLONE_FRESH as seen here. This should force the agent to clone the plugin every time.

Have a fantastic day!
Michelle