Commit 5079a12a authored by Raphael Defosseux's avatar Raphael Defosseux

Merge branch 'ci-try-outs' into 'develop'

MR nb 4

See merge request !4
parents 2aa886e0 c1e06c1a
// Comments
pipeline {
agent {
label 'bellatrix'
}
options {
disableConcurrentBuilds()
timestamps()
}
stages {
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 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}"
// 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"
} else {
def message = "OAI build #" + BUILD_ID
updateGitlabCommitStatus name: message, state: 'pending'
}
}
}
}
stage ('Build') {
steps {
sh "gcc src/test1.c -o bin/test1"
sh "gcc src/test2.c -o bin/test2"
sh "cppcheck --enable=warning --force --xml --xml-version=2 src 2> cppcheck.xml"
}
}
stage ('Test') {
steps {
sh "./bin/test1"
sh "./bin/test2"
}
}
}
post {
always {
script {
if(fileExists('cppcheck.xml')) {
archiveArtifacts artifacts: 'cppcheck.xml'
}
}
}
success {
script {
if ("MERGE".equals(env.gitlabActionType)) {
echo "This is a MERGE event"
def msg = "OAI build #" + BUILD_ID + " passed"
echo "$msg"
addGitLabMRComment comment: msg
def message = "OAI build #" + BUILD_ID + " passed (" + BUILD_URL + ")"
echo "$message"
addGitLabMRComment comment: message
} else {
echo "This is a PUSH event"
def message = "OAI build #" + BUILD_ID
echo "$message"
updateGitlabCommitStatus name: message, state: 'success'
}
}
}
failure {
script {
if ("MERGE".equals(env.gitlabActionType)) {
echo "This is a MERGE event"
def message = "OAI build #" + BUILD_ID + " failed (" + BUILD_URL + ")"
addGitLabMRComment comment: message
} else {
echo "This is a PUSH event"
def message = "OAI build #" + BUILD_ID
updateGitlabCommitStatus name: message, state: 'failed'
}
}
}
}
}
/*
* Comments
*/
#include <stdio.h>
int main()
......
/*
* Copyright OAI Software Alliance - 2018
* Author Raphael Defosseux
* Comments : Proper comments
*/
#include <stdio.h>
int main()
{
int testId = 2;
printf ("Test #%d\n", testId);
return 0;
}
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