https://github.com/Uber5/gitlab2rancher-deploy
Upgrade a Rancher service from a Gitlab CI script
https://github.com/Uber5/gitlab2rancher-deploy
Last synced: 11 months ago
JSON representation
Upgrade a Rancher service from a Gitlab CI script
- Host: GitHub
- URL: https://github.com/Uber5/gitlab2rancher-deploy
- Owner: Uber5
- License: mit
- Created: 2016-10-10T16:07:19.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2023-04-17T16:03:47.000Z (about 3 years ago)
- Last Synced: 2024-12-15T11:34:25.102Z (over 1 year ago)
- Language: JavaScript
- Size: 25.4 KB
- Stars: 14
- Watchers: 2
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Status
Works for [us](http://about.uber5.com) in production.
# How to Use
In `.gitlab-ci.yml`, probably in a `deploy` stage, install this package and run
a deploy script:
```
deploy:
stage: deploy
image: node:6
only:
- deploy-branch@some-name/my-project
script:
- npm install gitlab2rancher-deploy
- node scripts/deploy.js
```
... where `scripts/deploy.js` may look like this:
```
const upgrade = require('gitlab2rancher-deploy')
const serviceUrl = process.env.RANCHER_SERVICE_URL
upgrade(serviceUrl)
.catch(err => { console.log(err.stack); process.exit(1) })
```
... and after defining the service url as a Gitlab variabl, e.g.
```
RANCHER_SERVICE_URL=https://my-rancher.my-host.com/v1/projects/1a5/services/1s29
```
... and `RANCHER_ACCESS_KEY` and `RANCHER_SECRET_KEY` (under `API` in Rancher):
At the next push to branch `deploy-branch` of project `some-name/my-project`,
the Rancher service with id `1s29` should be upgraded accordingly.