Merge pull request '[DO-0] bugfix: Fix pre-commit' (#1) from bugfix/pre-commit into master
Reviewed-on: https://git.avroid.tech/DevOps/service-configs/pulls/1
This commit is contained in:
@@ -3,52 +3,54 @@
|
|||||||
# Error message for BRANCH POLICY
|
# Error message for BRANCH POLICY
|
||||||
error_msg_branch=$(cat <<-END
|
error_msg_branch=$(cat <<-END
|
||||||
|
|
||||||
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
@ @
|
@ @
|
||||||
@ !!! Push not allowed by BRANCH NAME policy !!! @
|
@ !!! Push not allowed by BRANCH NAME policy !!! @
|
||||||
@ @
|
@ @
|
||||||
@ You branch should be named with these templates: @
|
@ You branch should be named with these templates: @
|
||||||
@ - master @
|
@ - master @
|
||||||
@ - main @
|
@ - main @
|
||||||
@ - feature/EVA_ID-000--* @
|
@ - feature/EVA_ID-000--* @
|
||||||
@ - bugfix/* @
|
@ - bugfix/* @
|
||||||
@ - hotfix/* @
|
@ - hotfix/* @
|
||||||
@ @
|
@ @
|
||||||
@ Example: feature/DO-167--add_new_functionality @
|
@ Example: feature/DO-167--add_new_functionality @
|
||||||
@ @
|
@ @
|
||||||
@ Wiki: https://eva.avroid.tech/project/Document/DOC-000518 @
|
@ Wiki: https://eva.avroid.tech/project/Document/DOC-000518 @
|
||||||
@ @
|
@ @
|
||||||
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
|
|
||||||
END
|
END
|
||||||
)
|
)
|
||||||
|
|
||||||
error_msg_commit=$(cat <<-END
|
error_msg_commit=$(cat <<-END
|
||||||
|
|
||||||
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
@ @
|
@ @
|
||||||
@ !!! Your Commit does not have a referance to Eva ticket !!! @
|
@ !!! Your Commit does not have a referance to Eva ticket !!! @
|
||||||
@ @
|
@ @
|
||||||
@ Please correct your Git messages, and push again. @
|
@ Please correct your Git messages, and push again. @
|
||||||
@ Example: "[DO-1234] This is a correct Eva reference" @
|
@ Example: "[DO-1234] This is a correct Eva reference" @
|
||||||
@ @
|
@ @
|
||||||
@ Wiki: https://eva.avroid.tech/project/Document/DOC-000518 @
|
@ Wiki: https://eva.avroid.tech/project/Document/DOC-000518 @
|
||||||
@ @
|
@ @
|
||||||
@ To FORCE push, use "bugfix" or "hotfix" in your commit message @
|
@ To FORCE push, use "bugfix" or "hotfix" in your commit message @
|
||||||
@ @
|
@ @
|
||||||
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
|
|
||||||
END
|
END
|
||||||
)
|
)
|
||||||
|
|
||||||
while read oldrev newrev refname
|
while read oldrev newrev refname
|
||||||
do
|
do
|
||||||
|
|
||||||
#
|
#
|
||||||
# Step 1:
|
# Step 1:
|
||||||
# Get Git commit information
|
# Get Git commit information
|
||||||
#
|
#
|
||||||
|
|
||||||
BRANCH_NAME_FULL=$refname
|
BRANCH_NAME_FULL=$refname
|
||||||
BRANCH_NAME="$(echo $BRANCH_NAME_FULL | sed 's/refs\/heads\///g')"
|
BRANCH_NAME="$(echo $BRANCH_NAME_FULL | sed 's/refs\/\(heads\|pull\)\///g')"
|
||||||
COMMIT_MESSAGE=$(git log --format=%B -n 1)
|
COMMIT_MESSAGE=$(git log --format=%B -n 1)
|
||||||
echo "[INFO] BRANCH NAME: $BRANCH_NAME"
|
echo "[INFO] BRANCH NAME: $BRANCH_NAME"
|
||||||
|
|
||||||
@@ -57,9 +59,10 @@ do
|
|||||||
# Step 2:
|
# Step 2:
|
||||||
# Policy - Check that brunch name is enforced by branch name
|
# Policy - Check that brunch name is enforced by branch name
|
||||||
#
|
#
|
||||||
|
|
||||||
echo "[INFO] Policy - Check that brunch name is enforced by branch name"
|
echo "[INFO] Policy - Check that brunch name is enforced by branch name"
|
||||||
# Regexp for allowed names of branches
|
# Regexp for allowed names of branches
|
||||||
branch_name_format='^master|^main|^feature\/[a-zA-Z0-9,\.\_\-]+-[0-9]+.*|^hotfix\/.*|^bugfix\/.*'
|
branch_name_format='^[0-9]+\/head|^master|^main|^feature\/[a-zA-Z0-9,\.\_\-]+-[0-9]+.*|^hotfix\/.*|^bugfix\/.*'
|
||||||
|
|
||||||
if [[ ! $BRANCH_NAME =~ $branch_name_format ]]; then
|
if [[ ! $BRANCH_NAME =~ $branch_name_format ]]; then
|
||||||
echo "$error_msg_branch" >&2
|
echo "$error_msg_branch" >&2
|
||||||
|
|||||||
Reference in New Issue
Block a user