From 52b130a48ae6d7e43a6a5a019a71f8e8325827bf Mon Sep 17 00:00:00 2001 From: fedy95 Date: Tue, 9 Mar 2021 19:48:38 +0300 Subject: [PATCH] add-yaml-validator --- .drone.yml | 29 +++++++++++++++++++++++++++++ Makefile | 7 +++++++ 2 files changed, 36 insertions(+) diff --git a/.drone.yml b/.drone.yml index fe384b6..2721b82 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,5 +1,34 @@ --- kind: pipeline +type: docker +name: pull +steps: + - name: validate yaml + image: docker:dind + volumes: + - name: dockersock + path: /var/run/docker.sock + environment: + REGISTRY: registry.fedy95.com + REGISTRY_USERNAME: + from_secret: REGISTRY_USERNAME + REGISTRY_PASSWORD: + from_secret: REGISTRY_PASSWORD + commands: + - apk add --no-cache make + - docker login "$REGISTRY" -u"$REGISTRY_USERNAME" -p"$REGISTRY_PASSWORD" + - make validate + - docker logout "$REGISTRY" + when: + event: pull_request + +volumes: + - name: dockersock + host: + path: /var/run/docker.sock +... +--- +kind: pipeline type: ssh name: default diff --git a/Makefile b/Makefile index a3170a5..50a312b 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,14 @@ MAKEFLAGS += --silent +REGISTRY=registry.fedy95.com +YAMLLINT_TAG=baseimage-yamllint:latest + .PHONY: * +validate: + docker pull "${REGISTRY}"/"${YAMLLINT_TAG}" + @docker run --rm $$(tty -s && echo "-it" || echo) -v $(PWD):/data "${REGISTRY}"/"${YAMLLINT_TAG}" . + restart: docker-compose -f docker-compose.yml down docker-compose -f docker-compose.yml up -d