79 lines
1.9 KiB
YAML
79 lines
1.9 KiB
YAML
|
---
|
||
|
kind: pipeline
|
||
|
name: build
|
||
|
|
||
|
steps:
|
||
|
- name: build image
|
||
|
image: plugins/docker
|
||
|
settings:
|
||
|
repo: kleph/quake3-status
|
||
|
tags: ${DRONE_COMMIT_SHA:0:8}
|
||
|
username:
|
||
|
from_secret: dockerhub_username
|
||
|
password:
|
||
|
from_secret: dockerhub_password
|
||
|
when:
|
||
|
event:
|
||
|
exclude:
|
||
|
- pull_request
|
||
|
|
||
|
---
|
||
|
deploy_commands_alias:
|
||
|
- &deploy_commands
|
||
|
commands:
|
||
|
- sed "s/__LEVEL__/$${LEVEL}/g" kube/q3-status-deployment.yaml > kube/q3-status-deployment-$${LEVEL}.yaml
|
||
|
- sed "s/__NAMESPACE__/$${NAMESPACE}/g" kube/q3-status-deployment-$${LEVEL}.yaml > kube/q3-status-deployment-$${NAMESPACE}-$${LEVEL}.yaml
|
||
|
- sed "s/__IMAGE_TAG__/$${IMAGE_TAG}/g" kube/q3-status-deployment-$${NAMESPACE}-$${LEVEL}.yaml > kube/q3-status-deployment-$${NAMESPACE}-$${LEVEL}2.yaml
|
||
|
- cat kube/q3-status-deployment-$${NAMESPACE}-$${LEVEL}2.yaml
|
||
|
- echo "applying"
|
||
|
- kubectl apply -f kube/q3-status-deployment-$${NAMESPACE}-$${LEVEL}2.yaml --namespace=q3
|
||
|
- echo "== post deploy ($${LEVEL}) status:"
|
||
|
- kubectl get deployments --namespace=q3
|
||
|
- kubectl get pods --namespace=q3
|
||
|
|
||
|
kind: pipeline
|
||
|
name: deploy
|
||
|
|
||
|
steps:
|
||
|
- name: deploy staging
|
||
|
image: sinlead/drone-kubectl
|
||
|
settings:
|
||
|
kubernetes_server:
|
||
|
from_secret: kubectl_uri
|
||
|
kubernetes_cert:
|
||
|
from_secret: kubectl_cert
|
||
|
kubernetes_token:
|
||
|
from_secret: kubectl_token
|
||
|
environment:
|
||
|
IMAGE_TAG: ${DRONE_COMMIT_SHA:0:8}
|
||
|
NAMESPACE: q3
|
||
|
LEVEL: staging
|
||
|
<<: *deploy_commands
|
||
|
when:
|
||
|
branch:
|
||
|
exclude:
|
||
|
- master
|
||
|
|
||
|
- name: deploy live
|
||
|
image: sinlead/drone-kubectl
|
||
|
settings:
|
||
|
kubernetes_server:
|
||
|
from_secret: kubectl_uri
|
||
|
kubernetes_cert:
|
||
|
from_secret: kubectl_cert
|
||
|
kubernetes_token:
|
||
|
from_secret: kubectl_token
|
||
|
environment:
|
||
|
IMAGE_TAG: ${DRONE_COMMIT_SHA:0:8}
|
||
|
NAMESPACE: q3
|
||
|
LEVEL: live
|
||
|
<<: *deploy_commands
|
||
|
when:
|
||
|
branch:
|
||
|
include:
|
||
|
- master
|
||
|
|
||
|
depends_on:
|
||
|
- build
|
||
|
|