deploy #5
4 changed files with 24 additions and 7 deletions
20
.drone.yml
20
.drone.yml
|
@ -48,7 +48,7 @@ steps:
|
|||
image: plugins/docker
|
||||
settings:
|
||||
repo: kleph/beer
|
||||
tags: latest
|
||||
tags: ${DRONE_COMMIT_SHA:0:8}
|
||||
username:
|
||||
from_secret: dockerhub_username
|
||||
password:
|
||||
|
@ -71,11 +71,25 @@ steps:
|
|||
from_secret: kubectl_cert
|
||||
kubernetes_token:
|
||||
from_secret: kubectl_token
|
||||
environment:
|
||||
IMAGE_TAG: ${DRONE_COMMIT_SHA:0:8}
|
||||
NAMESPACE: beer
|
||||
commands:
|
||||
- echo "== pre deploy status:"
|
||||
- kubectl get pods --namespace=beer
|
||||
- kubectl get deployments --namespace=beer
|
||||
- kubectl get svc --namespace=beer
|
||||
- kubectl apply -f kube/beer-deployment.yaml --namespace=beer
|
||||
- sed "s/__NAMESPACE__/$${NAMESPACE}/g" kube/beer-deployment.yaml > kube/beer-deployment-prod.yaml
|
||||
- sed "s/__IMAGE_TAG__/$${IMAGE_TAG}/g" kube/beer-deployment-prod.yaml > kube/beer-deployment-prod2.yaml
|
||||
- echo "applying"
|
||||
- kubectl apply -f kube/beer-deployment-prod2.yaml --namespace=beer
|
||||
- echo "== post deploy status:"
|
||||
- kubectl get deployments --namespace=beer
|
||||
- kubectl get pods --namespace=beer
|
||||
|
||||
depends_on:
|
||||
- build
|
||||
|
||||
when:
|
||||
branch:
|
||||
include:
|
||||
- master
|
||||
|
|
|
@ -4,3 +4,6 @@ extends: default
|
|||
rules:
|
||||
indentation:
|
||||
indent-sequences: consistent
|
||||
line-length:
|
||||
max: 120
|
||||
level: warning
|
||||
|
|
|
@ -3,7 +3,7 @@ apiVersion: apps/v1
|
|||
kind: Deployment
|
||||
metadata:
|
||||
name: beer-deployment
|
||||
namespace: beer
|
||||
namespace: __NAMESPACE__
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
|
@ -16,7 +16,7 @@ spec:
|
|||
spec:
|
||||
containers:
|
||||
- name: beer
|
||||
image: kleph/beer
|
||||
image: kleph/beer:__IMAGE_TAG__
|
||||
imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: 5000
|
||||
|
|
|
@ -2,6 +2,6 @@
|
|||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: beer
|
||||
name: __NAMESPACE__
|
||||
labels:
|
||||
name: beer
|
||||
name: __NAMESPACE__
|
||||
|
|
Loading…
Reference in a new issue