Plugin branch fresh clone not working

Hi, I’m developing a plugin for Buildkite and event when I set the BUILDKITE_PLUGINS_ALWAYS_CLONE_FRESH env to true, the plugin doesn’t get updated.

The log shows:

Preparing plugins	0s
# Plugin "github.com/org/pipeliner#bug/sc-29304/detecting-changes" already checked out (4e7c351)
Preparing working directory

This is the YAML file of the pipeline using the plugin:

steps:
  - label: ":pipeline: Generating pipeline"
    env:
      BUILDKITE_PLUGINS_ALWAYS_CLONE_FRESH: "true"
    plugins:
      - ssh://github.com/org/pipeliner#bug/sc-29304/detecting-changes:
          "create-deploy-dependencies": false
          "mode": "build"
          "workspaces-path":
          - "apps"
          - "services"

Am I missing something here? It used to work just fine, but not anymore.

Thanks!

Hi @smoreno-allurion

This is Suma from Buildkite support team. Thank you for reaching out to us with your question.

In order to achieve this you should actually set the flag plugins-always-clone-fresh to true as part of your agent configuration or during agent start up by passing flag --plugins-always-clone-fresh=true which will let the agent know that it needs to perform clone every time and not use local copy of the plugin.

When you set that flag that environment variable BUILDKITE_PLUGINS_ALWAYS_CLONE_FRESH will get set to true so instead of defining this environment variable in pipeline, you should either set the flag during agent startup or set it in agent configuration file.

Please let us know if you have any further questions on this.

Thanks,
Suma

Hi Suma,
Thanks for your answer. I’m aware of the flag you mention, but I was under the impression that the same could be achieved by setting that env variable on a step.

The documentation mentions this when it says:
" One way to try this is to add the following step to the Buildkite pipeline where you’re testing your plugin. Configuring BUILDKITE_PLUGINS_ALWAYS_CLONE_FRESH on only one step means that other plugins, which are unlikely to be changing in the meantime, won’t get unnecessarily cloned on every step invocation." (source)

Did I misinterpret it? Or may be this feature is not available anymore? I’m quite sure this was working with that env var on the step before.

Thanks!

Hi @smoreno-allurion
Yes, you are correct that one of the option is to able to set this environment variable at step level so it does not apply for every plugin in the pipeline.

I did a test and can see following where it sees that env is set and removes previous checkout of the plugin

|Preparing plugins|1s|
| --- | --- |
||# BUILDKITE_PLUGINS_ALWAYS_CLONE_FRESH is true; removing previous checkout of plugin github.com/buildkite-plugins/library-example-buildkite-plugin#v1.0.1|
||# Plugin "github.com/buildkite-plugins/library-example-buildkite-plugin" will be checked out to "/opt/homebrew/var/buildkite-agent/plugins/github-com-buildkite-plugins-library-example-buildkite-plugin-v1-0-1"|

Please can you send your build url to support@buildkite.com where you saw it did not work so we can check further on this.

Thanks,
Suma

Hi @smoreno-allurion

Please can you also confirm agent version is 3.37.0 or above because this feature was introduced in v3.37.0
Here is the release notes

Here is PR in which this change was introduced

So if your agent version is lower than 3.37.0 version then that could be the reason you see it is not working. If so please upgrade the agent to 3.37.0 or above.

Yes, I can confirm my nodes are running with version v3.45.0.

I’m sending the email to support now.

Thanks Suma!