Browse Source

More linters (#2)

* shellcheck
* yamllint
* hadolint

Co-authored-by: Mykyta Solomko <sev@nix.org.ua>
Reviewed-on: https://code.nix.org.ua/NiX/docker-linter/pulls/2
Co-Authored-By: Mykyta Solomko <sev@no-reply.code.nix.org.ua>
Co-Committed-By: Mykyta Solomko <sev@no-reply.code.nix.org.ua>
master
Mykyta Solomko 5 years ago
parent
commit
4eefa61974
  1. 0
      .ci/lint-dockerfile.sh
  2. 0
      .ci/lint-shell.sh
  3. 2
      .ci/lint-yaml.sh
  4. 0
      .ci/yamllint.yml
  5. 18
      .woodpecker.yml
  6. 53
      Dockerfile

0
.ci-scripts/lint-dockerfile.sh → .ci/lint-dockerfile.sh

0
.ci-scripts/lint-shell.sh → .ci/lint-shell.sh

2
.ci-scripts/lint-yaml.sh → .ci/lint-yaml.sh

@ -6,7 +6,7 @@ CUR_DIR=$(pwd)
YAML_FILES=$(find "${CUR_DIR}" -type f \( -iname '*.yml' -or -iname '*.yaml' \))
for YM_F in ${YAML_FILES[*]}; do
yamllint -c "${CUR_DIR}/.ci-scripts/yamllint.yml" "${YM_F}" \
yamllint -c "${CUR_DIR}/.ci/yamllint.yml" "${YM_F}" \
|| RET=${?}
done

0
.ci-scripts/yamllint.yml → .ci/yamllint.yml

18
.drone.yml → .woodpecker.yml

@ -5,31 +5,29 @@ workspace:
pipeline:
lint-shell:
image: koalaman/shellcheck-alpine:stable
image: sevoid/linter:latest
group: lint
commands:
- apk add --no-cache bash
- bash ./.ci-scripts/lint-shell.sh
- ./.ci/lint-shell.sh
lint-yaml:
image: sdesbure/yamllint:latest
image: sevoid/linter:latest
group: lint
commands:
- apk add --no-cache bash
- bash ./.ci-scripts/lint-yaml.sh
- ./.ci/lint-yaml.sh
lint-dockerfile:
image: hadolint/hadolint:latest-debian
image: sevoid/linter:latest
group: lint
commands:
- bash ./.ci-scripts/lint-dockerfile.sh
- ./.ci/lint-dockerfile.sh
docker-build-and-push:
image: plugins/docker:17
secrets:
- docker_username
- docker_password
repo: sevoid/linter-pylint
repo: sevoid/linter
tags:
- 'latest'
when:
@ -37,6 +35,6 @@ pipeline:
- build-*
branches:
axlude: [ master ]
exclude: [ master ]
# vim:set syntax=yaml ts=2 sw=2 et:

53
Dockerfile

@ -1,9 +1,19 @@
FROM vbatts/slackware:current
LABEL maintainer="sev@nix.org.ua"
ENV SHELLCHECK_VER=0.7.1
ENV YAMLLINT_VER=1.25.0
ENV HADOLINT_VER=1.19.0
ENV PYLINT_VER=2.6.0
COPY slackpkg.conf /etc/slackpkg/
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
#
# SYS: configuration and upgrades
#
RUN touch /var/lib/slackpkg/current \
&& slackpkg update \
&& slackpkg install perl ca-certificates dcron \
@ -11,8 +21,45 @@ RUN touch /var/lib/slackpkg/current \
&& slackpkg update gpg \
&& slackpkg update \
&& slackpkg upgrade-all \
&& slackpkg install python3 python-pip python-setuptools \
&& pip install -q pylint==${PYLINT_VER}
&& slackpkg install python3 \
python-pip \
python-setuptools
LABEL maintainer="sev@nix.org.ua"
#
# SYS: add user
#
RUN useradd -c 'User for code linters' -s /bin/bash linter
#
# INST: pylint
#
RUN pip install --no-cache-dir -q yamllint==${YAMLLINT_VER}
#
# INST: pylint
#
RUN pip install --no-cache-dir -q pylint==${PYLINT_VER}
#
# INST: shellcheck
#
RUN wget --quiet --no-check-certificate --output-document - \
https://github.com/koalaman/shellcheck/releases/download/v${SHELLCHECK_VER}/shellcheck-v${SHELLCHECK_VER}.linux.x86_64.tar.xz \
| tar -C /usr/local/bin \
--strip-components=1 \
-Jxf - shellcheck-v${SHELLCHECK_VER}/shellcheck
#
# INST: hadolint
#
RUN wget --quiet --no-check-certificate --output-document /usr/local/bin/hadolint \
https://github.com/hadolint/hadolint/releases/download/v${HADOLINT_VER}/hadolint-Linux-x86_64
#
# MISK: owner & permissions
#
RUN chown root:root /usr/local/bin/* \
&& chmod 0755 /usr/local/bin/*
USER linter
Loading…
Cancel
Save