[ci] refacto
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
kleph 2020-03-02 23:08:26 +01:00
parent ff30434b7d
commit cd298e4a27

View file

@ -58,11 +58,26 @@ depends_on:
- unit tests
---
deploy_commands_alias:
- &deploy_commands
commands:
- echo "== pre deploy ($${LEVEL}) status:"
- kubectl get pods --namespace=beer
- kubectl get deployments --namespace=beer
- sed "s/__LEVEL__/$${LEVEL}/g" kube/beer-deployment.yaml > kube/beer-deployment-$${LEVEL}.yaml
- sed "s/__NAMESPACE__/$${NAMESPACE}/g" kube/beer-deployment-$${LEVEL}.yaml > kube/beer-deployment-$${NAMESPACE}-$${LEVEL}.yaml
- sed "s/__IMAGE_TAG__/$${IMAGE_TAG}/g" kube/beer-deployment-$${NAMESPACE}-$${LEVEL}.yaml > kube/beer-deployment-$${NAMESPACE}-$${LEVEL}2.yaml
- echo "applying"
- kubectl apply -f kube/beer-deployment-$${NAMESPACE}-$${LEVEL}2.yaml --namespace=beer
- echo "== post deploy ($${LEVEL}) status:"
- kubectl get deployments --namespace=beer
- kubectl get pods --namespace=beer
kind: pipeline
name: staging
name: deploy
steps:
- name: deploy
- name: deploy staging
image: sinlead/drone-kubectl
settings:
kubernetes_server:
@ -75,32 +90,13 @@ steps:
IMAGE_TAG: ${DRONE_COMMIT_SHA:0:8}
NAMESPACE: beer
LEVEL: staging
commands:
- echo "== pre deploy ($${LEVEL}) status:"
- kubectl get pods --namespace=beer
- kubectl get deployments --namespace=beer
- sed "s/__LEVEL__/$${LEVEL}/g" kube/beer-deployment.yaml > kube/beer-deployment-$${LEVEL}.yaml
- sed "s/__NAMESPACE__/$${NAMESPACE}/g" kube/beer-deployment-$${LEVEL}.yaml > kube/beer-deployment-$${NAMESPACE}-$${LEVEL}.yaml
- sed "s/__IMAGE_TAG__/$${IMAGE_TAG}/g" kube/beer-deployment-$${NAMESPACE}-$${LEVEL}.yaml > kube/beer-deployment-$${NAMESPACE}-$${LEVEL}2.yaml
- echo "applying"
- kubectl apply -f kube/beer-deployment-$${NAMESPACE}-$${LEVEL}2.yaml --namespace=beer
- echo "== post deploy ($${LEVEL}) status:"
- kubectl get deployments --namespace=beer
- kubectl get pods --namespace=beer
<<: *deploy_commands
when:
branch:
exclude:
- master
depends_on:
- build
---
kind: pipeline
name: deploy
steps:
- name: deploy
- name: deploy live
image: sinlead/drone-kubectl
settings:
kubernetes_server:
@ -113,18 +109,7 @@ steps:
IMAGE_TAG: ${DRONE_COMMIT_SHA:0:8}
NAMESPACE: beer
LEVEL: prod
commands:
- echo "== pre deploy ($${LEVEL}) status:"
- kubectl get pods --namespace=beer
- kubectl get deployments --namespace=beer
- sed "s/__LEVEL__/$${LEVEL}/g" kube/beer-deployment.yaml > kube/beer-deployment-$${LEVEL}.yaml
- sed "s/__NAMESPACE__/$${NAMESPACE}/g" kube/beer-deployment-$${LEVEL}.yaml > kube/beer-deployment-$${NAMESPACE}-$${LEVEL}.yaml
- sed "s/__IMAGE_TAG__/$${IMAGE_TAG}/g" kube/beer-deployment-$${NAMESPACE}-$${LEVEL}.yaml > kube/beer-deployment-$${NAMESPACE}-$${LEVEL}2.yaml
- echo "applying"
- kubectl apply -f kube/beer-deployment-$${NAMESPACE}-$${LEVEL}2.yaml --namespace=beer
- echo "== post deploy ($${LEVEL}) status:"
- kubectl get deployments --namespace=beer
- kubectl get pods --namespace=beer
<<: *deploy_commands
when:
branch:
include: