|
2 | 2 |
|
3 | 3 | # Go JSON configuration plugin |
4 | 4 |
|
| 5 | +This is a Go server plugin which allows to keep pipelines and environments configuration |
| 6 | +in version control systems supported by Go (git,svn,mercurial, etc.) |
| 7 | + |
| 8 | +You can find an example repository at https://github.com/tomzo/gocd-json-config-example.git |
| 9 | + |
| 10 | +## Quickstart |
| 11 | + |
| 12 | +### Early access |
| 13 | + |
5 | 14 | This plugin uses configuration repository extension in Go. |
6 | 15 | [Feature](https://github.com/gocd/gocd/issues/1133) is not |
7 | | -merged into official gocd repository. But it will be soon possible |
8 | | -to build Go from [my fork](https://github.com/tomzo/gocd) to try this out. |
| 16 | +merged into official gocd repository. Currently you have to |
| 17 | +build Go from [my fork](https://github.com/tomzo/gocd) to try this out. |
| 18 | + |
| 19 | +### Installation |
| 20 | + |
| 21 | +First you must install the plugin in Go server. |
| 22 | +You'll have to drop `.jar` to `/plugins` directory in your server installation. |
| 23 | +Plugin jars can be downloaded from [snap](https://snap-ci.com/tomzo/gocd-json-config-plugin/branch/master) |
| 24 | + |
| 25 | +### Add configuration repository |
| 26 | + |
| 27 | +There is no UI to add configuration repositories so you'll have to edit the |
| 28 | +config XML. |
| 29 | +You will need to add `config-repo` section within `config-repos`. |
| 30 | +If `config-repos` does not exist yet then you add it right above first `<pipelines />`. |
| 31 | + |
| 32 | +To add all configurations from git repository `https://github.com/tomzo/gocd-json-config-example.git` |
| 33 | +a section like this should be added: |
| 34 | + |
| 35 | +```xml |
| 36 | +... |
| 37 | +<config-repos> |
| 38 | + <config-repo plugin="json.config.plugin"> |
| 39 | + <git url="https://github.com/tomzo/gocd-json-config-example.git" /> |
| 40 | + </config-repo> |
| 41 | +</config-repos> |
| 42 | +... |
| 43 | +``` |
9 | 44 |
|
10 | 45 | ## Configuration files |
11 | 46 |
|
12 | | -This plugin let's you define 2 types of configuration files: |
13 | | - * pipeline - single file defines a single pipeline |
14 | | - * environment - single file defines Go environment |
| 47 | +Using this plugin you can store any number of pipeline or environment |
| 48 | +configurations without a versioned repository like git. |
| 49 | + |
| 50 | +By default pipelines should be stored in `*.gopipeline.json` files |
| 51 | +and environments should be stored in `*.goenvironment.json` files. |
| 52 | + |
| 53 | +The file name pattern can be changed on plugin configuration page. |
15 | 54 |
|
16 | 55 | ## Format |
17 | 56 |
|
| 57 | +The pipeline configuration files should be stored in format similar to |
| 58 | +one exposed by [go API](https://api.go.cd/16.1.0/#get-pipeline-config). |
| 59 | + |
| 60 | +The format of environment configuration files is much simpler, |
| 61 | +you can find examples of correct environments at the [bottom](#environment). |
| 62 | + |
| 63 | +#### Implementation note |
| 64 | + |
18 | 65 | This plugin leverages JSON message format used internally for Go server |
19 | 66 | and plugin communication. The only difference between these schemas is the |
20 | | -fact that in plugin format a pipeline can contain a `group` property. Plugin |
| 67 | +fact that in plugins format a pipeline can contain a `group` property. Plugin |
21 | 68 | transforms that into official schema where groups contain many pipelines. |
22 | 69 |
|
23 | 70 | Go pipeline and environment configuration has very deep structure. So instead |
24 | | -of writing very long schema below are examples of many configuration elements. |
25 | | -It is very close to [official xml schema](http://www.go.cd/documentation/user/15.2.0/configuration/configuration_reference.html) |
| 71 | +of reading a very long schema, below you can find examples of all configuration elements. |
| 72 | + |
| 73 | +It is very close to [official xml schema](http://www.go.cd/documentation/user/16.1.0/configuration/configuration_reference.html) |
| 74 | +and also [official JSONs in pipeline configuration API](https://api.go.cd/16.1.0/#get-pipeline-config) |
26 | 75 |
|
27 | 76 | 1. [Pipeline](#pipeline) |
28 | 77 | * [Mingle](#mingle) |
|
0 commit comments