From 634d54b6f48659c2bc6103a5b900406c8a3a02cb Mon Sep 17 00:00:00 2001 From: Lluis Campos Date: Fri, 28 May 2021 14:45:39 +0200 Subject: [PATCH] [pipeline] Use new template to check shell scripts formatting Changelog: None Signed-off-by: Lluis Campos --- .gitlab-ci.yml | 49 +++++-------------------------------------------- 1 file changed, 5 insertions(+), 44 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0be967d..67a457d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -31,6 +31,8 @@ include: file: '.gitlab-ci-check-license.yml' - project: 'Northern.tech/Mender/mendertesting' file: '.gitlab-ci-github-status-updates.yml' + - project: 'Northern.tech/Mender/mendertesting' + file: '.gitlab-ci-check-shell-format.yml' stages: - test @@ -53,54 +55,13 @@ build: paths: - image.tar -test:format: - stage: test - needs: [] - image: alpine:3.13 +test:check-shell-formatting: before_script: - - apk update - - apk upgrade - - apk add --update bash git shfmt - - shfmt -version - script: - - /bin/bash - - SCRIPTS=$(find modules configs scripts -type f + - SHELL_SCRIPTS=$(find mender-convert* modules configs scripts + -type f -not -name "*.md" -not -path "scripts/linkbot/*" -not -wholename "scripts/test/*") - # shfmt - ## Language=Bash - # -ln bash - ## Indent=4 spaces - # -i 4 - ## List files who differ in formatting - # -l - ## Redirect operators should be followed by a space - # -sr - ## Indent switch statements - # -ci - ## Keep column alignment padding - # -kp - ## Binary operators like &&, || may start a new line - # -bn - ## Overwrite the source files - # -w - - | - shfmt \ - -ln bash \ - -i 4 \ - -l \ - -sr \ - -ci \ - -kp \ - -bn \ - -w \ - ${SCRIPTS} \ - mender-convert* - # Print diff - - git diff HEAD - # Actual test: exits with non zero status if diff - - git diff-index --quiet HEAD .template_convert_raspbian: &convert_raspbian stage: convert