FlowCI / flow-core-x

Powerful and user-friendly CI/CD server with high availability, parallel processing, runner auto-scaling
https://flowci.github.io
Apache License 2.0
1.61k stars 121 forks source link

Create a plugin #405

Closed favalos closed 3 years ago

favalos commented 3 years ago

Hi,

What is the easiest way to add a plugin that runs on Docker?

Regards,

gy2006 commented 3 years ago

The step of creating a plugin is as the following:

  1. Create a public git repo that contains 'plugin.yml' file, for example, https://github.com/your_org/your_plugin
  2. Edit plugin.yml file name, version and script are required
  3. flow.ci will load all plugins metadata from https://github.com/FlowCI/plugins/blob/master/repository.json as default, if you want to create your own plugin, you can fork https://github.com/FlowCI/plugins and add your plugin to repository.json
  4. Change plugins metadata URL by FLOWCI_PLUGIN_URL environment variable before backend service started

The plugin could runs on Docker as long as you have a corresponding runtime environment.
For example in the script of plugin.yml, you need to run some python script

name: your_plugin
version: 1.0.0
script: |
  python3 do_something.py

In this case, the plugin requires a Python environment, the python environment has to add by docker in the flow YAML, which means the script from the plugin will run on python:3.9 docker image

- name: plugin-test
  plugin: your_plugin
  docker:
     image: "python:3.9"

Let me know if you have further questions

favalos commented 3 years ago

Thanks!