Joey Armstrong | 36c9bcd | 2023-04-05 19:05:56 -0400 | [diff] [blame] | 1 | # -*- makefile -*- |
| 2 | # ----------------------------------------------------------------------- |
| 3 | # Copyright 2017-2023 Open Networking Foundation (ONF) and the ONF Contributors |
| 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | # ----------------------------------------------------------------------- |
| 17 | |
| 18 | ##-------------------## |
| 19 | ##---] GLOBALS [---## |
| 20 | ##-------------------## |
| 21 | |
| 22 | HADOLINT = $(docker-run-app) $(is-stdin) $(vee-citools)-hadolint hadolint |
| 23 | |
| 24 | ifdef LOCAL_LINT |
| 25 | lint-hadolint-dep = lint-hadolint-local |
| 26 | else |
| 27 | lint-hadolint-dep = lint-hadolint |
| 28 | endif |
| 29 | |
| 30 | ## ----------------------------------------------------------------------- |
| 31 | ## ----------------------------------------------------------------------- |
| 32 | .PHONY: $(lint-hadolint-dep) |
| 33 | |
| 34 | lint : $(lint-hadolint-dep) |
| 35 | |
| 36 | lint-dockerfile : $(lint-hadolint-dep) |
| 37 | |
| 38 | ## ----------------------------------------------------------------------- |
| 39 | ## ----------------------------------------------------------------------- |
| 40 | lint-hadolint: |
| 41 | |
| 42 | @echo |
| 43 | @echo '** -------------------------------------------------------------' |
| 44 | @echo "** $(MAKE): processing target [$@]" |
| 45 | @echo '** -------------------------------------------------------------' |
| 46 | $(HIDE)${HADOLINT} $$(find ./build -name "Dockerfile*") |
| 47 | @echo "Dockerfile lint check OK" |
| 48 | |
| 49 | ## ----------------------------------------------------------------------- |
| 50 | ## ----------------------------------------------------------------------- |
| 51 | hadolint-cmd := ./hadolint-Linux-x86_64 |
| 52 | |
| 53 | lint-hadolint-local: hadolint-get |
| 54 | $(hadolint-cmd) $$(find ./build -name "Dockerfile*") |
| 55 | |
| 56 | ## ----------------------------------------------------------------------- |
| 57 | ## Intent: Retrieve the hadolint tool |
| 58 | ## https://github.com/hadolint/hadolint/releases/tag/v2.12.0 |
| 59 | ## ----------------------------------------------------------------------- |
| 60 | hadolint-get: |
| 61 | true |
| 62 | # $(MAKECMDGOALS)/lint/docker/get.sh |
| 63 | # $(GIT) clone https://github.com/hadolint/hadolint.git |
| 64 | # wget https://github.com/hadolint/hadolint/releases/download/v2.12.0/hadolint-Linux-x86_64 |
| 65 | |
| 66 | ## ----------------------------------------------------------------------- |
| 67 | ## ----------------------------------------------------------------------- |
| 68 | help :: |
| 69 | @echo ' lint-dockerfile Perform all dockerfile lint checks' |
| 70 | @echo ' lint-hadolint Dockerfile lint check' |
| 71 | |
| 72 | ## ----------------------------------------------------------------------- |
| 73 | ## ----------------------------------------------------------------------- |
| 74 | todo :: |
| 75 | @echo ' o Update lint-dockerfile to run all dockerfile lint checks' |
| 76 | |
| 77 | # [SEE ALSO] |
| 78 | # https://github.com/hadolint/hadolint |
| 79 | |
| 80 | # [EOF] |