Skip to content

Commit

Permalink
Add hadolint to CI (home-assistant#34758)
Browse files Browse the repository at this point in the history
* Add hadolint to CI

* Fix lint & name

* Update azure-pipelines-ci.yml

Co-Authored-By: Franck Nijhof <[email protected]>

Co-authored-by: Franck Nijhof <[email protected]>
  • Loading branch information
pvizeli and frenck authored Apr 27, 2020
1 parent e459053 commit be57d45
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .hadolint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ignored:
- DL3006
- DL3008
- DL3013
- DL3018
3 changes: 1 addition & 2 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ WORKDIR /usr/src

# Setup hass-release
RUN git clone --depth 1 https://github.com/home-assistant/hass-release \
&& cd hass-release \
&& pip3 install -e .
&& pip3 install -e hass-release/

WORKDIR /workspaces

Expand Down
18 changes: 18 additions & 0 deletions azure-pipelines-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ resources:
variables:
- name: PythonMain
value: "37"
- name: versionHadolint
value: "v1.17.6"

stages:
- stage: "Overview"
Expand Down Expand Up @@ -121,6 +123,22 @@ stages:
. venv/bin/activate
pre-commit run black --all-files --show-diff-on-failure
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"
dependsOn:
Expand Down

0 comments on commit be57d45

Please sign in to comment.