{"id":39790824,"url":"https://github.com/tomzo/gocd-json-config-plugin","last_synced_at":"2026-01-18T12:15:06.843Z","repository":{"id":35070313,"uuid":"39216004","full_name":"tomzo/gocd-json-config-plugin","owner":"tomzo","description":"GoCD configuration plugin which supports JSON format","archived":false,"fork":false,"pushed_at":"2026-01-01T16:21:30.000Z","size":913,"stargazers_count":40,"open_issues_count":3,"forks_count":24,"subscribers_count":7,"default_branch":"master","last_synced_at":"2026-01-06T21:42:34.429Z","etag":null,"topics":["gocd","json","pipelines-as-code"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tomzo.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2015-07-16T19:24:36.000Z","updated_at":"2026-01-01T16:21:27.000Z","dependencies_parsed_at":"2023-12-08T17:27:41.505Z","dependency_job_id":"67d3c7b2-af87-40a2-900b-02c7bcfa4a3e","html_url":"https://github.com/tomzo/gocd-json-config-plugin","commit_stats":null,"previous_names":[],"tags_count":119,"template":false,"template_full_name":null,"purl":"pkg:github/tomzo/gocd-json-config-plugin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomzo%2Fgocd-json-config-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomzo%2Fgocd-json-config-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomzo%2Fgocd-json-config-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomzo%2Fgocd-json-config-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tomzo","download_url":"https://codeload.github.com/tomzo/gocd-json-config-plugin/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomzo%2Fgocd-json-config-plugin/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28535555,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-18T10:13:46.436Z","status":"ssl_error","status_checked_at":"2026-01-18T10:13:11.045Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gocd","json","pipelines-as-code"],"created_at":"2026-01-18T12:15:06.249Z","updated_at":"2026-01-18T12:15:06.825Z","avatar_url":"https://github.com/tomzo.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Google Groups](https://img.shields.io/badge/Google_Groups-user_help-purple)](https://groups.google.com/g/go-cd)\n[![GitHub Discussions](https://img.shields.io/badge/GitHub_discussions-user_\u0026amp;_dev_chat-green)](https://github.com/gocd/gocd/discussions)\n\n# GoCD JSON configuration plugin\n\n**GoCD pipeline configuration as code**\n\nThis is a [GoCD](https://www.gocd.org) server plugin which allows to keep **pipelines** and **environments** configuration\nin version control systems supported by GoCD (git, svn, mercurial, etc.).\nSee [this document](https://docs.gocd.org/current/advanced_usage/pipelines_as_code.html)\nto find out what GoCD's configuration repositories are.\n\n# Table of contents\n\n1. [Setup](#setup)\n1. [File pattern](#file-pattern)\n1. [Validation](#Validation)\n1. **[Format reference](#JSON-Configuration-reference)**\n1. [Format version](#Format-version)\n1. [Issues and questions](#Issues-and-questions)\n1. [Development](#Development)\n1. [License](#License)\n\n# Setup\n\n**Step 1**: GoCD versions newer than `17.8.0` already have the plugin bundled. You don't need to install anything.\n\nIf you're using GoCD version *older than 17.8.0*, you need to install the plugin in the GoCD server. Download it from\n[the releases page](https://github.com/tomzo/gocd-json-config-plugin/releases) and place it on the GoCD server in\n`plugins/external` [directory](https://docs.gocd.org/current/extension_points/plugin_user_guide.html).\n\n\n**Step 2**: Follow [the GoCD documentation](https://docs.gocd.org/current/advanced_usage/pipelines_as_code.html#storing-pipeline-configuration-in-json) to add a new configuration repository.\n\nYou can use the example repository at: `https://github.com/tomzo/gocd-json-config-example.git` as a reference.\n\nIn your config repo (`tomzo/gocd-json-config-example.git` in this case), ensure that your GoCD json config is suffixed with `.gopipeline.json` for pipelines and `.goenvironment.json` for environments. Give it a minute or so for the polling to happen. Once that happens, you should see your pipeline(s) on your dashboard.\n\n## File pattern\n\nUsing this plugin you can store any number of pipeline or environment\nconfigurations in a versioned repository like git.\n\nBy default **pipelines** should be stored in `*.gopipeline.json` files\nand **environments** should be stored in `*.goenvironment.json` files.\n\nThe file name pattern can be changed on plugin configuration page.\n\n# Validation\n\nYou can validate if proposed GoCD JSON changes will be accepted by the server. Currently, 2 options are available:\n * Use a [GoCD mergable github action](https://github.com/GaneshSPatil/gocd-mergeable)\n * [Validate from your local machine](#validation-using-cli)\n\n### Validation using CLI\n\n*You may find this [introductory blog post useful](https://kudulab.io/posts/gocd-preflight-validation/).*\n\nThere is an ongoing effort to allow in-depth validation of configuration **before pushing configuration to the source control**. This is provided by [GoCD's preflight API](https://api.gocd.org/current/#preflight-check-of-config-repo-configurations) and [gocd-cli](https://github.com/gocd-contrib/gocd-cli).\n\nYou have several options to configure validation tools on your workstation:\n * If you have a local docker daemon, use the [gocd-cli-dojo](https://github.com/gocd-contrib/docker-gocd-cli-dojo) image. Follow the [setup instructions](https://github.com/gocd-contrib/docker-gocd-cli-dojo#setup) in the image readme.\n * If you don't want to use docker, you'll need to [setup `gocd-cli` on your host](https://github.com/gocd-contrib/gocd-cli).\n\nEither way you'll have `gocd` binary in your `PATH` or inside the docker container.\n\n### Syntax validation\n\nThis will check general validity of the yaml file, without talking to the GoCD server:\n```bash\ngocd configrepo --json syntax ci.gopipeline.json\n```\n\n### Preflight validation\n\nThis command will parse and submit your json file to the configured GoCD server.\n```\ngocd configrepo preflight --json -r gocd-json-config-example *.gopipeline.json\n```\nWhere `-r` is the configuration repository id, which you have earlier configured on GoCD server. You can check it on config repos page of your GoCD server, at `/go/admin/config_repos`. It is in the upper left corner of each config repo.\n![config repo id](json_config_repo_id.png)\n\n# JSON Configuration reference\n\nThe **pipeline configuration** files should be stored in format *similar* to\none exposed by [GoCD API](https://api.gocd.org/current#get-pipeline-config).\n\nThe format of **environment configuration** files is much simpler,\nyou can find examples of correct environments [below](#environment).\n\n1. [Format version](#format-version)\n1. [Environment](#environment)\n1. [Environment variables](#environment-variables)\n1. [Pipeline](#pipeline)\n    * [Locking](#pipeline-locking)\n    * [Controlling the display order](#display-order-of-pipelines)\n    * [Timer](#timer)\n    * [Tracking tool](#tracking-tool)\n    * [Mingle](#mingle)\n1. [Stage](#stage)\n    * [Approval](#approval)\n1. [Job](#job)\n    * [Property](#property)\n    * [Tab](#tab)\n    * [Many instances](#run-many-instances)\n1. [Tasks](#tasks)\n    * [rake](#rake)\n    * [ant](#ant)\n    * [nant](#nant)\n    * [exec](#exec)\n    * [fetch](#fetch)\n    * [pluggabletask](#plugin)\n1. [Materials](#materials)\n    * [dependency](#dependency)\n    * [package](#package)\n    * [git](#git)\n    * [svn](#svn)\n    * [perforce](#perforce)\n    * [tfs](#tfs)\n    * [hg](#hg)\n    * [pluggable scm](#pluggable-scm)\n    * [configrepo](#configrepo)\n\n\n### Format version\n\nPlease note that it is now recommended to declare the _same_ `format_version` in each `*.gopipeline.json` or `*.goenvironment.json` file.\n\n#### GoCD server version from 19.10.0 and beyond\n\nSupports `format_version` value of `9`. In this version, support of `ignore_for_scheduling` for [dependency materials](#dependency) has been added. Setting this attribute will skip scheduling the pipeline when the dependency material has changed.\n\nUsing a newer `format_version` includes all the behavior of the previous versions too.\n\n#### GoCD server version from 19.9.0 and beyond\n\nSupports `format_version` value of `7` and `8`. In version `7`, support for [properties](#property) has been removed. In version `8`, support for [mingle](#mingle) has been removed.\n\nUsing a newer `format_version` includes all the behavior of the previous versions too.\n\n#### GoCD server version from 19.8.0 and beyond\n\nSupports `format_version` value of `6`. In this version, support of `allow_only_on_success` for [approval](#approval) on stage has been added. Setting this attribute will ensure that the manual trigger will be allowed only if the previous stage is successful.\n\nUsing a newer `format_version` includes all the behavior of the previous versions too.\n\n#### GoCD server version from 19.4.0 to 19.7.0\n\nSupports `format_version` value of `5`. In this version, support of `username` and `encrypted_password` for [git](#git-material-update) and [hg](#hg-material-update) material has been added. In addition to that, [hg](#hg-material-update) will also support `branch` attribute.\n\nUsing a newer `format_version` includes all the behavior of the previous versions too.\n\n#### GoCD server version from 19.3.0 to 19.4.0\n\nSupports `format_version` value of `4`. In this version, support has been added to control the [display order of pipelines](#display-order-of-pipelines).\n\nThis server version also supports `format_version` of `3` and `2`. Using a newer `format_version` includes all the behavior of the previous versions too.\n\n#### GoCD server version from 18.7.0 to 19.2.0\n\nSupports `format_version` value of `3`. In this version [fetch artifact](#fetch) format was changed to include `artifact_origin`.\n\nThis server version also supports `format_version` of `2`. Using a newer `format_version` includes all the behavior of the previous versions too.\n\n#### GoCD server version up to 18.6.0\n\nSupports `format_version` value of `2`. In this version [pipeline locking](#pipeline-locking) behavior was changed.\n\n\n# Environment\n\nConfigures a [GoCD environment](https://docs.gocd.org/current/configuration/managing_environments.html)\n\n```json\n{\n  \"name\": \"dev\",\n  \"environment_variables\": [\n    {\n      \"name\": \"key1\",\n      \"value\": \"value1\"\n    }\n  ],\n  \"agents\": [\n    \"123\"\n  ],\n  \"pipelines\": [\n    \"mypipeline1\"\n  ]\n}\n```\n\n# Environment variables\n\nEnvironment variables is a JSON array that can be declared in Environments, Pipelines, Stages and Jobs.\n\nAny variable must contain `name` and `value` or `encrypted_value`.\n\n```json\n{\n  \"environment_variables\": [\n    {\n      \"name\": \"key1\",\n      \"value\": \"value1\"\n    },\n    {\n      \"name\": \"keyd\",\n      \"encrypted_value\": \"v12@SDfwez\"\n    }\n  ]\n}\n```\n\n# Pipeline\n\n```json\n{\n  \"format_version\" : 1,\n  \"group\": \"group1\",\n  \"name\": \"pipe2\",\n  \"label_template\": \"foo-1.0-${COUNT}\",\n  \"enable_pipeline_locking\" : false,\n  \"parameters\": [\n    {\n      \"name\": \"param\",\n      \"value\": \"parameter\"\n    }\n  ],\n  \"tracking_tool\": null,\n  \"timer\": {\n    \"spec\": \"0 15 10 * * ? *\"\n  },\n  \"environment_variables\": [],\n  \"materials\": [\n    ...\n  ],\n  \"stages\": [\n    ...\n  ]\n}\n```\n\n#### Referencing an existing template in a config repo:\n\n```json\n{\n  \"format_version\" : 1,\n  \"group\": \"group1\",\n  \"name\": \"pipe-with-template\",\n  \"label_template\": \"foo-1.0-${COUNT}\",\n  \"enable_pipeline_locking\" : false,\n  \"template\": \"template1\",\n  \"parameters\": [\n    {\n      \"name\": \"param\",\n      \"value\": \"parameter\"\n    }\n  ],\n  \"materials\": [\n    ...\n  ]\n}\n```\n\nPlease note:\n\n * Pipeline declares a group to which it belongs\n\n### Pipeline locking\n\nExpected since GoCD v17.12, you need to use `lock_behavior` rather than `enable_pipeline_locking`.\n```\n\"lock_behavior\" : \"none\"\n```\n\n`lock_behavior` can be one of:\n * `lockOnFailure` - same as `enable_pipeline_locking: true`\n * `unlockWhenFinished` -\n * `none` - same `enable_pipeline_locking: false`\n\n\u003ca name=\"display-order-of-pipelines\"/\u003e\n\n### Controlling the display order\n\nWhen `format_version` is `4` (see [above](#format-version)), the order of display of pipelines on the GoCD dashboard can be influenced by setting the `display_order_weight` property.\n\n- This is an integer property and the pipelines in a pipeline group will be ordered by this value.\n- The default value for this property is `-1`.\n- Pipelines defined in GoCD's config XML will also default to -1.\n- If multiple pipelines have the same `display_order_weight` value, their order relative to each other will be indeterminate.\n\n```json\n{\n  \"name\": \"pipeline1\",\n  \"group\": \"pg1\",\n  \"display_order_weight\": 10\n},\n{\n  \"name\": \"pipeline2\",\n  \"group\": \"pg1\",\n  \"display_order_weight\": -10\n}\n```\n\nIn the above example, since both pipelines are in the same group, `pipeline2` will be shown ahead of `pipeline1`. If any pipelines are defined in the GoCD config XML, then they will appear in between these two pipelines.\n\n\n### Timer\n\n```json\n{\n    \"spec\": \"0 0 22 ? * MON-FRI\",\n    \"only_on_changes\": true\n}\n```\n\n### Tracking tool\n\n```json\n{\n  \"link\": \"http://your-trackingtool/yourproject/${ID}\",\n  \"regex\": \"evo-(\\\\d+)\"\n}\n```\n\n### Mingle\n**DEPRECATION NOTICE: Since GoCD version 19.9 and format_version 8, this is no longer supported**\n\n```json\n{\n    \"base_url\": \"https://mingle.example.com\",\n    \"project_identifier\": \"foobar_widgets\",\n    \"mql_grouping_conditions\": \"status \u003e 'In Dev'\"\n}\n```\n\n# Stage\n\n```json\n{\n  \"name\": \"test\",\n  \"fetch_materials\": true,\n  \"never_cleanup_artifacts\": false,\n  \"clean_working_directory\": false,\n  \"approval\" : null,\n  \"environment_variables\": [\n    {\n      \"name\": \"TEST_NUM\",\n      \"value\": \"1\"\n    }\n  ],\n  \"jobs\": [\n    ...\n  ]\n}\n```\n\n### Approval\n\n```json\n{\n  \"type\": \"manual\",\n  \"allow_only_on_success\": true,\n  \"users\": [],\n  \"roles\": [\n    \"manager\"\n  ]\n}\n```\n\n# Job\n\n```json\n{\n  \"name\": \"test\",\n  \"run_instance_count\" : null,\n  \"environment_variables\": [],\n  \"timeout\": 180,\n  \"elastic_profile_id\": \"docker-big-image-1\",\n  \"tabs\": [\n     {\n       \"name\": \"test\",\n       \"path\": \"results.xml\"\n     }\n   ],\n   \"resources\": [\n    \"linux\"\n  ],\n  \"artifacts\": [\n    {\n      \"source\": \"src\",\n      \"destination\": \"dest\",\n      \"type\": \"test\"\n    },\n    {\n      \"type\": \"external\",\n      \"id\": \"docker-release-candidate\",\n      \"store_id\": \"dockerhub\",\n      \"configuration\": [\n        {\n          \"key\": \"Image\",\n          \"value\": \"gocd/gocd-demo\"\n        },\n        {\n          \"key\": \"Tag\",\n          \"value\": \"${GO_PIPELINE_COUNTER}\"\n        },\n        {\n          \"key\": \"some_secure_property\",\n          \"encrypted_value\": \"!@ESsdD323#sdu\"\n        }\n      ]\n    }\n  ],\n  \"tasks\": [\n    ...\n  ]\n}\n```\n\n### Artifacts\n\nThere are 3 types of artifacts recognized by GoCD. `Build` and `Test` artifacts are stored on the GoCD server.\nThe source and the destination of the artifact that should be stored on the GoCD server must be specified.\n\n#### Build\n\n```json\n{\n  \"source\": \"src\",\n  \"destination\": \"dest\",\n  \"type\": \"build\"\n}\n```\n\n#### Test\n\n```json\n{\n  \"source\": \"src\",\n  \"destination\": \"dest\",\n  \"type\": \"test\"\n}\n```\n\n#### External\n\nArtifacts of type `external` are stored in an artifact store outside of GoCD.\nThe external artifact store's configuration must be created in the main GoCD config. Support for external artifact store config to be checked in as yaml is not available.\nThe external artifact store is referenced by the `store_id`. The build specific artifact details that the artifact plugin needs to publish the artifact is provided as `configuration`.\n\n```json\n{\n  \"type\": \"external\",\n  \"id\": \"docker-release-candidate\",\n  \"store_id\": \"dockerhub\",\n  \"configuration\": [\n    {\n      \"key\": \"Image\",\n      \"value\": \"gocd/gocd-demo\"\n    },\n    {\n      \"key\": \"Tag\",\n      \"value\": \"${GO_PIPELINE_COUNTER}\"\n    },\n    {\n      \"key\": \"some_secure_property\",\n      \"encrypted_value\": \"!@ESsdD323#sdu\"\n    }\n  ]\n}\n```\n\n### Property\n**DEPRECATION NOTICE: Since GoCD version 19.9 and format_version 7, properties are no longer supported**\n\n```json\n{\n  \"name\": \"coverage.class\",\n  \"source\": \"target/emma/coverage.xml\",\n  \"xpath\": \"substring-before(//report/data/all/coverage[starts-with(@type,'class')]/@value, '%')\"\n}\n```\n\n### Tab\n\n```json\n{\n      \"name\": \"cobertura\",\n      \"path\": \"target/site/cobertura/index.html\"\n}\n```\n\n### Run many instances\n\nPart of **job** object can be [number of job to runs](https://docs.gocd.org/current/advanced_usage/admin_spawn_multiple_jobs.html)\n```json\n\"run_instance_count\" : 6\n```\nOr to run on all agents\n```json\n\"run_instance_count\" : \"all\"\n```\nDefault is `null` which runs just one job.\n\n# Materials\n\nAll materials:\n\n * must have `type` - `git`, `svn`, `hg`, `p4`, `tfs`, `dependency`, `package`, `plugin`.\n * can have `name` and must have `name` when there is more than one material in pipeline\n\nSCM-related materials have `destination` field.\n\n### Filter - blacklist and whitelist\n\nAll scm materials can have filter object:\n\n * for **blacklisting**:\n```json\n\"filter\": {\n  \"ignore\": [\n    \"externals\",\n    \"tools\"\n  ]\n}\n```\n\n* for **whitelisting** (since Go `\u003e=16.7.0`):\n```json\n\"filter\": {\n \"whitelist\": [\n   \"moduleA\"\n ]\n}\n```\n\n## Git\n\n```json\n{\n  \"url\": \"http://my.git.repository.com\",\n  \"branch\": \"feature12\",\n  \"filter\": {\n    \"ignore\": [\n      \"externals\",\n      \"tools\"\n    ]\n  },\n  \"destination\": \"dir1\",\n  \"auto_update\": false,\n  \"name\": \"gitMaterial1\",\n  \"type\": \"git\",\n  \"shallow_clone\": true,\n  \"username\": \"user1\",\n  \"encrypted_password\": \"encrypted_value\"\n}\n```\n\u003ca name=\"git-material-update\"/\u003e\n\nFor **GoCD \u003e= 19.4.0 and `format_version: 5` and above**:\n\nYou are advised to utilize `username` and `encrypted_password` for passing in material credentials as:\n\n```json\n{\n  \"url\": \"http://my.git.repository.com\",\n  \"branch\": \"feature12\",\n  \"username\": \"user1\",\n  \"encrypted_password\": \"encrypted_value\"\n}\n```\n\n- Instead of `encrypted_password` you may specify `password` but `encrypted_password` makes more sense considering that the value is stored in SCM.\n- Specifying credentials both in `attributes` and `url` will result in a validation error e.g.\n  ```log\n    INVALID MERGED CONFIGURATION\n    Number of errors: 1+\n    1. Ambiguous credentials, must be provided either in URL or as attributes.;;\n    - For Config Repo: https://your.config.repo.url at cbb047d78c239ab23b9565099e800c6fe4cc0anc\n  ```\n\n## Svn\n\n```json\n{\n  \"url\": \"http://svn\",\n  \"username\": \"user1\",\n  \"encrypted_password\": \"encrypted_value\",\n  \"check_externals\": true,\n  \"filter\": {\n    \"ignore\": [\n      \"tools\",\n      \"lib\"\n    ]\n  },\n  \"destination\": \"destDir1\",\n  \"auto_update\": false,\n  \"name\": \"svnMaterial1\",\n  \"type\": \"svn\"\n}\n```\n\nInstead of `encrypted_password` you may specify `password` but `encrypted_password` makes more sense considering that the value is stored in SCM.\n\n## Hg\n\n```json\n{\n  \"url\": \"repos/myhg\",\n  \"filter\": {\n    \"ignore\": [\n      \"externals\",\n      \"tools\"\n    ]\n  },\n  \"destination\": \"dir1\",\n  \"auto_update\": false,\n  \"name\": \"hgMaterial1\",\n  \"type\": \"hg\",\n  \"username\": \"user1\",\n  \"encrypted_password\": \"encrypted_value\",\n  \"branch\": \"feature\"\n}\n```\n\u003ca name=\"hg-material-update\"/\u003e\n\nFor **GoCD \u003e= 19.4.0 and `format_version: 5` and above**:\n\nYou are advised to utilize `username` and `encrypted_password` for passing in material credentials as:\n\n```json\n{\n  \"url\": \"repos/myhg\",\n  \"username\": \"user1\",\n  \"encrypted_password\": \"encrypted_value\"\n}\n```\n\n- Instead of `encrypted_password` you may specify `password` but `encrypted_password` makes more sense considering that the value is stored in SCM.\n- Specifying credentials both in `attributes` and `url` will result in a validation error e.g.\n  ```log\n    INVALID MERGED CONFIGURATION\n    Number of errors: 1+\n    1. Ambiguous credentials, must be provided either in URL or as attributes.;;\n    - For Config Repo: https://your.config.repo.url at cbb047d78c239ab23b9565099e800c6fe4cc0anc\n  ```\n\nIn addition to that, you can also leverage `branch` attribute to specify the branch for material\n\n```json\n{\n  \"branch\": \"feature\"\n}\n```\n\n## Perforce\n\n```json\n{\n  \"port\": \"10.18.3.102:1666\",\n  \"username\": \"user1\",\n  \"encrypted_password\": \"encrypted_value\",\n  \"use_tickets\": false,\n  \"view\": \"//depot/dev/src...          //anything/src/...\",\n  \"filter\": {\n    \"ignore\": [\n      \"lib\",\n      \"tools\"\n    ]\n  },\n  \"destination\": \"dir1\",\n  \"auto_update\": false,\n  \"name\": \"p4materialName\",\n  \"type\": \"p4\"\n}\n```\n\nInstead of `encrypted_password` you may specify `password` but `encrypted_password` makes more sense considering that the value is stored in SCM.\n\n## Tfs\n\n```json\n{\n  \"url\": \"url3\",\n  \"username\": \"user4\",\n  \"domain\": \"example.com\",\n  \"encrypted_password\": \"encrypted_value\",\n  \"project\": \"projectDir\",\n  \"filter\": {\n    \"ignore\": [\n      \"tools\",\n      \"externals\"\n    ]\n  },\n  \"destination\": \"dir1\",\n  \"auto_update\": false,\n  \"name\": \"tfsMaterialName\",\n  \"type\": \"tfs\"\n}\n```\n\nInstead of `encrypted_password` you may specify `password` but `encrypted_password` makes more sense considering that the value is stored in SCM.\n\n## Dependency\n\n```json\n{\n  \"pipeline\": \"pipeline2\",\n  \"stage\": \"build\",\n  \"name\": \"pipe2\",\n  \"type\": \"dependency\",\n  \"ignore_for_scheduling\": false\n}\n```\n\n## Package\n\n```json\n{\n  \"package_id\": \"apt-repo-id\",\n  \"name\": \"myapt\",\n  \"type\": \"package\"\n}\n```\n\n## Pluggable SCM\n\n```json\n{\n  \"scm_id\": \"someScmGitRepositoryId\",\n  \"destination\": \"destinationDir\",\n  \"filter\": {\n    \"ignore\": [\n      \"dir1\",\n      \"dir2\"\n    ]\n  },\n  \"name\": \"myPluggableGit\",\n  \"type\": \"plugin\"\n}\n```\n\nSince GoCD `\u003e= 19.2.0` defining new pluggable materials that are not defined\nin the GoCD server is supported.\n\n```json\n{\n  \"plugin_configuration\": {\n    \"id\": \"plugin_id\",\n    \"version\": \"1\"\n  },\n  \"configuration\": [\n    {\n      \"key\": \"url\",\n      \"value\": \"git@github.com:tomzo/gocd-json-config-plugin.git\"\n    }\n  ],\n  \"destination\": \"destinationDir\",\n  \"filter\": {\n    \"ignore\": [\n      \"dir1\",\n      \"dir2\"\n    ]\n  },\n  \"name\": \"myPluggableGit\",\n  \"type\": \"plugin\"\n}\n```\n\n## Configrepo\n\nThis is a convenience for shorter and more consistent material declaration.\nWhen configuration repository is the same as one of pipeline materials,\nthen you usually need to repeat definitions in XML and in JSON, for example:\n\n```json\n...\n  \"materials\": [\n    {\n      \"url\": \"https://github.com/tomzo/gocd-json-config-example.git\",\n      \"branch\" : \"ci\",\n      \"type\": \"git\",\n      \"name\" : \"mygit\"\n    }\n  ],\n...\n```\n\nAnd in server XML:\n```xml\n\u003cconfig-repos\u003e\n   \u003cconfig-repo pluginId=\"json.config.plugin\" id=\"repo1\"\u003e\n     \u003cgit url=\"https://github.com/tomzo/gocd-json-config-example.git\" branch=\"ci\" /\u003e\n   \u003c/config-repo\u003e\n\u003c/config-repos\u003e\n```\n\nNotice that url and branch is repeated. This is inconvenient in case when you move repository,\nbecause it requires 2 updates, in code and in server XML.\n\nUsing  **`configrepo` material type**, above repetition can be avoided,\nlast example can be refactored into:\n\n```json\n...\n  \"materials\": [\n    {\n      \"type\": \"configrepo\",\n      \"name\" : \"mygit\"\n    }\n  ],\n...\n```\n\nServer interprets `configrepo` material in this way:\n\n\u003e Clone the material configuration of the repository we are parsing **as is in XML** and replace **name, destination and filters (whitelist/blacklist)**,\nthen use the modified clone in place of `configrepo` material.\n\n\n# Tasks\n\nEvery task object must have `type` field. Which can be `exec`, `ant`, `nant`, `rake`, `fetch`, `plugin`\n\nOptionally any task can have `run_if` and `on_cancel`.\n\n * `run_if` is a string. Valid values are `passed`, `failed`, `any`\n * `on_cancel` is a task object. Same rules apply as to tasks described on this page.\n\n### Exec\n\n```json\n{\n    \"type\": \"exec\",\n    \"run_if\": \"passed\",\n    \"on_cancel\" : null,\n    \"command\": \"make\",\n    \"arguments\": [\n      \"-j3\",\n      \"docs\",\n      \"install\"\n    ],\n    \"working_directory\": null\n}\n```\n\n### Ant\n\n```json\n{\n  \"build_file\": \"mybuild.xml\",\n  \"target\": \"compile\",\n  \"type\": \"ant\",\n  \"run_if\": \"any\",\n  \"on_cancel\" : null,\n}\n```\n\n### Nant\n\n```json\n{\n  \"type\": \"nant\",\n  \"run_if\": \"passed\",\n  \"working_directory\": \"script/build/123\",\n  \"build_file\": null,\n  \"target\": null,\n  \"nant_path\": null\n}\n```\n\n### Rake\n\n```json\n{\n  \"type\": \"rake\",\n  \"run_if\": \"passed\",\n  \"working_directory\": \"sample-project\",\n  \"build_file\": null,\n  \"target\": null\n}\n```\n\n### Fetch\n\n#### Fetch artifact from the GoCD server\n\n```json\n{\n   \"type\": \"fetch\",\n   \"artifact_origin\": \"gocd\",\n   \"run_if\": \"any\",\n   \"pipeline\": \"upstream\",\n   \"stage\": \"upstream_stage\",\n   \"job\": \"upstream_job\",\n   \"is_source_a_file\": false,\n   \"source\": \"result\",\n   \"destination\": \"test\"\n }\n```\n\n#### Fetch artifact from an external artifact store\n\n```json\n{\n   \"type\": \"fetch\",\n   \"artifact_origin\": \"external\",\n   \"run_if\": \"any\",\n   \"pipeline\": \"upstream\",\n   \"stage\": \"upstream_stage\",\n   \"job\": \"upstream_job\",\n   \"artifact_id\": \"upstream_external_artifactid\",\n   \"configuration\": [\n     {\n       \"key\": \"DestOnAgent\",\n       \"value\": \"foo\"\n     },\n     {\n       \"key\": \"some_secure_property\",\n       \"encrypted_value\": \"ssd#%fFS*!Esx\"\n     }\n   ]\n }\n```\n\n### Plugin\n\n```json\n{\n  \"type\": \"plugin\",\n  \"configuration\": [\n    {\n      \"key\": \"ConverterType\",\n      \"value\": \"jsunit\"\n    },\n    {\n      \"key\": \"password\",\n      \"encrypted_value\": \"ssd#%fFS*!Esx\"\n    }\n  ],\n  \"run_if\": \"passed\",\n  \"plugin_configuration\": {\n    \"id\": \"xunit.converter.task.plugin\",\n    \"version\": \"1\"\n  },\n  \"on_cancel\": null\n}\n```\n\n# Development\n\n## Environment setup\n\nTo build and test this plugin, you'll need java jdk \u003e= 8.\n\nIf you have local java environment, then you may run all tests and create a ready to use jar with:\n```bash\n./gradlew test jar\n```\n\n## Building with docker and dojo\n\nYou don't need to setup java on your host, if you are fine with using docker and [Dojo](https://github.com/ai-traders/dojo).\nThis is actually how our GoCD builds the plugin:\n```\ndojo \"gradle test jar\"\n```\n\nAssuming you already have a working docker, On OSX, you can install with homebrew:\n```\nbrew install kudulab/homebrew-dojo-osx/dojo\n```\nA manual install is another option:\n```sh\nversion=\"0.9.0\"\n# on Linux:\nwget -O /tmp/dojo https://github.com/kudulab/dojo/releases/download/${version}/dojo_linux_amd64\n# or on Darwin:\n# wget -O /tmp/dojo https://github.com/kudulab/dojo/releases/download/${version}/dojo_darwin_amd64\nchmod +x /tmp/dojo\nmv /tmp/dojo /usr/bin/dojo\n```\n\nThen enter a docker container with java and gradle pre-installed, by running following command at the root of the project:\n```\ndojo\n```\n\n# Issues and questions\n\n * If you have **questions on usage**, please ask them on the GoCD [Google Groups forum](https://groups.google.com/g/go-cd) or \n[GitHub Discussions](https://github.com/gocd/gocd/discussions).\n\n * If you think there is a bug, or you have an idea for a feature and *you are not sure if it's plugin's or [GoCD](https://github.com/gocd/gocd/issues) fault/responsibity*, please ask on the chat first too.\n\nPlease note this brief overview of what is done by the plugin:\n * parsing files into json when GoCD server asks for it.\n\nAnd this is done by the GoCD server:\n * complex logic merging multiple config repo sources and XML\n * validation of pipelines/stages/jobs/tasks domain\n * any UI rendering\n\n## Versioning\n\nWe use semantic versioning.\n\nIf you are submitting a new feature or patch, please bump the version in `build.gradle`.\n\n# License\n\nCopyright 2019 Tomasz Sętkowski\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomzo%2Fgocd-json-config-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftomzo%2Fgocd-json-config-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomzo%2Fgocd-json-config-plugin/lists"}