diff --git a/.drone.yml b/.drone.yml index fe384b6..4fd8cd1 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,5 +1,25 @@ --- 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 + REGISTRY: ${REGISTRY} + YAMLLINT_TAG: ${YAMLLINT_TAG} + 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..469722c 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,23 @@ MAKEFLAGS += --silent +ENV_FILE=.env +ifneq ("$(wildcard .env)","") + include $(ENV_FILE) + export $(ENV_FILE) +endif + +REGISTRY=registry.fedy95.com +YAMLLINT_TAG=baseimage-yamllint:latest + .PHONY: * +validate: + echo $(REGISTRY) + 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 diff --git a/devops/scripts/validate.sh b/devops/scripts/validate.sh new file mode 100755 index 0000000..3901d74 --- /dev/null +++ b/devops/scripts/validate.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env sh + +set -e + +set -a +[ -f ../../.env ] && . ../../.env +set +a + +echo "$REGISTRY" +echo "${REGISTRY}" +echo "${{REGISTRY}}"