Loading .gitlab-ci.yml +5 −72 Changes for .gitlab-ci.yml: 5 added lines, 72 removed lines. Original line number Diff line number Diff line include: - local: templates/commits.yml stages: - development - prepare Loading Loading @@ -193,78 +196,8 @@ codestyle: commits: stage: prepare image: registry.gitlab.com/radiandevcore/tools/gcil/gcil:codestyle needs: [] before_script: # Check system context - git cz version -r # Show commits documentation - | ( set +x echo ' ' for hint in 'example:33' 'info:36' 'schema:32'; do command="${hint%%:*}" color="${hint##*:}" echo '---' echo "git cz ${command}:" echo -e "\033[1;${color}m" git cz "${command}" | sed 's#^$# #g' echo -e '\033[0m ' done echo '---' ) script: # Detect commits range - set +x - remote=$(git remote -v | grep '(fetch)' | awk '{print $1}' | head -n1) - none_sha='0000000000000000000000000000000000000000' - head_sha=$(git rev-parse "${CI_COMMIT_SHA:-HEAD}") - | if [ ! -z "${CI_MERGE_REQUEST_TARGET_BRANCH_NAME:-}" ]; then git fetch "${remote}" "${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}" || true base_sha=$(git rev-parse "${remote}/${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}") base_branch=$(git rev-parse --abbrev-ref "${remote}/${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}") elif [ ! -z "${CI_LOCAL:-}" ]; then base_sha=$(git rev-parse "${remote}/HEAD") base_branch=$(git rev-parse --abbrev-ref "${remote}/HEAD") elif [ ! "${CI_COMMIT_BEFORE_SHA:-${none_sha}}" = "${none_sha}" ] && git cat-file -e "${CI_COMMIT_BEFORE_SHA}" 2>/dev/null; then base_sha="${CI_COMMIT_BEFORE_SHA}" base_branch="${CI_COMMIT_REF_NAME:-}" else base_sha=$(git rev-parse 'HEAD~1') base_branch=$(git rev-parse --abbrev-ref 'HEAD') fi # Validate commits range - | set +x echo ' ' echo '---' echo -e "\033[0m\033[1mINFO: Commitizen checks from \033[1m'\033[1;36m${base_sha:0:8}\033[0m\033[1m' (\033[1;33m${base_branch}\033[0m\033[1m) to '\033[1;36m${head_sha:0:8}\033[0m\033[1m' (\033[1;33mHEAD\033[0m\033[1m)\033[0m" echo ' ' git log --pretty=oneline --abbrev-commit "${base_sha}..${head_sha}" | sed "s#^\([^ ]*\) #$(printf '\033[1;33m')\1$(printf '\033[0m') #g" echo ' ' set -x git cz --no-raise 3 check --rev-range "${base_sha}..${head_sha}" # Validate pre-commit checks - | set +x echo '' skip=$(grep 'id: local-gcil-' .pre-commit-config.yaml | sed 's/.* id: //g' | tr '\n' ',' | sed 's/,$//g') set -x pre-commit install --install-hooks SKIP="${skip}" pre-commit run --all-files --show-diff-on-failure # Validate WIP commits - | set +x if git log --pretty='%s' "${base_sha}..${head_sha}" | grep -i '^WIP'; then echo ' ' echo " [ERROR] Detected WIP commits in range '${base_sha}..${head_sha}'" echo ' ' false fi rules: - when: always extends: - .commits lint: stage: prepare Loading templates/commits.yml 0 → 100644 +73 −0 Changes for templates/commits.yml: 73 added lines, 0 removed lines. Original line number Diff line number Diff line .commits: image: registry.gitlab.com/radiandevcore/tools/gcil/gcil:codestyle needs: [] before_script: # Check system context - git cz version -r # Show commits documentation - | ( set +x echo ' ' for hint in 'example:33' 'info:36' 'schema:32'; do command="${hint%%:*}" color="${hint##*:}" echo '---' echo "git cz ${command}:" echo -e "\033[1;${color}m" git cz "${command}" | sed 's#^$# #g' echo -e '\033[0m ' done echo '---' ) script: # Detect commits range - set +x - remote=$(git remote -v | grep '(fetch)' | awk '{print $1}' | head -n1) - none_sha='0000000000000000000000000000000000000000' - head_sha=$(git rev-parse "${CI_COMMIT_SHA:-HEAD}") - | if [ ! -z "${CI_MERGE_REQUEST_TARGET_BRANCH_NAME:-}" ]; then git fetch "${remote}" "${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}" || true base_sha=$(git rev-parse "${remote}/${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}") base_branch=$(git rev-parse --abbrev-ref "${remote}/${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}") elif [ ! -z "${CI_LOCAL:-}" ]; then base_sha=$(git rev-parse "${remote}/HEAD") base_branch=$(git rev-parse --abbrev-ref "${remote}/HEAD") elif [ ! "${CI_COMMIT_BEFORE_SHA:-${none_sha}}" = "${none_sha}" ] && git cat-file -e "${CI_COMMIT_BEFORE_SHA}" 2>/dev/null; then base_sha="${CI_COMMIT_BEFORE_SHA}" base_branch="${CI_COMMIT_REF_NAME:-}" else base_sha=$(git rev-parse 'HEAD~1') base_branch=$(git rev-parse --abbrev-ref 'HEAD') fi # Validate commits range - | set +x echo ' ' echo '---' echo -e "\033[0m\033[1mINFO: Commitizen checks from \033[1m'\033[1;36m${base_sha:0:8}\033[0m\033[1m' (\033[1;33m${base_branch}\033[0m\033[1m) to '\033[1;36m${head_sha:0:8}\033[0m\033[1m' (\033[1;33mHEAD\033[0m\033[1m)\033[0m" echo ' ' git log --pretty=oneline --abbrev-commit "${base_sha}..${head_sha}" | sed "s#^\([^ ]*\) #$(printf '\033[1;33m')\1$(printf '\033[0m') #g" echo ' ' set -x git cz --no-raise 3 check --rev-range "${base_sha}..${head_sha}" # Validate pre-commit checks - | set +x echo '' skip=$(grep 'id: local-gcil-' .pre-commit-config.yaml | sed 's/.* id: //g' | tr '\n' ',' | sed 's/,$//g') set -x pre-commit install --install-hooks SKIP="${skip}" pre-commit run --all-files --show-diff-on-failure # Validate WIP commits - | set +x if git log --pretty='%s' "${base_sha}..${head_sha}" | grep -i '^WIP'; then echo ' ' echo " [ERROR] Detected WIP commits in range '${base_sha}..${head_sha}'" echo ' ' false fi rules: - when: always Loading
.gitlab-ci.yml +5 −72 Changes for .gitlab-ci.yml: 5 added lines, 72 removed lines. Original line number Diff line number Diff line include: - local: templates/commits.yml stages: - development - prepare Loading Loading @@ -193,78 +196,8 @@ codestyle: commits: stage: prepare image: registry.gitlab.com/radiandevcore/tools/gcil/gcil:codestyle needs: [] before_script: # Check system context - git cz version -r # Show commits documentation - | ( set +x echo ' ' for hint in 'example:33' 'info:36' 'schema:32'; do command="${hint%%:*}" color="${hint##*:}" echo '---' echo "git cz ${command}:" echo -e "\033[1;${color}m" git cz "${command}" | sed 's#^$# #g' echo -e '\033[0m ' done echo '---' ) script: # Detect commits range - set +x - remote=$(git remote -v | grep '(fetch)' | awk '{print $1}' | head -n1) - none_sha='0000000000000000000000000000000000000000' - head_sha=$(git rev-parse "${CI_COMMIT_SHA:-HEAD}") - | if [ ! -z "${CI_MERGE_REQUEST_TARGET_BRANCH_NAME:-}" ]; then git fetch "${remote}" "${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}" || true base_sha=$(git rev-parse "${remote}/${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}") base_branch=$(git rev-parse --abbrev-ref "${remote}/${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}") elif [ ! -z "${CI_LOCAL:-}" ]; then base_sha=$(git rev-parse "${remote}/HEAD") base_branch=$(git rev-parse --abbrev-ref "${remote}/HEAD") elif [ ! "${CI_COMMIT_BEFORE_SHA:-${none_sha}}" = "${none_sha}" ] && git cat-file -e "${CI_COMMIT_BEFORE_SHA}" 2>/dev/null; then base_sha="${CI_COMMIT_BEFORE_SHA}" base_branch="${CI_COMMIT_REF_NAME:-}" else base_sha=$(git rev-parse 'HEAD~1') base_branch=$(git rev-parse --abbrev-ref 'HEAD') fi # Validate commits range - | set +x echo ' ' echo '---' echo -e "\033[0m\033[1mINFO: Commitizen checks from \033[1m'\033[1;36m${base_sha:0:8}\033[0m\033[1m' (\033[1;33m${base_branch}\033[0m\033[1m) to '\033[1;36m${head_sha:0:8}\033[0m\033[1m' (\033[1;33mHEAD\033[0m\033[1m)\033[0m" echo ' ' git log --pretty=oneline --abbrev-commit "${base_sha}..${head_sha}" | sed "s#^\([^ ]*\) #$(printf '\033[1;33m')\1$(printf '\033[0m') #g" echo ' ' set -x git cz --no-raise 3 check --rev-range "${base_sha}..${head_sha}" # Validate pre-commit checks - | set +x echo '' skip=$(grep 'id: local-gcil-' .pre-commit-config.yaml | sed 's/.* id: //g' | tr '\n' ',' | sed 's/,$//g') set -x pre-commit install --install-hooks SKIP="${skip}" pre-commit run --all-files --show-diff-on-failure # Validate WIP commits - | set +x if git log --pretty='%s' "${base_sha}..${head_sha}" | grep -i '^WIP'; then echo ' ' echo " [ERROR] Detected WIP commits in range '${base_sha}..${head_sha}'" echo ' ' false fi rules: - when: always extends: - .commits lint: stage: prepare Loading
templates/commits.yml 0 → 100644 +73 −0 Changes for templates/commits.yml: 73 added lines, 0 removed lines. Original line number Diff line number Diff line .commits: image: registry.gitlab.com/radiandevcore/tools/gcil/gcil:codestyle needs: [] before_script: # Check system context - git cz version -r # Show commits documentation - | ( set +x echo ' ' for hint in 'example:33' 'info:36' 'schema:32'; do command="${hint%%:*}" color="${hint##*:}" echo '---' echo "git cz ${command}:" echo -e "\033[1;${color}m" git cz "${command}" | sed 's#^$# #g' echo -e '\033[0m ' done echo '---' ) script: # Detect commits range - set +x - remote=$(git remote -v | grep '(fetch)' | awk '{print $1}' | head -n1) - none_sha='0000000000000000000000000000000000000000' - head_sha=$(git rev-parse "${CI_COMMIT_SHA:-HEAD}") - | if [ ! -z "${CI_MERGE_REQUEST_TARGET_BRANCH_NAME:-}" ]; then git fetch "${remote}" "${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}" || true base_sha=$(git rev-parse "${remote}/${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}") base_branch=$(git rev-parse --abbrev-ref "${remote}/${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}") elif [ ! -z "${CI_LOCAL:-}" ]; then base_sha=$(git rev-parse "${remote}/HEAD") base_branch=$(git rev-parse --abbrev-ref "${remote}/HEAD") elif [ ! "${CI_COMMIT_BEFORE_SHA:-${none_sha}}" = "${none_sha}" ] && git cat-file -e "${CI_COMMIT_BEFORE_SHA}" 2>/dev/null; then base_sha="${CI_COMMIT_BEFORE_SHA}" base_branch="${CI_COMMIT_REF_NAME:-}" else base_sha=$(git rev-parse 'HEAD~1') base_branch=$(git rev-parse --abbrev-ref 'HEAD') fi # Validate commits range - | set +x echo ' ' echo '---' echo -e "\033[0m\033[1mINFO: Commitizen checks from \033[1m'\033[1;36m${base_sha:0:8}\033[0m\033[1m' (\033[1;33m${base_branch}\033[0m\033[1m) to '\033[1;36m${head_sha:0:8}\033[0m\033[1m' (\033[1;33mHEAD\033[0m\033[1m)\033[0m" echo ' ' git log --pretty=oneline --abbrev-commit "${base_sha}..${head_sha}" | sed "s#^\([^ ]*\) #$(printf '\033[1;33m')\1$(printf '\033[0m') #g" echo ' ' set -x git cz --no-raise 3 check --rev-range "${base_sha}..${head_sha}" # Validate pre-commit checks - | set +x echo '' skip=$(grep 'id: local-gcil-' .pre-commit-config.yaml | sed 's/.* id: //g' | tr '\n' ',' | sed 's/,$//g') set -x pre-commit install --install-hooks SKIP="${skip}" pre-commit run --all-files --show-diff-on-failure # Validate WIP commits - | set +x if git log --pretty='%s' "${base_sha}..${head_sha}" | grep -i '^WIP'; then echo ' ' echo " [ERROR] Detected WIP commits in range '${base_sha}..${head_sha}'" echo ' ' false fi rules: - when: always