[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 - 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 kind: pipeline
name: staging name: deploy
steps: steps:
- name: deploy - name: deploy staging
image: sinlead/drone-kubectl image: sinlead/drone-kubectl
settings: settings:
kubernetes_server: kubernetes_server:
@ -75,32 +90,13 @@ steps:
IMAGE_TAG: ${DRONE_COMMIT_SHA:0:8} IMAGE_TAG: ${DRONE_COMMIT_SHA:0:8}
NAMESPACE: beer NAMESPACE: beer
LEVEL: staging LEVEL: staging
commands: <<: *deploy_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
when: when:
branch: branch:
exclude: exclude:
- master - master
depends_on: - name: deploy live
- build
---
kind: pipeline
name: deploy
steps:
- name: deploy
image: sinlead/drone-kubectl image: sinlead/drone-kubectl
settings: settings:
kubernetes_server: kubernetes_server:
@ -113,18 +109,7 @@ steps:
IMAGE_TAG: ${DRONE_COMMIT_SHA:0:8} IMAGE_TAG: ${DRONE_COMMIT_SHA:0:8}
NAMESPACE: beer NAMESPACE: beer
LEVEL: prod LEVEL: prod
commands: <<: *deploy_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
when: when:
branch: branch:
include: include: