更准确地说,我需要获取触发我的多分支构建的 PR 的标签列表。是否可以?
我知道https://github.com/jenkinsci/pipeline-github-plugin但使用了不兼容的 Jenkins 版本和多分支管道。
我有一个运行多个Jenkinsfile选择分支的多分支管道。现在我需要Jenkinsfile用参数运行它,所以我想我可以使用常规管道。
现在我要做的就是确定我是否在多分支管道中运行。我可以检查构建中的任何参数,当没有任何参数时,我可以推断出我处于多分支管道中:
def isMultibranchPipeline() {
!params.any()
}
Run Code Online (Sandbox Code Playgroud)
我正在寻找一种更直接的方法来了解脚本是否在多分支管道中运行,但找不到类似的方法。
我通过 BlueOcean UI 在本地 Jenkins 上创建了非常基本的多分支管道。从默认配置中,我删除了几乎所有行为,除了发现分支的行为。配置看起来如下:
在Jenkinsfile我尝试设置以下场景中:
master分支摘自我的Jenkinsfile:
pipeline {
agent none
stages {
stage('Setup') {
agent {
label "master"
}
steps {
sh "git checkout -f ${env.BRANCH_NAME}"
}
}
stage('Merge with master') {
when {
not {
branch 'master'
}
}
agent {
label "master"
}
steps {
sh 'git checkout -f origin/master'
sh "git merge --ff-only ${env.BRANCH_NAME}"
}
}
stage('Build Back-end') {
agent {
docker {
image 'openjdk:8' …Run Code Online (Sandbox Code Playgroud) 我有一个 Jenkins 多分支管道,配置为在通过 javaws 配置的 mac 10.14 节点上运行测试和声纳库扫描。在结帐时,它在 scm 结帐期间失败:
[Pipeline] End of Pipeline
[Bitbucket] Notifying commit build result
[Bitbucket] Build result notified
hudson.plugins.git.GitException: Command "/usr/local/bin/git checkout -f 7dca678ce3a4a8f93fe8ed4bb4920db40c417839" returned status code 128:
stdout:
stderr: git-lfs filter-process: git-lfs: command not found
fatal: the remote end hung up unexpectedly
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2172)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$1000(CliGitAPIImpl.java:78)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$9.execute(CliGitAPIImpl.java:2453)
Also: hudson.remoting.Channel$CallSiteStackTrace: Remote call to JNLP4-connect connection from platform-e2e-mac.mynetwork.com/10.1.4.49:49175
at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1741)
at hudson.remoting.UserRequest$ExceptionResponse.retrieve(UserRequest.java:356)
at hudson.remoting.Channel.call(Channel.java:955)
at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.execute(RemoteGitImpl.java:146)
at sun.reflect.GeneratedMethodAccessor761.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.invoke(RemoteGitImpl.java:132) …Run Code Online (Sandbox Code Playgroud) 是否可以将 Multibranch 管道限制为一次仅构建一个分支?
我有一个管道,其中包含检出、构建、测试和部署的步骤。部署阶段在特定机器上执行一些无法与其他分支作业并行完成的文件的复制/执行。
我试过了:
properties([disableConcurrentBuilds()])
Run Code Online (Sandbox Code Playgroud)
但这仅限制了分支的并发性,因此仍然会并行运行多个分支。
此外,在常规的非流水线 Jenkins 作业中,有一个选项复选框:
“如有必要,执行并发构建”
但这在多分支配置中也不可用。
是否有其他配置可以实现这一点还是设计使然?
我正在做一个与这个问题相同的项目。即使我使用相同的解决方案,我仍然遇到以下错误。git 最近有更新吗?或者有人有解决方案来解决它吗?
16:48:06 + git rev-parse upstream/master
16:48:06 fatal: ambiguous argument 'upstream/master': unknown revision or path not in the working tree.
16:48:06 Use '--' to separate paths from revisions, like this:
16:48:06 'git <command> [<revision>...] -- [<file>...]'
16:48:06 upstream/master
Run Code Online (Sandbox Code Playgroud) 目前我有一个多分支管道作业,其中构建发生,cppcheck用于分析代码.但是,multibranch管道中没有"post build actions"选项卡可用于启用"发布cppcheck结果".我一直在网上寻找答案,但我找不到.
只有通用,构建触发器,高级项目选项和管道选项卡可用(我推荐了高级项目选项,没有选项可以在那里添加后期构建部分).
有没有办法使用jenkinsfile本身对cppcheck.xml发布进行硬编码?有没有我可以使用的语法将调用cppcheck插件来检查xml文件并发布它.这确实是一个紧急要求.我尝试了很多搜索将xml转换为其他格式,如html或jnuit xml.似乎没什么用.有人可以帮忙吗?
groovy cppcheck jenkins jenkins-pipeline multibranch-pipeline