{"id":16548745,"url":"https://github.com/lizheming/drone-js-config","last_synced_at":"2025-10-28T16:32:02.304Z","repository":{"id":55002163,"uuid":"170618836","full_name":"lizheming/drone-js-config","owner":"lizheming","description":"Drone extensions to support javascript configuration files","archived":false,"fork":false,"pushed_at":"2021-01-16T04:29:26.000Z","size":35,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-16T14:09:08.974Z","etag":null,"topics":["bitbucket","configuration","drone","extension","github","gitlab","javascript"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lizheming.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-02-14T03:11:08.000Z","updated_at":"2024-04-02T02:17:46.000Z","dependencies_parsed_at":"2022-08-14T08:40:54.421Z","dependency_job_id":null,"html_url":"https://github.com/lizheming/drone-js-config","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lizheming%2Fdrone-js-config","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lizheming%2Fdrone-js-config/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lizheming%2Fdrone-js-config/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lizheming%2Fdrone-js-config/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lizheming","download_url":"https://codeload.github.com/lizheming/drone-js-config/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219859101,"owners_count":16556037,"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":["bitbucket","configuration","drone","extension","github","gitlab","javascript"],"created_at":"2024-10-11T19:26:56.320Z","updated_at":"2025-10-28T16:32:01.949Z","avatar_url":"https://github.com/lizheming.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# drone-js-config\n\n![Docker Pulls](https://img.shields.io/docker/pulls/lizheming/drone-js.svg?logo=Docker\u0026logoColor=white\u0026style=flat)\n[![](https://images.microbadger.com/badges/image/lizheming/drone-js.svg)](https://microbadger.com/images/lizheming/drone-js)\n\nDrone extensions to support javascript configuration files, just like the following content. We support both github, gitlab, bitbucket, gogs and gitea.\n\n```js\n//.drone.js\nmodule.exports = [\n  Pipeline(\"node6\", \"node:6\"),\n  Pipeline(\"node8\", \"node:8\")\n];\n\nfunction Pipeline(name, image) {\n  return {\n    kind: \"pipeline\",\n    name,\n\n    steps: [\n      {\n        name: \"test\",\n        image,\n        commands: [\n          \"npm install\",\n          \"npm test\"\n        ]\n      }\n    ]\n  };\n}\n```\n\n## HOW TO USE\n\n1. Generate a shared secret key. This key is used to secure communication between the server and agents. The secret should be 32 bytes.\n    ```bash\n    $ openssl rand -hex 16\n    558f3eacbfd5928157cbfe34823ab921\n    ```\n\n2. Generate a GitHub/Gitlab/Bitbucket/Gogs/Gitea access token. This token is used to fetch the jsonnet configuration file from the repository. This token must therefore have sufficient permission to do so. Here is an example where to generate access token: \n    - Github: \u003chttps://github.com/settings/tokens\u003e\n    - Gitlab: \u003chttps://gitlab.com/profile/personal_access_tokens\u003e\n    - Bitbucket: \u003chttps://bitbucket.org/account/user/:username/app-passwords\u003e\n    - Gogs: \u003chttps://try.gogs.io/user/settings/applications\u003e\n    - Gitea: \u003chttps://try.gitea.io/user/settings/applications\u003e\n\n3. Install the plugin by pulling and running the container.\n    ```bash\n    docker run \\\n      -p 3000:3000 \\\n      -e PLUGIN_SECRET=558f3eacbfd5928157cbfe34823ab921 \\\n      -e GITHUB_TOKEN=GITHUB8168c98304b \\\n      lizheming/drone-js\n    ```\n4. Once the extension is installed and running, you need to modify your Drone server configuration and provide the extension endpoint and shared secret.\n    ```\n    -e DRONE_YAML_ENDPOINT=http://...\n    -e DRONE_YAML_SECRET=558f3eacbfd5928157cbfe34823ab921\n    ```\n5. Rename `Configuration` end with `.js` such as `.drone.js`.\n\n    ![](https://p.ssl.qhimg.com/t0139bb7e03f6f31cf3.png)\n\n6. At last, you just add `.drone.js` file to your repo. It should exports an array drone config object.\n    ```js\n    module.exports = [\n      Pipeline(\"node6\", \"node:6\"),\n      Pipeline(\"node8\", \"node:8\")\n    ];\n\n    function Pipeline(name, image) {\n      return {\n        kind: \"pipeline\",\n        name,\n\n        steps: [\n          {\n            name: \"test\",\n            image,\n            commands: [\n              \"npm install\",\n              \"npm test\"\n            ]\n          }\n        ]\n      };\n    }\n    ```\n\n## Settings\n\nWe take support for all VCS which drone supports, not only GitHub but also GitLab, Bitbucket, Gogs and Gitea. Let we have a look how config in different VCS.\n\n### Github\n\nYou should pass `GITHUB_TOKEN` to container, if you're using GitHub Enterprise, you should pass `GITHUB_SERVER` to custom server url.\n\n```bash\ndocker run \\\n  -p 3000:3000 \\\n  -e PLUGIN_SECRET=558f3eacbfd5928157cbfe34823ab921 \\\n  -e GITHUB_SERVER=https://api.github.com\n  -e GITHUB_TOKEN=GITHUB8168c98304b \\\n  lizheming/drone-js\n```\n\n### Gitlab\n\nYou should pass `GITLAB_TOKEN` to container, if you're self hosting GitLab, you should also pass `GITLAB_SERVER` to custom server url.\n\n```bash\ndocker run \\\n  -p 3000:3000 \\\n  -e PLUGIN_SECRET=558f3eacbfd5928157cbfe34823ab921 \\\n  -e GITLAB_SERVER=https://gitlab.com/api/v4\n  -e GITLAB_TOKEN=GITLAB8168c98304b \\\n  lizheming/drone-js\n```\n### Bitbucket\n\nYou should pass `BITBUCKET_USERNAME` and `BITBUCKET_APP_PASSWORD` to container, if you're using Bitbucket Server, you should also pass `BITBUCKET_SERVER` to set server url.\n\n\n```bash\ndocker run \\\n  -p 3000:3000 \\\n  -e PLUGIN_SECRET=558f3eacbfd5928157cbfe34823ab921 \\\n  -e BITBUCKET_SERVER=https://api.bitbucket.org/2.0\n  -e BITBUCKET_USERNAME=lizheming \\\n  -e BITBUCKET_APP_PASSWORD=BITBUCKET8168c98304b \\\n  lizheming/drone-js\n```\n\nBTW, if your bitbucket server support personal access token, you can pass it without bitbucket username.\n\n```bash\ndocker run \\\n  -p 3000:3000 \\\n  -e PLUGIN_SECRET=558f3eacbfd5928157cbfe34823ab921 \\\n  -e BITBUCKET_SERVER=https://api.bitbucket.org/2.0\n  -e BITBUCKET_TOKEN=BITBUCKET8168c98304b \\\n  lizheming/drone-js\n```\n\nYou can also just pass `BITBUCKET_USERNAME` and `BITBUCKET_PASSWORD`, but it'll fail if your account open two step authencation.\n\n```bash\ndocker run \\\n  -p 3000:3000 \\\n  -e PLUGIN_SECRET=558f3eacbfd5928157cbfe34823ab921 \\\n  -e BITBUCKET_SERVER=https://api.bitbucket.org/2.0\n  -e BITBUCKET_USERNAME=lizheming \\\n  -e BITBUCKET_PASSWORD=xxxx \\\n  lizheming/drone-js\n```\n\n### Gogs/Gitea\n\nYou should pass `GOGS_TOKEN` or `GITEA_TOKEN` to container, if you're self hosting Gogs/Gitea, you should also pass `GOGS_SERVER` or `GITEA_SERVER` to custom server url.\n\n```bash\ndocker run \\\n  -p 3000:3000 \\\n  -e PLUGIN_SECRET=558f3eacbfd5928157cbfe34823ab921 \\\n  -e GOGS_SERVER=https://try.gogs.io/api/v1 \\\n  -e GOGS_TOKEN=GOGS8168c98304b \\\n  lizheming/drone-js\n```\n\n## Configuration\n\n### PLUGIN_SECRET\n\nThe server and extension authenticate http requests using a shared secret. You must provide the shared secret to both the extenion and the server.\n\n```bash\ndocker run \\\n  -p 3000:3000 \\\n  -e PLUGIN_SECRET=558f3eacbfd5928157cbfe34823ab921 \\\n  -e GITHUB_TOKEN=GITHUB8168c98304b \\\n  lizheming/drone-js\n```\n\nAnd it should be same with `DRONE_YAML_SECRET`.\n\n## Environment\n\n- `PLUGIN_ADDRESS`\n- `PLUGIN_SECRET`\n- `GITHUB_SERVER`\n- `GITHUB_TOKEN`\n- `GITLAB_SERVER`\n- `GITLAB_TOKEN`\n- `BITBUCKET_SERVER`\n- `BITBUCKET_USERNAME`\n- `BITBUCKET_PASSWORD`\n- `BITBUCKET_APP_PASSWORD`\n- `GOGS_SERVER`\n- `GOGS_TOKEN`\n- `GITEA_SERVER`\n- `GITEA_TOKEN`","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flizheming%2Fdrone-js-config","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flizheming%2Fdrone-js-config","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flizheming%2Fdrone-js-config/lists"}