You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
85 lines
2.7 KiB
85 lines
2.7 KiB
pipeline {
|
|
agent any
|
|
|
|
environment {
|
|
GITEA_CREDS = 'testtest'
|
|
GITEA_REPO_OWNER = 'mh'
|
|
GITEA_REPO_NAME = 'TEst'
|
|
GITEA_SERVER = 'http://194.5.205.38:3000'
|
|
GITEA_REPO_URL = 'http://194.5.205.38:3000/mh/TEst.git'
|
|
GITEA_TOKEN = '090ac0a087634a808792833fa23368d100ec03d9'
|
|
MAIN_BRANCH = 'master'
|
|
}
|
|
|
|
stages {
|
|
stage('Clone the repo') {
|
|
steps {
|
|
echo "Clone the repo"
|
|
sh "rm -fr jenkins-test3"
|
|
git branch: "${env.MAIN_BRANCH}", credentialsId: "${env.GITEA_CREDS}", url: "${env.GITEA_SERVER}/${env.GITEA_REPO_OWNER}/${env.GITEA_REPO_NAME}.git"
|
|
}
|
|
}
|
|
stage('Code Analysis') {
|
|
parallel {
|
|
stage('CppCheck') {
|
|
steps {
|
|
sleep 3
|
|
sh 'cppcheck_configs/cpp_check_scripts.sh'
|
|
}
|
|
}
|
|
stage('Clang Tidy') {
|
|
steps {
|
|
sh 'clang_configs/clang_tidy_script.sh'
|
|
}
|
|
}
|
|
|
|
stage('Clang Format') {
|
|
steps {
|
|
sh 'clang_configs/clang_format_script.sh'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
stage('Deploy') {
|
|
steps {
|
|
sleep 10
|
|
echo "Deploy"
|
|
}
|
|
}
|
|
stage('Cleaning') {
|
|
steps {
|
|
sh "rm -fr ${env.GITEA_REPO_NAME}"
|
|
}
|
|
}
|
|
}
|
|
|
|
post {
|
|
always {
|
|
script {
|
|
def status = currentBuild.result == 'SUCCESS' ? 'success' : 'failure'
|
|
def state = status == 'success' ? 'success' : 'failure'
|
|
def description = "Jenkins build ${status}"
|
|
def commitSha = env.GIT_COMMIT
|
|
|
|
def apiUrl = "${env.GITEA_SERVER}/api/v1/repos/${env.GITEA_REPO_OWNER}/${env.GITEA_REPO_NAME}/statuses/${commitSha}"
|
|
|
|
httpRequest(
|
|
url: apiUrl,
|
|
httpMode: 'POST',
|
|
customHeaders: [
|
|
[name: 'Content-Type', value: 'application/json'],
|
|
[name: 'Authorization', value: "token ${env.GITEA_TOKEN}"]
|
|
],
|
|
requestBody: """
|
|
{
|
|
"state": "${state}",
|
|
"target_url": "${env.BUILD_URL}",
|
|
"description": "${description}",
|
|
"context": "continuous-integration/jenkins"
|
|
}
|
|
"""
|
|
)
|
|
}
|
|
}
|
|
}
|
|
}
|