Gitlab-plugin: Jenkins multibranch pipeline not auto-starting on tag push

Created on 23 May 2019  路  3Comments  路  Source: jenkinsci/gitlab-plugin

Before submitting an issue I have first:

(if you have performed all the above, remove the paragraph and continue describing the issue with template below)

Issue

I'm trying to trigger a build on a push tag event for a multibranch pipeline. When I push a tag to Gitlab the tag will show up in Jenkins but won't build. I have to click on Run for it to build. When I click edit it shows the following error:

There was an error loading the pipeline from the Jenkinsfile in this repository. Correct the error by editing the Jenkinsfile using the declarative syntax then commit it back to the repository.

fetch failed: 500 for https://GITLAB/blue/rest/organizations/jenkins/pipelines/my-pipeline/scm/content?path=Jenkinsfile&branch=v0.0.1

I have refspecs as follows +refs/tags/*:refs/remotes/origin/tags/* though I can't see a way to add a branch specifier for a multibranch pipeline.


Jenkinsfile

pipeline {
  agent any
  options {
    // Connection is configured by the Jenkins Gitlab plugin
    // Manage Jenkins -> Configure System -> Gitlab
    gitLabConnection('my-gitlab')
    // Keep only the 2 latest builds.
    buildDiscarder(logRotator(numToKeepStr: '2'))
    // Prepend all console output generated by the Pipeline run with the time at which the line was emitted
    timestamps()
  }
  triggers {
    gitlab(triggerOnPush: true, triggerOnMergeRequest: true, branchFilterType: 'All')
  }
  post {
    always {
      // clean up our workspace
      deleteDir()
    }
    failure {
      updateGitlabCommitStatus name: 'my-pipeline', state: 'failed'
    }
    success {
      updateGitlabCommitStatus name: 'my-pipeline', state: 'success'
    }
  }
  stages {
    stage('NPM Install') {
      steps {
        sh '''
        npm config set strict-ssl false
        npm set registry https://my-npm/
        npm ci
        '''
      }
    }
    stage('Checks') {
      parallel {
        stage('Format') {
          steps {
            sh 'npm run format:ci'
          }
        }
        stage('Lint') {
          steps {
            sh 'npm run lint'
          }
        }
      }
    }
    stage('Dev Build') {
      steps {
        sh 'npm run build:prod'
      }
    }
    stage('Dev Deploy') {
      steps {
        sh '*'
      }
    }
    stage('PoC Build'){
      when { tag "v*" } // also tried when { buildingTag() }
      steps {
        sh 'npm run build:poc'
      }
    }
  }
}

Context

  • Gitlab plugin version: 1.5.12
  • Gitlab version: 11.0.4
  • Jenkins version: 2.169
  • Job type: Multibranch Pipeline

Logs & Traces

No relevant logs

_Please include any relevant log that could serve to better understand the source of your issue_
For Jenkins Gitlab Plugin logs, follow instruction in User Support section.
For Gitlab logs, ask an administrator to provide you the relevant Gitlab logs.

Problem description

_Describe your problem in a meaningful way_:

  • what were you doing (simple push, merge request, MR with fork, ...)
  • what was expected
  • what occurred finally

Most helpful comment

closing as no longer using Jenkins

All 3 comments

Same problem

I ran into the same problem however from what I have read I believe this is by design. See the following links for more details:

https://stackoverflow.com/questions/52404216/trigger-jenkins-build-on-tag-creation-with-multibranch-pipeline
https://issues.jenkins-ci.org/browse/JENKINS-47496

closing as no longer using Jenkins

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pablobirukov picture pablobirukov  路  5Comments

gempain picture gempain  路  3Comments

Kiran-B picture Kiran-B  路  6Comments

omehegan picture omehegan  路  3Comments

ffrddrll picture ffrddrll  路  6Comments