beer/.drone.yml

86 lines
1.6 KiB
YAML
Raw Normal View History

2020-02-15 18:38:57 +01:00
---
2020-02-14 01:06:37 +01:00
kind: pipeline
2020-02-15 16:11:36 +01:00
name: lint
2020-02-14 01:06:37 +01:00
steps:
2020-02-15 18:38:57 +01:00
- name: yaml lint
image: cytopia/yamllint
commands:
- yamllint .
2020-02-14 01:06:37 +01:00
- name: pylint
2020-02-15 16:28:58 +01:00
image: eeacms/pylint
2020-02-14 01:06:37 +01:00
commands:
2020-02-15 18:38:57 +01:00
- pip install -r requirements.txt
- pylint *.py
2020-02-14 01:06:37 +01:00
2020-02-15 00:42:17 +01:00
- name: docker lint
2020-02-15 18:38:57 +01:00
image: hadolint/hadolint
2020-02-14 01:06:37 +01:00
commands:
2020-02-15 18:38:57 +01:00
- hadolint --ignore DL3013 Dockerfile # ignore pinning version in pip
2020-02-15 18:31:59 +01:00
2020-02-14 01:06:37 +01:00
- name: w3c validator
image: validator/validator:latest
commands:
2020-02-15 00:42:17 +01:00
- vnu static/*.html
2020-02-15 12:57:50 +01:00
- name: markdown lint
image: pipelinecomponents/markdownlint:latest
commands:
2020-02-15 18:38:57 +01:00
- mdl --style all --warnings .
2020-02-15 12:57:50 +01:00
2020-02-15 16:11:36 +01:00
---
kind: pipeline
name: build
steps:
2020-02-15 00:42:17 +01:00
- name: build image
image: docker:18
2020-02-15 00:42:17 +01:00
environment:
2020-02-15 17:40:58 +01:00
DOCKER_HOST: tcp://docker
2020-02-15 12:48:36 +01:00
USERNAME:
from_secret: dockerhub_username
PASSWORD:
from_secret: dockerhub_password
2020-02-15 00:42:17 +01:00
commands:
- docker build -t kleph/beer .
2020-02-15 12:48:36 +01:00
- docker login -u $USERNAME -p $PASSWORD
2020-02-15 12:35:05 +01:00
- docker image push kleph/beer
2020-02-15 00:42:17 +01:00
services:
2020-02-15 18:38:57 +01:00
- name: docker
image: docker:18.09-dind
environment:
DOCKER_TLS_CERTDIR: ""
command: ["--storage-driver=vfs", "--tls=false"]
privileged: true
2020-02-15 17:02:19 +01:00
depends_on:
2020-02-15 18:38:57 +01:00
- lint
2020-02-15 17:40:58 +01:00
---
kind: pipeline
name: deploy
steps:
- name: build image
2020-02-15 19:02:13 +01:00
image: bitnami/kubectl
2020-02-15 17:40:58 +01:00
environment:
KUBE_USERNAME:
from_secret: kubectl_username
KUBE_PASSWORD:
from_secret: kubectl_password
KUBE_URI:
from_secret: kubectl_uri
KUBE_CA:
form_secret: kubectl_ca
commands:
2020-02-15 18:38:57 +01:00
- cat kube/kubeconfig_template.yaml | envsubst > /.kube/config
- kubectl get pods
- kubectl get deployments
- kubectl get svc
- kubectl apply -f kube/beer-deployment.yaml
2020-02-15 17:40:58 +01:00
depends_on:
2020-02-15 18:38:57 +01:00
- build