From a0f666ea255ea30a47fec879ba5e9736284fffae Mon Sep 17 00:00:00 2001 From: fedy95 Date: Tue, 9 Mar 2021 18:47:09 +0300 Subject: [PATCH] add-yaml-validator --- .drone.yml | 18 ++++++++++++++++++ .env-dist | 2 ++ .gitignore | 1 + Makefile | 13 +++++++++++++ 4 files changed, 34 insertions(+) create mode 100644 .env-dist create mode 100644 .gitignore diff --git a/.drone.yml b/.drone.yml index fe384b6..f4487af 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,5 +1,23 @@ --- kind: pipeline +type: docker +name: pull +steps: + - name: validate yaml + image: docker:dind + environment: + REGISTRY_USERNAME: + from_secret: REGISTRY_USERNAME + REGISTRY_PASSWORD: + from_secret: REGISTRY_PASSWORD + commands: + - apk add --no-cache make + - make validate + when: + event: pull_request +... +--- +kind: pipeline type: ssh name: default diff --git a/.env-dist b/.env-dist new file mode 100644 index 0000000..2325e2c --- /dev/null +++ b/.env-dist @@ -0,0 +1,2 @@ +REGISTRY_LOGIN= +REGISTRY_PASSWORD= diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f10862a --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/.env diff --git a/Makefile b/Makefile index a3170a5..1554c3c 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,20 @@ MAKEFLAGS += --silent +ENV_FILE=.env +include $(ENV_FILE) +export $(ENV_FILE) + +REGISTRY=registry.fedy95.com +YAMLLINT_TAG=baseimage-yamllint:latest + .PHONY: * +validate: + docker login ${REGISTRY} -u${REGISTRY_LOGIN} -p${REGISTRY_PASSWORD} + docker pull ${REGISTRY}/${YAMLLINT_TAG} + @docker run --rm $$(tty -s && echo "-it" || echo) -v $(PWD):/data ${REGISTRY}/${YAMLLINT_TAG} . + docker logout registry.fedy95.com + restart: docker-compose -f docker-compose.yml down docker-compose -f docker-compose.yml up -d