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")
    }
}

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

Vault in Jenkins

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

Activate Vault plugin. To get value add to your Jenkinsfile:

    def secrets = [
        [path: 'jenkins/test', engineVersion: 1, secretValues: [
            [envVar: 'testing', vaultKey: 'myvar']
        ]]
    ]

    withVault([vaultSecrets: secrets]) {
        sh 'echo "$testing" > myvar'
    }

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

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

Fortune cookie: A liberal is someone too poor to be a capitalist, and too rich to be a communist.