Skip to content

Uber5/gitlab2rancher-deploy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Status

Works for us 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.

About

Upgrade a Rancher service from a Gitlab CI script

Resources

License

Stars

Watchers

Forks

Packages

No packages published