{"id":13295501,"url":"https://github.com/mdb/concourse-consul-kv-resource","last_synced_at":"2025-04-11T21:51:27.185Z","repository":{"id":47452200,"uuid":"91951100","full_name":"mdb/concourse-consul-kv-resource","owner":"mdb","description":"A Concourse resource for getting and setting values to and from Consul's KV store","archived":false,"fork":false,"pushed_at":"2023-03-01T16:47:37.000Z","size":210,"stargazers_count":4,"open_issues_count":6,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-25T17:49:31.183Z","etag":null,"topics":["concourse","concourse-ci","concourse-resource","consul"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mdb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2017-05-21T11:05:33.000Z","updated_at":"2022-11-01T04:37:14.000Z","dependencies_parsed_at":"2024-10-23T10:04:54.611Z","dependency_job_id":"82b71493-0529-42b7-a57d-98e4cd9edb86","html_url":"https://github.com/mdb/concourse-consul-kv-resource","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdb%2Fconcourse-consul-kv-resource","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdb%2Fconcourse-consul-kv-resource/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdb%2Fconcourse-consul-kv-resource/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mdb%2Fconcourse-consul-kv-resource/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mdb","download_url":"https://codeload.github.com/mdb/concourse-consul-kv-resource/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248487733,"owners_count":21112188,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["concourse","concourse-ci","concourse-resource","consul"],"created_at":"2024-07-29T17:17:06.305Z","updated_at":"2025-04-11T21:51:27.152Z","avatar_url":"https://github.com/mdb.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Docker Automated build](https://img.shields.io/docker/automated/clapclapexcitement/concourse-consul-kv-resource.svg?style=flat)](https://hub.docker.com/r/clapclapexcitement/concourse-consul-kv-resource/)\n[![Build Status](https://travis-ci.org/mdb/concourse-consul-kv-resource.svg?branch=master)](https://travis-ci.org/mdb/concourse-consul-kv-resource)\n\n# concourse-consul-kv-resource\n\nA [Concourse](http://concourse.ci/) resource for interacting with [Consul's KV store](https://www.consul.io/api/kv.html).\n\n`concourse-consul-kv-resource` can be used to get or set a key/value in Consul's KV store.\n\n## Source configuration\n\n* `host`: _Required_. The Consul host.\n* `key`: _Required_. The Consul key to interact with. Note that all URL path parts following `/v1/kv` are required. For example, if your key is `my-consul:8500/v1/kv/my/key`, then `key` should be \"my/key\".\n* `token`: _Optional_. A Consul ACL token.\n* `tls_cert`: _Optional_. A TLS cert for the Consul.\n* `tls_key`: _Optional_. A TLS cert key for the Consul.\n* `ca`: _Optional_. A CA cert for the Consul.\n* `port`: _Optional_. The port on which the Consul API is hosted. Defaults to `8500`.\n* `protocol`: _Optional_. The protocol to use in calling the Consul API. Defaults to `https`.\n* `skip_cert_check`: _Optional_. Check the validity of the SSL cert.\n\n## Behavior\n\n### `in`: Get a Consul KV key's value\n\nGets the value of the Consul KV key configured in the source. The key's plain text value is written to a `\u003cresource-get\u003e/\u003ckey-name\u003e` file.\n\nFor example, the following pipeline's `get-my-consul-key` job writes the `foo` key's value to a `my-consul-key/my/key` file:\n\n```yaml\n...\n\nresources:\n\n- name: my-consul-key\n  type: consul-kv\n  source:\n    token: my-acl-token\n    host: my-consul.com\n    tls_cert: my-cert-string\n    tls_key: my-cert-key-string\n    key: my/key\n\njobs:\n\n- name: get-my-consul-key\n  plan:\n  - get: my-consul-key\n```\n\n### `out`: Set a Consul KV key's value\n\nSets the Consul KV key configured in the source to the value specified in the params.\n\n#### Parameters\n\n`value` _or_ `file` must be set. Both cannot be set.\n\n* `value`: _Optional_. The value to set the key to.\n* `file`: _Optional_. The path to a file in which the intended value is written.\n\n## Example pipeline\n\n```yaml\nresources:\n\n- name: my-consul-key\n  type: consul-kv\n  source:\n    token: my-acl-token\n    host: my-consul.com\n    tls_cert: my-cert-string\n    tls_key: my-cert-key-string\n    key: my/key\n\nresource_types:\n\n- name: consul-kv\n  type: docker-image\n  source:\n    repository: clapclapexcitement/concourse-consul-kv-resource\n    tag: latest\n\njobs:\n\n- name: get-my-consul-key\n  plan:\n  - get: my-consul-key\n\n- name: set-my-consul-key\n  plan:\n  - put: my-consul-key\n    params:\n      value: 'foobar'\n\n- name: set-my-consul-key-from-a-file\n  plan:\n  - put: my-consul-key\n    params:\n      file: my-new-key/my-key-file\n```\n\n## Development \u0026 testing\n\n`concourse-consul-kv-resource` development assumes relative familiarity with [Node.js](https://nodejs.org) and [Docker](https://www.docker.com/).\n\nTo build and test `concourse-consul-kv-resource`:\n\n```\nmake\n```\n\nThis...\n\n1. builds a `concourse-consul-kv-resource` Docker image by...\n    1. installing the Node.js JavaScript dependencies\n    2. linting the Node.js JavaScript source code\n    3. running the Node.js JavaScript-based unit tests\n    4. installing the `concourse-consul-kv-resource` Node.js JavaScript source code in the resulting Docker image\n2. runs a suite of acceptance tests against the resulting `concourse-consul-kv-resource` Docker image that...\n    1. use `docker-compose` to start a local Consul seeded with a `my/key` key\n    2. run the `concourse-consul-kv-resource` Docker image with various standard input stream JSON structures and arguments that exercise the image's `check`, `in`, and `out` functionality using the local Consul\n\n### Functional testing\n\n`concourse-consul-kv-resource`'s `docker-compose.yml` can also be used to start a local Concourse, Consul, and Docker registry for test driving a local `concourse-consul-kv-resource` Docker image build.\n\n1. run `docker-compose up` to start a `localhost:8080` Concourse, a `localhost:5000` Docker registry, and a `localhost:8500` Consul.\n2. build a local `localhost:5000/concourse-consul-kv-resource:latest` `concourse-consul-kv-resource` image and publish it to the `localhost:5000` Docker registry:\n    ```bash\n    docker build --tag \\\n      localhost:5000/concourse-consul-kv-resource:latest .\n    ```\n    ```bash\n    docker login \\\n      --username test \\\n      --password test \\\n      http://localhost:5000 \\\n    ```\n    ```bash\n    docker push \\\n      localhost:5000/concourse-consul-kv-resource:latest\n    ```\n3. Download the appropriate `fly` for your platform from the Concourse homepage; make it executable. For example:\n    ```bash\n    curl \\\n      --output fly \\\n      http://localhost:8080/api/v1/cli\\?arch\\=amd64\\\u0026platform\\=darwin\n\n    chmod +x fly\n    ```\n4. log into the `localhost:8080` Concourse via `fly` using the username/password combo `test/test`:\n    ```bash\n    ./fly \\\n      --target \"local\" login \\\n      --username test \\\n      --password test \\\n      --concourse-url http://localhost:8080\n    ```\n5. use the `pipeline.yml` in this repo to set and unpause a `test` pipeline:\n    ```bash\n    ./fly \\\n      --target local set-pipeline \\\n      --pipeline test \\\n      --config pipeline.yml \\\n      --non-interactive\n    ```\n    ```bash\n    ./fly \\\n      --target local unpause-pipeline \\\n      --pipeline test\n    ```\n6. log into the `localhost:8080` Concourse in your web browser using username/password `test`/`test` and interact with the `test` pipeline. If you'd like to seed Consul with an initial `my/key` value:\n    ```bash\n    curl \\\n      --request PUT \\\n      --data my-value \\\n      http://localhost:8500/v1/kv/my-key\n    ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdb%2Fconcourse-consul-kv-resource","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmdb%2Fconcourse-consul-kv-resource","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmdb%2Fconcourse-consul-kv-resource/lists"}