Add hadolint to CI (#34758)
* Add hadolint to CI * Fix lint & name * Update azure-pipelines-ci.yml Co-Authored-By: Franck Nijhof <git@frenck.dev> Co-authored-by: Franck Nijhof <git@frenck.dev>
This commit is contained in:
parent
e4590539e1
commit
be57d45653
3 changed files with 24 additions and 2 deletions
5
.hadolint.yaml
Normal file
5
.hadolint.yaml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
ignored:
|
||||||
|
- DL3006
|
||||||
|
- DL3008
|
||||||
|
- DL3013
|
||||||
|
- DL3018
|
|
@ -18,8 +18,7 @@ WORKDIR /usr/src
|
||||||
|
|
||||||
# Setup hass-release
|
# Setup hass-release
|
||||||
RUN git clone --depth 1 https://github.com/home-assistant/hass-release \
|
RUN git clone --depth 1 https://github.com/home-assistant/hass-release \
|
||||||
&& cd hass-release \
|
&& pip3 install -e hass-release/
|
||||||
&& pip3 install -e .
|
|
||||||
|
|
||||||
WORKDIR /workspaces
|
WORKDIR /workspaces
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,8 @@ resources:
|
||||||
variables:
|
variables:
|
||||||
- name: PythonMain
|
- name: PythonMain
|
||||||
value: "37"
|
value: "37"
|
||||||
|
- name: versionHadolint
|
||||||
|
value: "v1.17.6"
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
- stage: "Overview"
|
- stage: "Overview"
|
||||||
|
@ -121,6 +123,22 @@ stages:
|
||||||
. venv/bin/activate
|
. venv/bin/activate
|
||||||
pre-commit run black --all-files --show-diff-on-failure
|
pre-commit run black --all-files --show-diff-on-failure
|
||||||
displayName: "Check Black formatting"
|
displayName: "Check Black formatting"
|
||||||
|
- job: "Docker"
|
||||||
|
pool:
|
||||||
|
vmImage: "ubuntu-latest"
|
||||||
|
steps:
|
||||||
|
- script: sudo docker pull hadolint/hadolint:$(versionHadolint)
|
||||||
|
displayName: "Install Hadolint"
|
||||||
|
- script: |
|
||||||
|
set -e
|
||||||
|
for dockerfile in Dockerfile Dockerfile.dev
|
||||||
|
do
|
||||||
|
echo "Linting: $dockerfile"
|
||||||
|
docker run --rm -i \
|
||||||
|
-v "$(pwd)/.hadolint.yaml:/.hadolint.yaml:ro" \
|
||||||
|
hadolint/hadolint:$(versionHadolint) < "$dockerfile"
|
||||||
|
done
|
||||||
|
displayName: "Run Hadolint"
|
||||||
|
|
||||||
- stage: "Tests"
|
- stage: "Tests"
|
||||||
dependsOn:
|
dependsOn:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue