Skip to content

feat: Install Plugins alongside Flux setup in gh actions#5955

Merged
matheuscscp merged 9 commits into
fluxcd:mainfrom
gat786:test-plugin-install
Jun 29, 2026
Merged

feat: Install Plugins alongside Flux setup in gh actions#5955
matheuscscp merged 9 commits into
fluxcd:mainfrom
gat786:test-plugin-install

Conversation

@gat786

@gat786 gat786 commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

This PR adds the capability of installing plugins to the action which sets up Flux on a GH Action.

Closes: #5933

Adds two new variables to the GH Action input

  • plugins: [optional] Plugins to install alongside Flux. One per line: <name>@<version|digest>.
    Example: mirror@0.0.1
  • plugin_dir: [optional] Directory where the plugins should be installed, setups the FLUXCD_PLUGINS env variable.

And outputs

  • plugin-dir - Directory where the plugin binaries are present. This helps in users know the directory even when it was unspecified and they can use this value for further processing if need be.

the plugin support comes with a feature gate which is designed to exit with an error when plugins were specified but the flux binary installed does not support plugins yet (i.e. it has a version < 2.9.0.

@gat786 gat786 force-pushed the test-plugin-install branch from 9188345 to 970d438 Compare June 25, 2026 17:18
@gat786 gat786 force-pushed the test-plugin-install branch from 6231f3e to 0a7366c Compare June 25, 2026 17:32
@gat786

gat786 commented Jun 25, 2026

Copy link
Copy Markdown
Contributor Author

I did run some tests here -> https://github.com/gat786/flux2/actions/runs/28187933002

if it helps with anything!

@matheuscscp matheuscscp left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @gat786, thanks very much for this PR!

We need to add an if: field to the plugin step so it runs only if inputs.plugins is specified.

Also, let's rename plugin_dir to plugin-dir, which is the GHA convention. We should also define a sensible default for this input, as people will probably not have an opinion about it. Finally, the effective plugin-dir should be an output of this action, because even though people will not want to think about it to choose one, they will still need the default directory chosen by the action e.g. for the mirror plugin, which for some commands expects the config file to be a sibling of the binary in the filesystem.

@gat786 gat786 requested a review from matheuscscp June 26, 2026 09:38
@matheuscscp

Copy link
Copy Markdown
Member

Hey @gat786 please squash, rebase and force-push, this PR should have a single commit 🙏

@gat786 gat786 force-pushed the test-plugin-install branch 4 times, most recently from f0975c5 to b98e3ca Compare June 26, 2026 13:38
@gat786

gat786 commented Jun 26, 2026

Copy link
Copy Markdown
Contributor Author

@matheuscscp after a few back and forths me donez!

@matheuscscp

Copy link
Copy Markdown
Member

Looks like the if: blocks are wrong, I think they don't need the ${{ and }}

@gat786

gat786 commented Jun 26, 2026

Copy link
Copy Markdown
Contributor Author

oh no, lemme check

@gat786 gat786 force-pushed the test-plugin-install branch from fe7de52 to abbe40c Compare June 26, 2026 16:05
@gat786

gat786 commented Jun 26, 2026

Copy link
Copy Markdown
Contributor Author

it is interesting that they do not allow using {{, as far as i remember it used to be a norm. In any case, I fixed that issue along with it I separated the code out a bit and tested it to make sure it doesn't break this time.

@gat786 gat786 force-pushed the test-plugin-install branch from abbe40c to 599a047 Compare June 26, 2026 16:18
@matheuscscp

matheuscscp commented Jun 26, 2026

Copy link
Copy Markdown
Member

Hey @gat786 this feature needs a very important gate: only the Flux CLI v2.9+ will support it. I think we need to detect the version and check if 2.9+ is satisfied, in order to print a nice error message about this requirement not being met, and that also shows the installed version.

@matheuscscp

Copy link
Copy Markdown
Member

Also wondering why are the other env vars needed i.e. those beyond FLUXCD_PLUGINS

@gat786

gat786 commented Jun 27, 2026

Copy link
Copy Markdown
Contributor Author

Hey the FLUXCD_PLUGINS is constructed using those other variables and when the other variables are not exported the construction does not happen properly, i.e. the os, arch and version entries remain empty.

I can remove the other exports by constructing fluxcd plugins directory in the same step as installation but since installation of plugins is going to be condition based I had to do it in its own step and for that exports need to happen.

@matheuscscp

Copy link
Copy Markdown
Member

I think we can use step inputs/outputs for this, and not export envs. This way it stays internal.

@gat786 gat786 force-pushed the test-plugin-install branch 7 times, most recently from 570119b to ce54224 Compare June 27, 2026 18:00
@gat786

gat786 commented Jun 27, 2026

Copy link
Copy Markdown
Contributor Author

Hey I added a feature gate and did some testing on it as well across platforms it does seem to work according to me, please check whenever you can!

Comment thread action/action.yml Outdated
@gat786 gat786 force-pushed the test-plugin-install branch from ce54224 to 1fc84e5 Compare June 29, 2026 04:03
Signed-off-by: Ganesh Tiwari <ganesht049@gmail.com>
@gat786 gat786 force-pushed the test-plugin-install branch from 1fc84e5 to 542dbb5 Compare June 29, 2026 04:22
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>

@matheuscscp matheuscscp left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 🚀

@gat786 Thanks very much for the contribution!

@gat786

gat786 commented Jun 29, 2026

Copy link
Copy Markdown
Contributor Author

Thank you so much!

@gat786

gat786 commented Jun 29, 2026

Copy link
Copy Markdown
Contributor Author

I would like to participate even more in the upcoming future! Learnt a lot from this implementation!

Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
@matheuscscp matheuscscp merged commit 03af1c5 into fluxcd:main Jun 29, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add plugins to Flux GitHub Action

2 participants