diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e9b597b..269b051 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,4 +3,4 @@ repos: - repo: https://github.com/IamTheFij/docker-pre-commit rev: v2.0.0 hooks: - - id: hadolint + - id: hadolint-system diff --git a/Makefile b/Makefile index cd0367d..acc86ca 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,17 @@ +DOCKER_TAG = drone-pre-commit-$(USER) + .PHONY: clean .PHONY: default default: test .PHONY: test -test: - @echo noop +test: build + docker run --rm -v $(shell pwd):/src:ro --workdir /src $(DOCKER_TAG) ./tests/steps.sh + +.PHONY: build +build: ./Dockerfile + docker build -t $(DOCKER_TAG) . .PHONY: install-hooks install-hooks: diff --git a/tests/steps.sh b/tests/steps.sh new file mode 100755 index 0000000..0b53ead --- /dev/null +++ b/tests/steps.sh @@ -0,0 +1,9 @@ +#! /bin/bash +set -ex + +# These simulate commands added to a pipeline step + +wget -L -O /usr/bin/hadolint https://github.com/hadolint/hadolint/releases/download/v1.18.0/hadolint-Linux-x86_64 +chmod +x /usr/bin/hadolint + +pre-commit run --all-files