Commit 57227807 authored by OAI Jenkins's avatar OAI Jenkins

adding mr comment on OAI rules

Signed-off-by: 's avatarOAI Jenkins <jenkins@openairinterface.org>
parent f9260919
......@@ -15,21 +15,27 @@ pipeline {
stage ("Verify Parameters") {
steps {
echo 'Verify Parameters'
echo "Base URL is ${JENKINS_URL}"
echo "Git Branch is ${GIT_BRANCH}"
echo "Git Commit is ${GIT_COMMIT}"
echo "Git Last Commit is ${env.gitlabMergeRequestLastCommit}"
//echo "Base URL is ${JENKINS_URL}"
echo "Git URL is ${GIT_URL}"
echo "GitLab Act is ${env.gitlabActionType}"
script {
if ("MERGE".equals(env.gitlabActionType)) {
echo "GitLab src branch is ${env.gitlabSourceBranch}"
echo "GitLab tar branch is ${env.gitlabTargetBranch}"
//echo "GitLab src branch is ${env.gitlabSourceBranch}"
//echo "GitLab tar branch is ${env.gitlabTargetBranch}"
//echo "Git Last Commit is ${env.gitlabMergeRequestLastCommit}"
// GitLab-Jenkins pugin integration is lacking to perform the merge by itself
// Doing it manually --> it may have merge conflicts
sh "./scripts/doGitLabMerge.sh ${env.gitlabSourceBranch} ${env.gitlabTargetBranch} ${GIT_COMMIT}"
sh "./scripts/doGitLabMerge.sh ${env.gitlabSourceBranch} ${env.gitlabMergeRequestLastCommit} ${env.gitlabTargetBranch} ${GIT_COMMIT}"
sh "./scripts/checkCodingFormattingRules.sh ${env.gitlabSourceBranch} ${env.gitlabTargetBranch}"
def res=readFile('./oai_rules_result.txt').trim();
if ("0".equals(res) {
addGitLabMRComment comment: "All Changed files in Merge Request follow OAI Formatting Rules"
} else {
addGitLabMRComment comment: "Some Changed files in Merge Request DO NOT follow OAI Formatting Rules"
}
} else {
echo "Git Branch is ${GIT_BRANCH}"
echo "Git Commit is ${GIT_COMMIT}"
sh "./scripts/checkCodingFormattingRules.sh"
}
}
......
......@@ -37,6 +37,7 @@ then
fi
done
echo "Nb Files that do NOT follow OAI rules: $NB_TO_FORMAT"
echo $NB_TO_FORMAT > ./oai_rules_result.txt
exit 0
fi
......
#!/bin/bash
if [ $# -ne 4 ]
then
echo "Syntax Error: $0 src-branch src-commit-id dest-branch dest-commit-id"
exit 1
fi
SOURCE_BRANCH=$1
echo "Source Branch is : $SOURCE_BRANCH"
echo "Source Branch is : $SOURCE_BRANCH"
SOURCE_COMMIT_ID=$2
echo "Source Commit ID is : $SOURCE_COMMIT_ID"
TARGET_BRANCH=$2
echo "Target Branch is : $TARGET_BRANCH"
TARGET_BRANCH=$3
echo "Target Branch is : $TARGET_BRANCH"
TARGET_COMMIT_ID=$3
echo "Target CommID is : $TARGET_COMMIT_ID"
TARGET_COMMIT_ID=$4
echo "Target Commit ID is : $TARGET_COMMIT_ID"
git config user.email "jenkins@openairinterface.org"
git config user.name "OAI Jenkins"
SOURCE_INIT_COMMIT=`cat .git/refs/remotes/origin/$SOURCE_BRANCH`
git checkout -f $SOURCE_INIT_COMMIT
git checkout -f $SOURCE_COMMIT_ID
git merge --ff $TARGET_COMMIT_ID -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