{"id":21320455,"url":"https://github.com/eclass/rancher-for-ci","last_synced_at":"2025-07-12T04:32:54.192Z","repository":{"id":32921768,"uuid":"146328898","full_name":"eclass/rancher-for-ci","owner":"eclass","description":"A way to upgrade only the given service's docker image version.","archived":false,"fork":false,"pushed_at":"2024-10-03T12:53:27.000Z","size":755,"stargazers_count":0,"open_issues_count":26,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-11-13T06:27:46.458Z","etag":null,"topics":["ci","eclass","rancher"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eclass.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}},"created_at":"2018-08-27T17:07:52.000Z","updated_at":"2021-11-13T21:21:31.000Z","dependencies_parsed_at":"2024-04-14T13:23:49.663Z","dependency_job_id":"e95015a6-ce98-4d71-9a9d-a3df5de04691","html_url":"https://github.com/eclass/rancher-for-ci","commit_stats":{"total_commits":396,"total_committers":7,"mean_commits":56.57142857142857,"dds":"0.23232323232323238","last_synced_commit":"9434999054615bc447fda13d7194d14540df5b87"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eclass%2Francher-for-ci","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eclass%2Francher-for-ci/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eclass%2Francher-for-ci/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eclass%2Francher-for-ci/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eclass","download_url":"https://codeload.github.com/eclass/rancher-for-ci/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225795392,"owners_count":17525316,"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":["ci","eclass","rancher"],"created_at":"2024-11-21T19:47:55.480Z","updated_at":"2024-11-21T19:47:56.168Z","avatar_url":"https://github.com/eclass.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Rancher for CI\n\nBecause I needed a plugin that could upgrade only a given service's docker image version.\n\n**Attention**: This pluging supports only Rancher Environment API v1.\n\n\n## Parameters\n\n- **endpoint**: the environment API endpoint\n- **access key**: a valid environment API access key\n- **secret key**: a valid environment API secret key\n- **service**: the services which you want to upgrade\n- **version**: the version to which you want to upgrade\n\n\n## Using as a node module\n\nInstall it (`yarn add @eclass/rancher-for-ci` or `npm i -s @eclass/rancher-for-ci`) then use as in the example below:\n\n```js\nconst Rancher = require('@eclass/rancher-for-ci')\n\nconst client = new Rancher(\n  'https://rancher.domain.com/v1/projects/{ID}',\n  'MyAccessKey',\n  'MySecretKey'\n)\n\n;(async () =\u003e {\n    await client.upgrade('my-stack/my-service', '1.0.0')\n})()\n```\n\n\n## Using as a Drone CI plugin\n\n```yml\npipeline:\n    deploy:\n        image: rwillians/rancher-for-ci\n        service: my-stack/my-service\n        version: latest\n        secrets: [ rancher_url, rancher_access_key, rancher_secret_key ]\n```\n\n```diff\n pipeline:\n     deploy:\n         image: rwillians/rancher-for-ci\n         service: my-stack/my-service\n-        version: latest\n+        version: v1.0.10\n+        version_prefix: v\n         secrets: [ rancher_url, rancher_access_key, rancher_secret_key ]\n```\n\n```yml\npipeline:\n    deploy:\n        image: rwillians/rancher-for-ci\n        endpoint: https://rancher.domain.com/v1/projects/{ID}\n        access_key: MyAccessKey\n        secret_key: MySecretKey\n        service: my-stack/my-service\n        version: 2.0.1-rc.1\n```\n\n### Overriding verson on drone deploy command\n\nYou can override the \"verion\" property buy passing a \"VERSION\" parameter to `deploy` command.\n`drone deploy owner/repo {BUILD} {ENVIRONMENT} -p VERSION=2.0.0`.\n\n\n### Using DRONE_TAG/CI_TAG as version\n\nIf you omit \"version\" propperty and do not pass the override version parameter, the plugin will try to use \"DRONE_TAG\" and \"CI_TAG\" as version.\n\n```diff\n pipeline:\n     deploy:\n         image: rwillians/rancher-for-ci\n         service: my-stack/my-service\n-        version: v1.0.10\n         version_prefix: v\n         secrets: [ rancher_url, rancher_access_key, rancher_secret_key ]\n```\n\n`drone deploy owner/repo {BUILD} {ENVIRONMENT}`\n\nNote that you should use a build resultant of a `tag` event, otherwise there won't be any \"DRONE_TAG\" or \"CI_TAG\" which will result in failure.\n\n\n### All properties\n\n#### service (required)\n\nThe service name which will be upgraded, e.g.: **service-name** or **stack-name/service-name**.\n\n\n#### version (optional)\n\nVersion to which you want to upgrade your service, e.g: **v1.0.1**.\n\nThis value can also be acquired from the environment variables **VERSION**, **PLUGIN_VERSION**, **DRONE_TAG**, **CI_TAG** and **DRONE_COMMIT_REF**.\n\n\n#### version_prefix (optional)\n\nRemove the version prefix, e.g.: if set to \"v\", then a version \"v1.0.0\" will become \"1.0.0\".\n\n\n#### release_variable (required)\n\nAdds an environment variable to Rancher containing the release version, eg: **SENTRY_RELEASE**.\n\n\n#### commit_variable (required)\n\nAdds an environment variable to Rancher containing the commit reference, eg: **SENTRY_GIT_COMMIT**.\n\n\n#### log_instructions (optional)\n\nAllow to log instructions sent to rancher (`true` or `false`), which might expose sensitive information.\n\n\n#### endpoint (optional)\n\nRancher api url for the environment you want to upgrade, e.g.: **https://rancher.domain.com/v1/**.\n\nThis value can also be acquired from the environment variable **RANCHER_URL**.\n\n\n#### access_key (optional)\n\nAccess key for the given Rancher api environment, e.g.: **FF4D832E2045B894577C**.\n\nThis value can also be acquired from the environment variable **RANCHER_ACCESS_KEY**.\n\n\n#### secret_key (optional)\n\nSecret key for the given Rancher api environment, e.g.: **XhwN2HCvYppbQQqgXNurmZLrrjGHhg81s2yETMCi**.\n\nThis value can also be acquired from the environment variable **RANCHER_SECRET_KEY**.\n\n\n### Development\n\n#### Build\n\n```sh\ndocker build -t rancher-for-ci .\n```\n\n#### Run\n\n```sh\ndocker run -ti \\\n    -e \"PLUGIN_ENDPOINT=$RANCHER_URL\" \\\n    -e \"PLUGIN_ACCESS_KEY=$RANCHER_ACCESS_KEY\" \\\n    -e \"PLUGIN_SECRET_KEY=$RANCHER_SECRET_KEY\" \\\n    -e PLUGIN_SERVICE=my-stack/my-service \\\n    -e PLUGIN_VERSION=v1.0.0 \\\n    -e PLUGIN_VERSION_PREFIX=v \\\n    -e PLUGIN_RELEASE_VARIABLE=SENTRY_RELEASE \\\n    -e PLUGIN_COMMIT_VARIABLE=SENTRY_GIT_COMMIT \\\n    -e DRONE_COMMIT_REF=c0deb10c4 \\\n    -e PLUGIN_LOG_INSTRUCTIONS=1 \\\n    rancher-for-ci --dry-run\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feclass%2Francher-for-ci","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feclass%2Francher-for-ci","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feclass%2Francher-for-ci/lists"}