|
| 1 | +--- |
| 2 | +title: "CICD" |
| 3 | +linkTitle: "CICD" |
| 4 | +weight: 4600 |
| 5 | +description: |
| 6 | +--- |
| 7 | + |
| 8 | +## Overview |
| 9 | + |
| 10 | +OpenFunction has realized automatic building and serving, what we need now is to trigger it when the code changes, thus forming a complete CICD. |
| 11 | + |
| 12 | +OpenFunction use Revision Controller to trigger build when the source code changed, or rerun the application when the image changed. |
| 13 | + |
| 14 | +The Revision Controller will: |
| 15 | +- Watch the source code in github, gitlab or gitee, rebuild the function when source code changed. |
| 16 | +- Watch the bundle container image which include the soucre code, rebuild the function when image changed. |
| 17 | +- Watch the images of functions that without builder, rerun the image when image changed. |
| 18 | + |
| 19 | +## Quick start |
| 20 | + |
| 21 | +### Install |
| 22 | + |
| 23 | +You can install the Revision Controller when installing the [OpenFunction](https://openfunction.dev/docs/getting-started/installation/#install-openfunction), just need to add the following flag to the helm command. |
| 24 | + |
| 25 | +```shell |
| 26 | +--set revisionController.enable=true |
| 27 | +``` |
| 28 | + |
| 29 | +Or you can install the `Revision Controller` after the `OpenFunction` installed by the following command. |
| 30 | + |
| 31 | +```shell |
| 32 | +kubectl apply -f https://raw.githubusercontent.com/OpenFunction/revision-controller/release-1.0/deploy/bundle.yaml |
| 33 | +``` |
| 34 | + |
| 35 | +> The `Revision Controller` willbe installed to the `openfunction` namespace by default, if you want to install it to another namespace, please download the `bundle.yaml` and modify it before apply. |
| 36 | +
|
| 37 | +### How to use |
| 38 | + |
| 39 | +To watch a function, just need to add some annotations to it. |
| 40 | + |
| 41 | +```yaml |
| 42 | +apiVersion: core.openfunction.io/v1beta1 |
| 43 | +kind: Function |
| 44 | +metadata: |
| 45 | + annotations: |
| 46 | + openfunction.io/revision-controller: enable |
| 47 | + openfunction.io/revision-controller-params: | |
| 48 | + type: source |
| 49 | + repo-type: github |
| 50 | + polling-interval: 1m |
| 51 | + name: function-http-java |
| 52 | + namespace: default |
| 53 | +spec: |
| 54 | + build: |
| 55 | + ... |
| 56 | + serving: |
| 57 | + ... |
| 58 | +``` |
| 59 | +
|
| 60 | +Annotations |
| 61 | +
|
| 62 | +| Key | Description | |
| 63 | +| ---------------------------------------------- | ---------------------------------------------------------------------------------------------- | |
| 64 | +| **openfunction.io/revision-controller** | Whether to start a revision controller for this function, known values are enable and disable. | |
| 65 | +| **openfunction.io/revision-controller-params** | Parameters for revision controller. | |
| 66 | +
|
| 67 | +Parameters |
| 68 | +
|
| 69 | +| Name | Description | |
| 70 | +| --------------------- | ------------------------------------------------------------------------------------------------------------------ | |
| 71 | +| **type** | The target type to watch, known values are source, source-image, image. | |
| 72 | +| **polling-interval** | The interval to get the image digest or source code head. | |
| 73 | +| **repo-type** | The type of the git server where the source code be in, known values are github, gitlab, gitee, default is github. | |
| 74 | +| **base-url** | The base url of the gitlab server. | |
| 75 | +| **auth-type** | The auth type of the gitlab server. | |
| 76 | +| **project-id** | The project id of a gitlab repo. | |
| 77 | +| **insecure-registry** | If the image registy is insecure, you should set this to true. | |
0 commit comments