Commit 57227807 authored by OAI Jenkins's avatar OAI Jenkins

adding mr comment on OAI rules

Signed-off-by: default avatarOAI Jenkins <jenkins@openairinterface.org>
parent f9260919
...@@ -15,21 +15,27 @@ pipeline { ...@@ -15,21 +15,27 @@ pipeline {
stage ("Verify Parameters") { stage ("Verify Parameters") {
steps { steps {
echo 'Verify Parameters' echo 'Verify Parameters'
echo "Base URL is ${JENKINS_URL}" //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 "Git URL is ${GIT_URL}" echo "Git URL is ${GIT_URL}"
echo "GitLab Act is ${env.gitlabActionType}" echo "GitLab Act is ${env.gitlabActionType}"
script { script {
if ("MERGE".equals(env.gitlabActionType)) { if ("MERGE".equals(env.gitlabActionType)) {
echo "GitLab src branch is ${env.gitlabSourceBranch}" //echo "GitLab src branch is ${env.gitlabSourceBranch}"
echo "GitLab tar branch is ${env.gitlabTargetBranch}" //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 // GitLab-Jenkins pugin integration is lacking to perform the merge by itself
// Doing it manually --> it may have merge conflicts // 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}" 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 { } else {
echo "Git Branch is ${GIT_BRANCH}"
echo "Git Commit is ${GIT_COMMIT}"
sh "./scripts/checkCodingFormattingRules.sh" sh "./scripts/checkCodingFormattingRules.sh"
} }
} }
......
...@@ -37,6 +37,7 @@ then ...@@ -37,6 +37,7 @@ then
fi fi
done done
echo "Nb Files that do NOT follow OAI rules: $NB_TO_FORMAT" echo "Nb Files that do NOT follow OAI rules: $NB_TO_FORMAT"
echo $NB_TO_FORMAT > ./oai_rules_result.txt
exit 0 exit 0
fi fi
......
#!/bin/bash #!/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 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 TARGET_BRANCH=$3
echo "Target Branch is : $TARGET_BRANCH" echo "Target Branch is : $TARGET_BRANCH"
TARGET_COMMIT_ID=$3 TARGET_COMMIT_ID=$4
echo "Target CommID is : $TARGET_COMMIT_ID" echo "Target Commit ID is : $TARGET_COMMIT_ID"
git config user.email "jenkins@openairinterface.org" git config user.email "jenkins@openairinterface.org"
git config user.name "OAI Jenkins" git config user.name "OAI Jenkins"
SOURCE_INIT_COMMIT=`cat .git/refs/remotes/origin/$SOURCE_BRANCH` git checkout -f $SOURCE_COMMIT_ID
git checkout -f $SOURCE_INIT_COMMIT
git merge --ff $TARGET_COMMIT_ID -m "Temporary merge for CI" 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