|
| 1 | +# Plugins |
| 2 | + |
| 3 | +Plugins are created as files laid out in a particular directory tree, |
| 4 | +then they can be packaged into versioned archives to be deployed. |
| 5 | + |
| 6 | +This document explains the plugin format, and provides basic guidance for |
| 7 | +building plugins. |
| 8 | + |
| 9 | +## The Plugin File Structure |
| 10 | + |
| 11 | +A plugin is organized as a collection of files inside of a directory. The |
| 12 | +directory name is the name of the plugin (without versioning information). Thus, |
| 13 | +a plugin describing "Kubernetes Deployment" would be stored in the `kube-deploy/` directory. |
| 14 | + |
| 15 | +Inside of this directory, Codefresh will expect a structure that matches this: |
| 16 | + |
| 17 | +``` |
| 18 | +kube-deploy/ |
| 19 | + plugin.yaml # A YAML file containing information about the plugin |
| 20 | + LICENSE # OPTIONAL: A plain text file containing the license for the chart |
| 21 | + README.md # OPTIONAL: A human-readable README file |
| 22 | + NOTES.md # OPTIONAL: A plain text file containing short usage notes |
| 23 | +``` |
| 24 | + |
| 25 | + |
| 26 | +## The plugin.yaml File |
| 27 | + |
| 28 | +The `plugin.yaml` file is required for a plugin. It contains the following fields: |
| 29 | + |
| 30 | +```yaml |
| 31 | +image: The fully qualified name of the plugin Docker image (required) |
| 32 | +tag: The plugin image tag (optional, default "latest") |
| 33 | +version: SevVer 2 version for the plugin (required) |
| 34 | +description: A single-sentence description of this plugin (optional) |
| 35 | +keywords: |
| 36 | + - A list of keywords about this plugin (optional) |
| 37 | +home: The URL of this plugin's home page (optional) |
| 38 | +sources: |
| 39 | + - A list of URLs to source code for this plugin (optional) |
| 40 | +maintainers: # (optional) |
| 41 | + - name: The maintainer's name (required for each maintainer) |
| 42 | + email: The maintainer's email (optional for each maintainer) |
| 43 | +icon: A URL to an SVG or PNG image to be used as an icon (optional) |
| 44 | +envs: |
| 45 | + - name: The variable name (required) |
| 46 | + type: required | optional | runtime (default to "optional") |
| 47 | + alias: alternative name, used inside the plugin container (optional) |
| 48 | + description: A short description for the variable (optional) |
| 49 | +volumes: |
| 50 | + - name: The volume name |
| 51 | + required: true | false (default "false") |
| 52 | + description: A short description for attached volume |
| 53 | +``` |
| 54 | +
|
| 55 | +
|
| 56 | +### Plugins and Versioning |
| 57 | +
|
| 58 | +Every plugin must have a version number. A version must follow the |
| 59 | +[SemVer 2](http://semver.org/) standard. Codefresh Plugins uses version numbers as release markers. Plugins in repositories are identified by name plus version. |
| 60 | +
|
| 61 | +For example, an `kube-deploy` plugin whose version field is set to `version: |
| 62 | +1.2.3` will be named: |
| 63 | + |
| 64 | +``` |
| 65 | +kube-deploy-1.2.3.tgz |
| 66 | +``` |
| 67 | + |
| 68 | +More complex SemVer 2 names are also supported, such as |
| 69 | +`version: 1.2.3-alpha.1+ef365`. But non-SemVer names are explicitly |
| 70 | +disallowed by the system. |
| 71 | + |
| 72 | +### Predefined Variables |
| 73 | + |
| 74 | +The following environment variables are pre-defined, are available to every plugin, and |
| 75 | +cannot be overridden. |
| 76 | + |
| 77 | +- `CF_BUILD_TIMESTAMP`: Codefresh pipeline start execution timestamp |
| 78 | +- `CF_SHORT_REVISION`: short Git commit SHA |
| 79 | +- `CF_REVISION`: full Git commit SHA |
| 80 | +- `CF_REPO_NAME`: Git repository name |
| 81 | +- `CF_BRANCH_TAG_NORMALIZED`: default image tag for Codefresh CI pipeline |
| 82 | +- `CF_BRANCH`: Git branch name |
| 83 | +- `CF_BUILD_URL`: URL to Codefresh pipeline log |
| 84 | +- `CF_COMMIT_AUTHOR`: Git commit author |
| 85 | +- `CF_VOLUME_PATH`: Codefresh shared context volume (default to `/codefresh/volume`) |
| 86 | +- `CF_COMMIT_URL`: Git commit URL |
| 87 | +- `CF_BRANCH_VERSION_NORMALIZED`: |
| 88 | +- `CF_COMMIT_MESSAGE`: Git commit message |
| 89 | +- `CF_BUILD_ID`: Codefresh pipeline ID |
| 90 | +- `CF_REPO_OWNER`: Codefresh pipeline owner |
| 91 | +- `CF_BUILD_TRIGGER`: Codefresh pipeline trigger |
| 92 | + |
| 93 | +### Predefined Volumes and Files |
| 94 | + |
| 95 | +- `/codefresh/volume` - same volume mounted to all steps running in Codefresh pipeline |
| 96 | +- `/codefresh/volume/env_vars_to_export` - a placeholder file to filled with **exported** environment variables; any exported variable can be used in subsequent pipeline steps |
0 commit comments