Skip to content

This docker image enables simple deployments to Rancher.

License

Notifications You must be signed in to change notification settings

sourceboat/rancher-deploy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sourceboat/rancher-deploy

Docker Build Status Release Docker Pulls MicroBadger Size MicroBadger Layers

This docker image enables simple deployments to Rancher.

What's included?

It also comes with a custom rancher-redeploy and rancher-exec command helper (see usage section).

Usage

Simple Redeploy via GitLab CI and rancher-redeploy helper

To use this image via GitLab CI add the following to the .gitlab-ci.yml:

deploy:
  stage: deploy
  image: sourceboat/rancher-deploy:latest
  variables:
    RANCHER_URL: https://rancher.example.com
    K8S_NAMESPACE: my-namespace-name
    K8S_DEPLOYMENT: my-deployment-name
  script:
    - rancher login $RANCHER_URL --token $RANCHER_TOKEN
    - rancher-redeploy $K8S_NAMESPACE $K8S_DEPLOYMENT

Don't forget to provide $RANCHER_TOKEN via GitLab CI/CD variable.

This will trigger a redeploy of the given Kubernetes deployment by updating a label and pull the newest image if configured correctly.

Execute Command via rancher-exec helper

You can also execute commands in pods of your deployment via rancher-exec $K8S_NAMESPACE $K8S_DEPLOYMENT 'ls'. This will execute the given command in the first pod of your deployment. Currently this is only tested with single container pods.

Changelog

Check releases for all notable changes.

Credits

License

The MIT License (MIT). Please see License File for more information.