Commit ea6c5de6 authored by Raphael Defosseux's avatar Raphael Defosseux

Adding proper merge script

Signed-off-by: Raphael Defosseux's avatarRaphael Defosseux <raphael.defosseux@eurecom.fr>
parent 004a48c9
......@@ -26,8 +26,9 @@ pipeline {
echo "GitLab tar branch is ${env.gitlabTargetBranch}"
// GitLab-Jenkins pugin integration is lacking to perform the merge by itself
// Doing it manually --> it may have merge conflicts
sh "git merge --ff origin/${env.gitlabTargetBranch}"
sh "git log -n1"
sh "./scripts/doGitLabMerge.sh ${GIT_COMMIT} ${env.gitlabTargetBranch}"
sh "./scripts/checkCodingFormattingRules.sh ${GIT_COMMIT} ${env.gitlabTargetBranch}"
} else {
sh "./scripts/checkCodingFormattingRules.sh"
}
}
......
#!/bin/bash
NB_FILES_TO_FORMAT=`astyle --dry-run --options=scripts/astyle-options.txt src/*.* | grep -c Formatted `
if [ $# -eq 0 ]
then
NB_FILES_TO_FORMAT=`astyle --dry-run --options=scripts/astyle-options.txt src/*.* | grep -c Formatted `
echo "Nb Files that do NOT follow OAI rules: $NB_FILES_TO_FORMAT"
exit 0
fi
echo "Nb Files that do NOT follow OAI rules: $NB_FILES_TO_FORMAT"
if [ $# -eq 2 ]
then
# Merge request scenario
INIT_COMMIT=$1
echo "Initial Commit is : $INIT_COMMIT"
TARGET_BRANCH=$2
echo "Target Branch is : $TARGET_BRANCH"
MERGE_COMMMIT=`git log -n1 | grep commit | sed -e "s@commit @@"`
echo "Merged Commit is : $MERGE_COMMMIT"
TARGET_INIT_COMMIT=`cat .git/refs/remotes/origin/$TARGET_BRANCH`
echo "Target Init is : $TARGET_INIT_COMMIT"
# Retrieve the list of modified files since the latest develop commit
MODIFIED_FILES=`git log $TARGET_INIT_COMMIT..$MERGE_COMMMIT --oneline --name-status | egrep "^M|^A" | sed -e "s@^M\t*@@" -e "s@^A\t*@@" | sort | uniq`
NB_TO_FORMAT=0
for FULLFILE in $MODIFIED_FILES
do
echo $FULLFILE
filename=$(basename -- "$FULLFILE")
EXT="${filename##*.}"
if [ $EXT = "c" ] || [ $EXT = "h" ]
then
TO_FORMAT=`astyle --dry-run --options=scripts/astyle-options.txt $FULLFILE | grep -c Formatted `
NB_TO_FORMAT=${NB_TO_FORMAT}+1
fi
done
echo "Nb Files that do NOT follow OAI rules: $NB_TO_FORMAT"
exit 0
fi
if [ $# -ne 0 ] || [ $# -ne 2 ]
then
echo "Syntax error: $0 without any option will check all files in repository"
echo " or: $0 feature-branch-commit-id target-branch"
echo " will only check files that are pushed for a merge-request"
exit 1
fi
#!/bin/bash
INIT_COMMIT=$1
echo "Initial Commit is : $INIT_COMMIT"
TARGET_BRANCH=$2
echo "Target Branch is : $TARGET_BRANCH"
git checkout origin/$TARGET_BRANCH
git config user.email "jenkins@openairinterface.org"
git config user.name "OAI Jenkins"
git merge --ff $INIT_COMMIT -m "Temporary merge for CI"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment