forked from kenazk/relay-workflows
-
Notifications
You must be signed in to change notification settings - Fork 0
/
kubectl-apply-on-dockerhub-push.yaml
55 lines (52 loc) · 1.73 KB
/
kubectl-apply-on-dockerhub-push.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
apiVersion: v1
summary: Update Kubernetes deployment image tag on Docker Hub push
description: This workflow responds when a new Docker Hub image is available by updating a Kubernetes deployment image.
homepage: https://github.com/puppetlabs/relay-workflows/tree/master/kubectl-apply-on-dockerhub-push
tags:
- continuous delivery
triggers:
- name: dockerhub-image-pushed
source:
type: webhook
image: relaysh/dockerhub-trigger-image-pushed
binding:
parameters:
tag: !Data tag
imageName: !Data name
parameters:
tag:
description: image tag to change
imageName:
description: the image's name
deploymentName:
description: the deployment's name
default: busybox
containerName:
description: the name of the container for the deployment
default: busybox
namespace:
description: the namespace where your deployment lives
default: default
steps:
# uncomment the following if you would like to approve the set
# step manually instead of letting it runs automatically.
#
# - name: approval
# description: Wait for approval to run kubectl command
# type: approval
- name: kubectl-set-new-image
description: >
Sets a new image tag version for the deployment.
This uses the set command in kubectl to change the image
the deployment uses.
image: relaysh/kubernetes-step-kubectl:latest
# if you are using the above approval, uncomment the following line
# dependsOn: approval
spec:
namespace: !Parameter namespace
connection: !Connection { type: "kubernetes", name: "my-cluster-connection" }
command: set
args:
- image
- !Fn.concat ["deployment/", !Parameter deploymentName]
- !Fn.concat [!Parameter containerName, "=", !Parameter imageName, ":", !Parameter tag]