INT 21h

Hi, I am Vladimir Smagin, SysAdmin and Kaptain. Telegram Email / GIT / RSS / GPG

Send build status from Jenkins to Gitlab

№ 11249 В разделе "Sysadmin" от March 16th, 2021,
В подшивках: ,

Install Gitlab plugin into Jenkins, add connection in global settings (or project settings), add to Jenkinsfile:

properties([gitLabConnection('gitlab-21h')])

node {
    checkout scm
    updateGitlabCommitStatus(name: "Release", state: "running")
    try {
        stage("Tests") {
            updateGitlabCommitStatus(name: "Tests", state: "running")
            echo "Tests"
            updateGitlabCommitStatus(name: "Tests", state: "success")
        }
        stage("Build") {
            updateGitlabCommitStatus(name: "Build", state: "running")
            echo "Build"
            updateGitlabCommitStatus(name: "Build", state: "success")
        }
        stage("Publish") {
            updateGitlabCommitStatus(name: "Publish", state: "running")
            echo "Publish"
            updateGitlabCommitStatus(name: "Publish", state: "success")
        }
       updateGitlabCommitStatus(name: "Release", state: "success")
       addGitLabMRComment(comment: "Release successfully complete")
    } catch (Exception e) {
        updateGitlabCommitStatus(name: "Release", state: "failed")
        addGitLabMRComment(comment: "Release successfully failed")
    }
}

Нет комментариев »

Leave a Reply

Your email address will not be published. Required fields are marked *

*

Яндекс.Метрика

Fortune cookie: Q: What's the difference between a man and the weekend? A: The weekend never comes too soon.