Skip to content

Commit 1a86808

Browse files
committed
Merge branch 'release/1.1.0'
2 parents 505e089 + 3bc7b37 commit 1a86808

3 files changed

Lines changed: 21 additions & 7 deletions

File tree

Dockerfile

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
FROM rancher/cli:v2.0.4
22

33
# install dependencies
4-
RUN apk add --no-cache curl
4+
RUN apk update \
5+
&& apk add --no-cache \
6+
ca-certificates \
7+
curl
58

69
# install kubectl
710
RUN curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.12.0/bin/linux/amd64/kubectl \
8-
&& chmod +x ./kubectl \
911
&& mv ./kubectl /usr/local/bin/kubectl
1012

11-
# add rancher-redeploy script
12-
COPY bin/rancher-redeploy /usr/local/bin/
13-
RUN chmod +x /usr/local/bin/rancher-redeploy
13+
# add helper scripts
14+
COPY bin/ /usr/local/bin/
15+
16+
## make all binaries executable
17+
RUN chmod +x /usr/local/bin/*
1418

1519
# reset entrypoint
1620
ENTRYPOINT []

readme.md renamed to README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ This docker image enables simple deployments to Rancher.
1010
It is a small alpine image with [Rancher CLI](https://rancher.com/docs/rancher/v2.x/en/cli/) `rancher`
1111
and [Kubernetes CLI](https://kubernetes.io/docs/tasks/tools/install-kubectl/) `kubectl` installed.
1212

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

1515
## Usage
1616

17-
### Simple Redeploy via GitLab CI
17+
### Simple Redeploy via GitLab CI and `rancher-redeploy` helper
1818

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

@@ -36,6 +36,12 @@ Don't forget to provide `$RANCHER_TOKEN` via GitLab CI/CD variable.
3636
This will trigger a redeploy of the given Kubernetes deployment by updating a label
3737
and pull the newest image if configured correctly.
3838

39+
### Execute Command via `rancher-exec` helper
40+
41+
You can also execute commands in pods of your deployment via `rancher-exec $K8S_NAMESPACE $K8S_DEPLOYMENT 'ls'`.
42+
This will execute the given command in the first pod of your deployment.
43+
Currently this is only tested with single container pods.
44+
3945
## Changelog
4046

4147
Check [releases](https://github.com/sourceboat/rancher-deploy/releases) for all notable changes.

bin/rancher-exec

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
POD=$(rancher kubectl get pod -l workload.user.cattle.io/workloadselector=deployment-$1-$2 -n $1 -o jsonpath="{.items[0].metadata.name}")
3+
echo "INFO: executing '$3' in pod '$POD'\n"
4+
rancher kubectl exec $POD -n $1 $3

0 commit comments

Comments
 (0)