From 0cace9245b89a61e143c05d4df93afe3f0b013fd Mon Sep 17 00:00:00 2001 From: Pierre Smeyers <pierre.smeyers@gmail.com> Date: Fri, 10 Jun 2022 06:15:14 +0000 Subject: [PATCH] Resolve "Default hadolint config file's name" --- templates/gitlab-ci-docker.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/templates/gitlab-ci-docker.yml b/templates/gitlab-ci-docker.yml index a4bd2f0..080a7b2 100644 --- a/templates/gitlab-ci-docker.yml +++ b/templates/gitlab-ci-docker.yml @@ -313,10 +313,11 @@ stages: # autodetects whether there is an hadolint config file function autoconfig_hadolint() { # If present, import hadolint config found inside the git repository - if [[ -f "hadolint.yaml" ]] + _cfg=$(ls -1 "hadolint.yaml" 2>/dev/null || ls -1 ".hadolint.yaml" 2>/dev/null || echo "") + if [[ -f "$_cfg" ]] then - log_info "Using custom Hadolint config (\\e[33;1mhadolint.yaml\\e[0m)" - export hadolint_config_opts="--config ./hadolint.yaml" + log_info "Using custom Hadolint config (\\e[33;1m${_cfg}\\e[0m)" + export hadolint_config_opts="--config $_cfg" else log_info "No Hadolint config found: use default" fi -- GitLab