Skip to content

Commit 505e089

Browse files
committed
Merge branch 'release/1.0.0'
2 parents 44e1336 + df99022 commit 505e089

File tree

4 files changed

+85
-1
lines changed

4 files changed

+85
-1
lines changed

Dockerfile

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
FROM rancher/cli:v2.0.4
2+
3+
# install dependencies
4+
RUN apk add --no-cache curl
5+
6+
# install kubectl
7+
RUN curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.12.0/bin/linux/amd64/kubectl \
8+
&& chmod +x ./kubectl \
9+
&& mv ./kubectl /usr/local/bin/kubectl
10+
11+
# add rancher-redeploy script
12+
COPY bin/rancher-redeploy /usr/local/bin/
13+
RUN chmod +x /usr/local/bin/rancher-redeploy
14+
15+
# reset entrypoint
16+
ENTRYPOINT []

LICENSE.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) Sourceboat GmbH & Co. KG <[email protected]>
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

bin/rancher-redeploy

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/sh
2+
rancher kubectl patch deployment $2 -n $1 -p \ "{\"spec\":{\"template\":{\"metadata\":{\"labels\":{\"ci_deployment_date\":\"`date +'%s'`\"}}}}}"

readme.md

+46-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,50 @@
1-
# Rancher Deploy
1+
# sourceboat/rancher-deploy
2+
3+
[![Docker Build Status](https://img.shields.io/docker/build/sourceboat/rancher-deploy.svg?style=flat-square)](https://hub.docker.com/r/sourceboat/rancher-deploy/builds/)
4+
[![Release](https://img.shields.io/github/release/sourceboat/rancher-deploy.svg?style=flat-square)](https://github.com/sourceboat/rancher-deploy/releases)
5+
[![Docker Pulls](https://img.shields.io/docker/pulls/sourceboat/rancher-deploy.svg?style=flat-square)](https://hub.docker.com/r/sourceboat/rancher-deploy/)
6+
[![MicroBadger Size](https://img.shields.io/microbadger/image-size/sourceboat/rancher-deploy.svg?style=flat-square)](https://microbadger.com/images/sourceboat/rancher-deploy)
7+
[![MicroBadger Layers](https://img.shields.io/microbadger/layers/sourceboat/rancher-deploy.svg?style=flat-square)](https://microbadger.com/images/sourceboat/rancher-deploy)
28

39
This docker image enables simple deployments to Rancher.
410
It is a small alpine image with [Rancher CLI](https://rancher.com/docs/rancher/v2.x/en/cli/) `rancher`
511
and [Kubernetes CLI](https://kubernetes.io/docs/tasks/tools/install-kubectl/) `kubectl` installed.
12+
13+
It also comes with a custom `rancher-redeploy` command (see usage section).
14+
15+
## Usage
16+
17+
### Simple Redeploy via GitLab CI
18+
19+
To use this image via GitLab CI add the following to the `.gitlab-ci.yml`:
20+
21+
```yml
22+
deploy:
23+
stage: deploy
24+
image: sourceboat/rancher-deploy:stable
25+
variables:
26+
RANCHER_URL: https://rancher.example.com
27+
K8S_NAMESPACE: my-namespace-name
28+
K8S_DEPLOYMENT: my-deployment-name
29+
script:
30+
- rancher login $RANCHER_URL --token $RANCHER_TOKEN
31+
- rancher-redeploy $K8S_NAMESPACE $K8S_DEPLOYMENT
32+
```
33+
34+
Don't forget to provide `$RANCHER_TOKEN` via GitLab CI/CD variable.
35+
36+
This will trigger a redeploy of the given Kubernetes deployment by updating a label
37+
and pull the newest image if configured correctly.
38+
39+
## Changelog
40+
41+
Check [releases](https://github.com/sourceboat/rancher-deploy/releases) for all notable changes.
42+
43+
## Credits
44+
45+
- [Phil-Bastian Berndt](https://github.com/pehbehbeh)
46+
- [All Contributors](https://github.com/sourceboat/rancher-deploy/graphs/contributors)
47+
48+
## License
49+
50+
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

0 commit comments

Comments
 (0)