Jenkins pipeline builds jobs on Gitlab push

I am currently implementing CI on my projects :

  • The code is hosted on a custom GitLab server
  • Jenkins must handle the projects build
  • Each project will be build on each push and merge request
  • GitLab parameters are setup inside Jenkins, and a simple build job works (through GitLab hooks) when I push some commits. All the configuration has been done according to the GitLab jenkins plugin documentation.

    My projects need to build on both Linux and Windows systems, which require then 2 jobs to run on each push. To get a more clear CI output on GitLab, I want to create a pipeline which run the jobs.

    The problem is that, once the pipeline triggered, the builds fails on the jobs with the following message :

    git rev-parse refs/remotes/origin/${gitlabSourceBranch}^{commit} # timeout=10
    git rev-parse refs/remotes/origin/origin/${gitlabSourceBranch}^{commit} # timeout=10
    git rev-parse origin/${gitlabSourceBranch}^{commit} # timeout=10
    ERROR: Couldn't find any revision to build. Verify the repository and branch configuration for this job.

    Both jobs have the same Git parameters, described in the plugin documentation :

  • Refspec : +refs/heads/*:refs/remotes/origin/*
  • Branch Specifier (blank for 'any') : origin/${gitlabSourceBranch}
  • The pipeline configuration is the following :

    node() {
        gitlabBuilds(builds: ["build", "test"]) {
            stage "build"
            gitlabCommitStatus("build") {
                build job :'Application build'
            }
    
            stage "test"
            gitlabCommitStatus("test") {
                build job :'Application test'
            }
        }
    }
    

    Hope you could help ! Thank you.

    链接地址: http://www.djcxy.com/p/85116.html

    上一篇: 模板方法和策略模式有什么区别?

    下一篇: Jenkins管道在Gitlab推送上创建作业