|
| 1 | +# Piped Agent for plugin architecture |
| 2 | + |
| 3 | +See [Overview of the Plan for Pluginnable PipeCD](https://pipecd.dev/blog/2024/11/28/overview-of-the-plan-for-pluginnable-pipecd/) to understand what's PipeCD plugin. |
| 4 | + |
| 5 | + |
| 6 | +## Prerequisites |
| 7 | + |
| 8 | +- [Go 1.24 or later](https://go.dev/) |
| 9 | + |
| 10 | +## Repositories |
| 11 | +- [pipecd](https://github.com/pipe-cd/pipecd): contains all source code and documentation of PipeCD project. |
| 12 | + |
| 13 | +## Commands |
| 14 | + |
| 15 | +- `make build/go`: builds all go modules including pipecd, piped, pipectl. |
| 16 | +- `make test/go`: runs all unit tests of go modules. |
| 17 | +- `make build/plugin`: builds built-in plugins located in `pkg/app/pipedv1/plugin`. |
| 18 | +- `make run/piped`: runs Piped locally (for more information, see [here](#how-to-run-piped-agent-locally)). |
| 19 | +- `make gen/code`: generate Go and Typescript code from protos and mock configs. You need to run it if you modified any proto or mock definition files. |
| 20 | + |
| 21 | +For the full list of available commands, please see the Makefile at the root of the repository. |
| 22 | + |
| 23 | +## Setup Control Plane |
| 24 | + |
| 25 | +1. Prepare Control Plane that piped connects. If you want to run a control plane locally, see [How to run Control Plane locally](https://github.com/pipe-cd/pipecd/tree/master/cmd/pipecd#how-to-run-control-plane-locally). |
| 26 | + |
| 27 | +2. Access to Control Plane console, go to Piped list page and add a new piped. Then, copy generated Piped ID and key for `piped-config.yaml` |
| 28 | + |
| 29 | +## How to run Piped agent locally |
| 30 | + |
| 31 | +1. Prepare plugin binaries. |
| 32 | + |
| 33 | + ```sh |
| 34 | + make build/plugin |
| 35 | + ``` |
| 36 | + |
| 37 | +2. Prepare the piped configuration file `piped-config.yaml`. This is an example configuration; |
| 38 | + ```yaml |
| 39 | + apiVersion: pipecd.dev/v1beta1 |
| 40 | + kind: Piped |
| 41 | + spec: |
| 42 | + projectID: quickstart |
| 43 | + # FIXME: Replace here with your piped ID. |
| 44 | + pipedID: 7accd470-1786-49ee-ac09-3c4d4e31dc12 |
| 45 | + # Base64 encoded string of the piped private key. You can generate it by the following command. |
| 46 | + # echo -n "your-piped-key" | base64 |
| 47 | + # FIXME: Replace here with your piped key file path. |
| 48 | + pipedKeyData: OTl4c2RqdjUxNTF2OW1sOGw5ampndXUyZjB2aGJ4dGw0bHVkamF4Mmc3a3l1enFqY20K |
| 49 | + # Write in a format like "host:443" because the communication is done via gRPC. |
| 50 | + # FIXME: Replace here with your piped address if you connect Piped to a control plane that does not run locally. |
| 51 | + apiAddress: localhost:8080 |
| 52 | + repositories: |
| 53 | + - repoId: example |
| 54 | + remote: [email protected]:pipe-cd/examples.git # FIXME: prepare your manifest repo |
| 55 | + branch: main |
| 56 | + syncInterval: 1m |
| 57 | + plugins: |
| 58 | + - name: kubernetes |
| 59 | + port: 7003 # FIXME: any unused port |
| 60 | + url: file:///path/to/.piped/plugins/kubernetes # It's OK using any value for now because it's a dummy. We will implement it later. |
| 61 | + deployTargets: # This field is alternative for platform providers |
| 62 | + - name: kubernetes-dev |
| 63 | + config: |
| 64 | + masterURL: https://127.0.0.1:61337 # FIXME: shown by kubectl cluster-info |
| 65 | + # FIXME: Replace here with your kubeconfig absolute file path. |
| 66 | + kubeConfigPath: /path/to/.kube/config |
| 67 | + ``` |
| 68 | + |
| 69 | +3. Ensure that your `kube-context` is connecting to the right kubernetes cluster |
| 70 | + |
| 71 | +4. Run the following command to start running `piped` (if you want to connect Piped to a locally running Control Plane, add `INSECURE=true` option) |
| 72 | + |
| 73 | + ``` console |
| 74 | + make run/piped CONFIG_FILE=piped-config.yaml EXPERIMENTAL=true |
| 75 | + ``` |
| 76 | + |
| 77 | +Note: If you have a problem with accessing the example repository, please follow [this guide](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent) to register the SSH key or try specifying `remote: https://github.com/pipe-cd/examples.git` instead in the above `piped-config.yaml`. |
0 commit comments