diff --git a/Jenkinsfile b/Jenkinsfile index 2518f1b..7cdd8b7 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -3,17 +3,20 @@ pipeline { environment { 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_TOKEN = '090ac0a087634a808792833fa23368d100ec03d9' MAIN_BRANCH = 'master' } - stages { + 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_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') { @@ -45,7 +48,7 @@ pipeline { } stage('Cleaning') { steps { - sh "rm -fr jenkins-test3" + sh "rm -fr ${env.GITEA_REPO_NAME}" } } } @@ -58,8 +61,10 @@ pipeline { 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: "${env.GITEA_REPO_URL}/statuses/${commitSha}", + url: apiUrl, httpMode: 'POST', customHeaders: [ [name: 'Content-Type', value: 'application/json'], @@ -77,4 +82,4 @@ pipeline { } } } -} +} \ No newline at end of file