问题标签 [jenkins-pipeline]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
3 回答
12084 浏览

jenkins - Jenkins:更新站点“默认”中的签名验证失败(显示详细信息)

我已经在实例上安装了 Jenkins Amazon EC2,我正在尝试获取可用插件的更新列表。
当我转到 时Manage Plugins --> Advanced --> Check now(at the bottom),我收到如下错误:

更新站点“默认”中的签名验证失败(显示详细信息)

0 投票
2 回答
3999 浏览

jenkins - Jenkins 多分支管道 - GitHub Enterprise 问题?

我花了几天的时间来解决/研究这个问题。我似乎无法弄清楚这里发生了什么。我正在尝试设置一个指向我们内部 GitHub 企业服务器的多分支管道项目。同样的问题也出现在其他项目类型中,例如“GitHub 组织”。这是某种我无法弄清楚的安全问题。

让我们从我所知道的开始......

我已经(据我所知)使用令牌正确配置了 GitHub 插件配置(也根据文档进行了配置)......我可以成功地“验证凭据”并且它成功返回。http://imgur.com/br13adk

我在 GitHub Enterprise Servers Validation 上不断收到此验证问题

http://imgur.com/GnffTeV

我可以成功连接到托管在我的企业 github 服务器上的任何 ONE 存储库。当我尝试从 GitHub 源配置多分支项目时,我的存储库总是空白...... http://imgur.com/2Q9s1mo

我配置了一个自定义记录器来查看发生了什么,并且分支源插件似乎总是输出到 api.github.com ......

Jan 25, 2016 11:48:23 AM WARNING org.jenkinsci.plugins.github_branch_source.Endpoint$DesciptorImpl doCheckApiUri Jan 25, 2016 11:48:23 AM WARNING org.jenkinsci.plugins.github_branch_source.Endpoint$DesciptorImpl doCheckApiUri Jan 25, 2016 11:54:58 AM WARNING org.jenkinsci.plugins.github_branch_source.AbstractGitHubSCMSource$AbstractGitHubSCMSourceDescriptor doFillRepositoryItems Server returned HTTP response code: 401 for URL: https://api.github.com/user Jan 25, 2016 11:54:58 AM WARNING org.jenkinsci.plugins.github_branch_source.AbstractGitHubSCMSource$AbstractGitHubSCMSourceDescriptor doFillRepositoryItems Server returned HTTP response code: 401 for URL: https://api.github.com/orgs/nhudacin Jan 25, 2016 11:54:58 AM WARNING org.jenkinsci.plugins.github_branch_source.AbstractGitHubSCMSource$AbstractGitHubSCMSourceDescriptor doFillRepositoryItems Server returned HTTP response code: 401 for URL: https://api.github.com/users/nhudacin

我已经为 GitHub 插件配置了 API 端点(如第一个屏幕截图所示),PR Builder 插件和凭据正在工作(或者看起来如此)。我认为这可能与企业 API 端点配置有关。

有什么帮助吗??我要疯了!

0 投票
4 回答
1340 浏览

jenkins - 如何创建 Jenkins 构建管道?

我已经下载了 Jenkins 的Build Pipeline Plugin

文档状态:

创建新类型 Build Pipeline View 的视图。

然后,您将被直接重定向到配置页面。

我只是看不到创建新管道的正确按钮。我错过了什么?

0 投票
2 回答
10687 浏览

jenkins - 在 Jenkins 工作流程中捕获多个错误

我的工作流在使用 try-catch 失败时发送邮件。我还启用了并发,因此,当同一工作流的多个作业进入节流阶段时,新作业会取消旧作业。这会抛出异常"org.jenkinsci.plugins.workflow.steps.FlowInterruptedException"并且取消的作业也会触发邮件通知。

现在我已经修改了我的工作流程以捕获特定FlowInterruptedException异常并抑制邮件通知并让其他任何事情来触发邮件,就像这样。

这仅捕获FlowInterruptedException并且当作业由于任何其他原因(命令拼写错误等)而真正失败时,我期望它会被另一个捕获并触发其中的代码以发送邮件。但事实并非如此。

我认为我的代码在 try catch 中有一些缺陷。任何想法?

更新:

以防万一,如果我使用下面的代码,它只会发送邮件以解决任何故障

0 投票
2 回答
84518 浏览

jenkins - How do I use Jenkins Pipeline properties step?

I am studying capabilities of Jenkins Pipeline:Multibranch. It is said that a recently introduced properties step might be useful there, but I can't catch how it works and what is its purpose.

Its hint message doesn't seem to be very clear:

Updates the properties of the job which runs this step. Mainly useful from multibranch workflows, so that Jenkinsfile itself can encode what would otherwise be static job configuration.

So I created a new Pipeline with this as a script (pasted directly into Jenkins not in SCM):

I ran it and nothing happened, job didn't received a new parameter and even if it did I don't get why I might need this. Could anyone please explain?

UPDATE1: I tried putting a dummy Pipeline with properties step into my git repo, then configured a multibranch job.

It found my branch, created a job but the build failed with:

UPDATE2: when I put the same script (as in UPD1) back into Jenkins and runs it, it asked for new permission method groovy.lang.GroovyObject getProperty java.lang.String. I approved it, the build went green, however, still no changes to the job configuration appeared.

My env is: Jenkins 1.625.3, Pipeline+Multibranch 1.13

0 投票
8 回答
33013 浏览

git - Jenkins Workflow 插件中的 Git 变量

我想访问 git 变量,例如GIT_COMMITGIT_BRANCH我在构建流中进一步从 git 签出存储库时。目前我发现没有可用的变量来访问这两个参数。

这些变量是否可用,以防万一,我在哪里可以找到它们。我不介意它们是否可以通过一些 groovy 变量或任何地方获得,只是我可以访问它们。

也许我缺乏 Groovy 中的调试技能,这很容易找到,但我只是用我有限的技能找不到它。

0 投票
2 回答
747 浏览

android - 将 .apk 文件作为参数传递给 jenkins 作业

我在 Jenkins 中有一个两步构建管道:

  1. 编译和构建项目
  2. 运行测试

第 1 步为我的 android 项目生成 .apk 文件。

在第 2 步中,我想使用模拟器和上一步中的 .apks 运行仪器测试。

我知道有一个“Jenkins Parameterized Trigger Plugin”:http: //zeroturnaround.com/rebellabs/how-to-use-jenkins-for-job-chaining-and-visualizations/

但是我如何使用它来传递我的 .apks 然后在模拟器中使用它们呢?

在此处输入图像描述

0 投票
0 回答
1232 浏览

jenkins - Jenkins 工作流远程加载程序错误

我正在尝试通过 Jenkins 工作流的远程加载程序插件导入远程脚本。我遇到了一些奇怪的错误。当我将该脚本中的确切代码放入我的主工作流脚本中时,它可以正常工作。

我还尝试从插件的 github 加载示例 hello world 脚本,它可以正常工作。

这是远程脚本:

我的主脚本的相关部分如下所示:

构建的输出是这样的:

感谢您的任何提示!

0 投票
4 回答
50350 浏览

docker - How to enable SCM polling with the Jenkins Pipeline plugin

This is a question related to How to make SCM polling work with the Jenkins Workflow plugin. That thread answers how to use SCM polling in a pipeline script once SCM polling is enabled but does not cover how to enable SCM polling.

For example, if you wanted to use the mulit-branch pipeline plugin to create jobs automatically using a Jenkinsfile there is not a way I know of to have the "Poll SCM" option enabled in the job. This makes it difficult to provision on-demand environments such as creating a docker container that has the jobs setup from the beginning. Because you would have to sign-in to Jenkins and go to the configuration and select the "Poll SCM" option once the container was started. Cloudbees offers a template plugin to help solve this problem.

However this is not available to Jenkins using the free version. Is there any workaround or solution for users on the free version of Jenkins?

0 投票
1 回答
13633 浏览

jenkins - Jenkins dsl pipeline def variable

I'm trying to define a variable into a jenkins pipeline dsl script by reading 3 files and concatenating the output. The 3 files content is:

file1 content is: 127

file2 content is: 0

file3 content is: 1

The output I expect would be

instead my output is:

I know that I am wrong somewhere, but I don't know how to do it. Is there any of you familiar with the Jenkins pipepile dsl/groovy syntax?

Thanks guys