Setting up a Jenkins Pipeline build with parameters

て烟熏妆下的殇ゞ 提交于 2019-12-07 08:31:04

问题


I've been reading a lot about Jenkins 2.x and the pipeline system in order to create a setup with the following features;

  1. A SCM managed Jenkinsfile.
  2. Building each commit to the (git) repository.
  3. Passing parameters through the webhook trigger.

So far I failed to build a working set-up because of various reasons, some of the things I tried are;

Multibranch Pipeline Setup

  • My jenkinsfile from the git repository was picked up perfectly.
  • Triggering through the git plugins notifyCommit webhook works well (http://localhost:8080/git/notifyCommit?url=...)
  • There is no way to pass additional parameters this way.

So I was wondering if there is any other way to trigger these builds? The trigger build remotely and generic webhook options do not show up when configuring the multibranch pipeline.

Regular Pipeline

  • Creating the pipeline works and the trigger options mentioned earlier are available.
  • Picked 'Jenkinsfile from SCM' and used git.
  • Tried blank for 'branches', tried refs/heads/**,... a whole bunch of combinations.

Does Jenkins in this case assume a Jenkinsfile to be present in each branch? It seems like the notifyCommit webhook doesn't even trigger this.

If I force a manual build Jenkins doesn't know what to build it seems:

git fetch --tags --progress git@bitbucket.org:project.git +refs/heads/*:refs/remotes/origin/*
Seen branch in repository origin/a
Seen branch in repository origin/master
Seen 2 remote branches
   git tag -l # timeout=10
   git rev-parse refs/tags/tagY^{commit} # timeout=10
   git rev-parse refs/tags/tagX^{commit} # timeout=10
ERROR: Couldn't find any revision to build. Verify the repository and branch configuration for this job.
Finished: FAILURE

来源:https://stackoverflow.com/questions/44516870/setting-up-a-jenkins-pipeline-build-with-parameters

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!