|
@ -3,17 +3,20 @@ pipeline { |
|
|
|
|
|
|
|
|
environment { |
|
|
environment { |
|
|
GITEA_CREDS = 'testtest' |
|
|
GITEA_CREDS = 'testtest' |
|
|
|
|
|
GITEA_REPO_OWNER = 'mh' |
|
|
|
|
|
GITEA_REPO_NAME = 'jenkins-test3' |
|
|
|
|
|
GITEA_SERVER = 'http://194.5.205.38:3000' |
|
|
GITEA_REPO_URL = 'http://194.5.205.38:3000/mh/TEst.git' |
|
|
GITEA_REPO_URL = 'http://194.5.205.38:3000/mh/TEst.git' |
|
|
GITEA_TOKEN = '090ac0a087634a808792833fa23368d100ec03d9' |
|
|
GITEA_TOKEN = '090ac0a087634a808792833fa23368d100ec03d9' |
|
|
MAIN_BRANCH = 'master' |
|
|
MAIN_BRANCH = 'master' |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
stages { |
|
|
stages { |
|
|
stage('Clone the repo') { |
|
|
stage('Clone the repo') { |
|
|
steps { |
|
|
steps { |
|
|
echo "Clone the repo" |
|
|
echo "Clone the repo" |
|
|
sh "rm -fr jenkins-test3" |
|
|
sh "rm -fr jenkins-test3" |
|
|
git branch: "${env.MAIN_BRANCH}", credentialsId: "${env.GITEA_CREDS}", url: "${env.GITEA_REPO_URL}" |
|
|
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') { |
|
|
stage('Code Analysis') { |
|
@ -45,7 +48,7 @@ pipeline { |
|
|
} |
|
|
} |
|
|
stage('Cleaning') { |
|
|
stage('Cleaning') { |
|
|
steps { |
|
|
steps { |
|
|
sh "rm -fr jenkins-test3" |
|
|
sh "rm -fr ${env.GITEA_REPO_NAME}" |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -58,8 +61,10 @@ pipeline { |
|
|
def description = "Jenkins build ${status}" |
|
|
def description = "Jenkins build ${status}" |
|
|
def commitSha = env.GIT_COMMIT |
|
|
def commitSha = env.GIT_COMMIT |
|
|
|
|
|
|
|
|
|
|
|
def apiUrl = "${env.GITEA_SERVER}/api/v1/repos/${env.GITEA_REPO_OWNER}/${env.GITEA_REPO_NAME}/statuses/${commitSha}" |
|
|
|
|
|
|
|
|
httpRequest( |
|
|
httpRequest( |
|
|
url: "${env.GITEA_REPO_URL}/statuses/${commitSha}", |
|
|
url: apiUrl, |
|
|
httpMode: 'POST', |
|
|
httpMode: 'POST', |
|
|
customHeaders: [ |
|
|
customHeaders: [ |
|
|
[name: 'Content-Type', value: 'application/json'], |
|
|
[name: 'Content-Type', value: 'application/json'], |
|
@ -77,4 +82,4 @@ pipeline { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |